mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
Fix formatting (deno fmt)
This commit is contained in:
@@ -17,7 +17,7 @@ import { calculateBits } from "../../util/permissions.ts";
|
|||||||
/** Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */
|
/** Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */
|
||||||
export async function createChannel(
|
export async function createChannel(
|
||||||
guildId: string,
|
guildId: string,
|
||||||
options?: CreateGuildChannel
|
options?: CreateGuildChannel,
|
||||||
) {
|
) {
|
||||||
const requiredPerms: Set<PermissionStrings> = new Set(["MANAGE_CHANNELS"]);
|
const requiredPerms: Set<PermissionStrings> = new Set(["MANAGE_CHANNELS"]);
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ export async function createChannel(
|
|||||||
}
|
}
|
||||||
eventHandlers.debug?.(
|
eventHandlers.debug?.(
|
||||||
"loop",
|
"loop",
|
||||||
`Running forEach loop in create_channel file.`
|
`Running forEach loop in create_channel file.`,
|
||||||
);
|
);
|
||||||
overwrite.allow.forEach(requiredPerms.add, requiredPerms);
|
overwrite.allow.forEach(requiredPerms.add, requiredPerms);
|
||||||
overwrite.deny.forEach(requiredPerms.add, requiredPerms);
|
overwrite.deny.forEach(requiredPerms.add, requiredPerms);
|
||||||
@@ -51,13 +51,13 @@ export async function createChannel(
|
|||||||
permission_overwrites: useDefaultOverwrites
|
permission_overwrites: useDefaultOverwrites
|
||||||
? options?.permissionOverwrites
|
? options?.permissionOverwrites
|
||||||
: options?.permissionOverwrites?.map((perm) => ({
|
: options?.permissionOverwrites?.map((perm) => ({
|
||||||
...perm,
|
...perm,
|
||||||
|
|
||||||
allow: calculateBits(perm.allow),
|
allow: calculateBits(perm.allow),
|
||||||
deny: calculateBits(perm.deny),
|
deny: calculateBits(perm.deny),
|
||||||
})),
|
})),
|
||||||
type: options?.type || DiscordChannelTypes.GUILD_TEXT,
|
type: options?.type || DiscordChannelTypes.GUILD_TEXT,
|
||||||
}
|
},
|
||||||
)) as DiscordChannel;
|
)) as DiscordChannel;
|
||||||
|
|
||||||
const discordenoChannel = await structures.createDiscordenoChannel(result);
|
const discordenoChannel = await structures.createDiscordenoChannel(result);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const baseChannel: Partial<DiscordenoChannel> = {
|
|||||||
},
|
},
|
||||||
get voiceStates() {
|
get voiceStates() {
|
||||||
return this.guild?.voiceStates.filter(
|
return this.guild?.voiceStates.filter(
|
||||||
(voiceState) => voiceState.channelId === this.id
|
(voiceState) => voiceState.channelId === this.id,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
get connectedMembers() {
|
get connectedMembers() {
|
||||||
@@ -41,7 +41,7 @@ const baseChannel: Partial<DiscordenoChannel> = {
|
|||||||
if (!voiceStates) return undefined;
|
if (!voiceStates) return undefined;
|
||||||
|
|
||||||
return new Collection(
|
return new Collection(
|
||||||
voiceStates.map((vs, key) => [key, cache.members.get(key)])
|
voiceStates.map((vs, key) => [key, cache.members.get(key)]),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
send(content) {
|
send(content) {
|
||||||
@@ -64,7 +64,7 @@ const baseChannel: Partial<DiscordenoChannel> = {
|
|||||||
this.guildId!,
|
this.guildId!,
|
||||||
this.id!,
|
this.id!,
|
||||||
overwrites,
|
overwrites,
|
||||||
permissions
|
permissions,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
edit(options, reason) {
|
edit(options, reason) {
|
||||||
@@ -79,7 +79,7 @@ const baseChannel: Partial<DiscordenoChannel> = {
|
|||||||
// deno-lint-ignore require-await
|
// deno-lint-ignore require-await
|
||||||
export async function createDiscordenoChannel(
|
export async function createDiscordenoChannel(
|
||||||
data: DiscordChannel,
|
data: DiscordChannel,
|
||||||
guildId?: string
|
guildId?: string,
|
||||||
) {
|
) {
|
||||||
const {
|
const {
|
||||||
guildId: rawGuildId = "",
|
guildId: rawGuildId = "",
|
||||||
@@ -91,7 +91,7 @@ export async function createDiscordenoChannel(
|
|||||||
Object.keys(rest).forEach((key) => {
|
Object.keys(rest).forEach((key) => {
|
||||||
eventHandlers.debug?.(
|
eventHandlers.debug?.(
|
||||||
"loop",
|
"loop",
|
||||||
`Running forEach loop in createDiscordenoChannel function.`
|
`Running forEach loop in createDiscordenoChannel function.`,
|
||||||
);
|
);
|
||||||
// @ts-ignore index signature
|
// @ts-ignore index signature
|
||||||
props[key] = createNewProp(rest[key]);
|
props[key] = createNewProp(rest[key]);
|
||||||
@@ -101,7 +101,7 @@ export async function createDiscordenoChannel(
|
|||||||
...props,
|
...props,
|
||||||
guildId: createNewProp(guildId || rawGuildId),
|
guildId: createNewProp(guildId || rawGuildId),
|
||||||
lastPinTimestamp: createNewProp(
|
lastPinTimestamp: createNewProp(
|
||||||
lastPinTimestamp ? Date.parse(lastPinTimestamp) : undefined
|
lastPinTimestamp ? Date.parse(lastPinTimestamp) : undefined,
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -152,16 +152,16 @@ export interface DiscordenoChannel
|
|||||||
/** Edit a channel Overwrite */
|
/** Edit a channel Overwrite */
|
||||||
editOverwrite(
|
editOverwrite(
|
||||||
overwriteID: string,
|
overwriteID: string,
|
||||||
options: Omit<Overwrite, "id">
|
options: Omit<Overwrite, "id">,
|
||||||
): ReturnType<typeof editChannelOverwrite>;
|
): ReturnType<typeof editChannelOverwrite>;
|
||||||
/** Delete a channel Overwrite */
|
/** Delete a channel Overwrite */
|
||||||
deleteOverwrite(
|
deleteOverwrite(
|
||||||
overwriteID: string
|
overwriteID: string,
|
||||||
): ReturnType<typeof deleteChannelOverwrite>;
|
): ReturnType<typeof deleteChannelOverwrite>;
|
||||||
/** Checks if a channel overwrite for a user id or a role id has permission in this channel */
|
/** Checks if a channel overwrite for a user id or a role id has permission in this channel */
|
||||||
hasPermission(
|
hasPermission(
|
||||||
overwrites: DiscordOverwrite[],
|
overwrites: DiscordOverwrite[],
|
||||||
permissions: PermissionStrings[]
|
permissions: PermissionStrings[],
|
||||||
): ReturnType<typeof channelOverwriteHasPermission>;
|
): ReturnType<typeof channelOverwriteHasPermission>;
|
||||||
/** Edit the channel */
|
/** Edit the channel */
|
||||||
edit(options: ModifyChannel, reason?: string): ReturnType<typeof editChannel>;
|
edit(options: ModifyChannel, reason?: string): ReturnType<typeof editChannel>;
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ Deno.test({
|
|||||||
|
|
||||||
if (originalChannel.topic && cloned.topic !== originalChannel.topic) {
|
if (originalChannel.topic && cloned.topic !== originalChannel.topic) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"The clone was supposed to have a topic but it does not appear to be the same topic."
|
"The clone was supposed to have a topic but it does not appear to be the same topic.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (originalChannel.bitrate && cloned.bitrate !== originalChannel.bitrate) {
|
if (originalChannel.bitrate && cloned.bitrate !== originalChannel.bitrate) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"The clone was supposed to have a bitrate but it does not appear to be the same bitrate."
|
"The clone was supposed to have a bitrate but it does not appear to be the same bitrate.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ Deno.test({
|
|||||||
originalChannel.permissionOverwrites.length
|
originalChannel.permissionOverwrites.length
|
||||||
) {
|
) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"The clone was supposed to have a permissionOverwrites but it does not appear to be the same permissionOverwrites."
|
"The clone was supposed to have a permissionOverwrites but it does not appear to be the same permissionOverwrites.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user