Fix formatting (deno fmt)

This commit is contained in:
Exists
2021-04-14 13:09:47 -04:00
parent ce36477426
commit 215141171a
3 changed files with 19 additions and 19 deletions
+3 -3
View File
@@ -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);
@@ -57,7 +57,7 @@ export async function createChannel(
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);
+9 -9
View File
@@ -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>;
+3 -3
View File
@@ -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.",
); );
} }
}, },