From 94b33c9c8afde849a4af79c4efe99449c22b3a2a Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Sun, 8 Nov 2020 17:06:30 +0530 Subject: [PATCH] Requested Changes --- src/managers/emojis.ts | 4 ++-- src/managers/guildEmojis.ts | 4 ++-- src/structures/emoji.ts | 2 +- src/structures/guild.ts | 2 +- src/test/cmds/addemoji.ts | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/managers/emojis.ts b/src/managers/emojis.ts index 68f8088..baeda1a 100644 --- a/src/managers/emojis.ts +++ b/src/managers/emojis.ts @@ -14,9 +14,9 @@ export class EmojisManager extends BaseManager { const raw = await this._get(key) if (raw === undefined) return const emoji = new this.DataType(this.client, raw) - if((raw as any).guild_id !== undefined) { + if ((raw as any).guild_id !== undefined) { const guild = await this.client.guilds.get((raw as any).guild_id) - if(guild !== undefined) emoji.guild = guild + if (guild !== undefined) emoji.guild = guild } return emoji } diff --git a/src/managers/guildEmojis.ts b/src/managers/guildEmojis.ts index 825b1ab..a9b8051 100644 --- a/src/managers/guildEmojis.ts +++ b/src/managers/guildEmojis.ts @@ -53,8 +53,8 @@ export class GuildEmojisManager extends BaseChildManager< let roleIDs: string[] = [] if (roles !== undefined && typeof roles === "string") roleIDs = [roles] else if (roles !== undefined) { - if(roles?.length === 0) reject(new Error("Empty Roles array was provided")) - if(roles[0] instanceof Role) roleIDs = (roles as any).map((r: Role) => r.id) + if (roles?.length === 0) reject(new Error("Empty Roles array was provided")) + if (roles[0] instanceof Role) roleIDs = (roles as any).map((r: Role) => r.id) else roleIDs = roles as string[] } else roles = [this.guild.id] this.client.rest diff --git a/src/structures/emoji.ts b/src/structures/emoji.ts index 6c49918..146b70e 100644 --- a/src/structures/emoji.ts +++ b/src/structures/emoji.ts @@ -30,7 +30,7 @@ export class Emoji extends Base { super(client, data) this.id = data.id this.name = data.name - if(data.user !== undefined) this.user = new User(this.client, data.user) + if (data.user !== undefined) this.user = new User(this.client, data.user) this.roles = data.roles this.requireColons = data.require_colons this.managed = data.managed diff --git a/src/structures/guild.ts b/src/structures/guild.ts index ab43c9a..05788f5 100644 --- a/src/structures/guild.ts +++ b/src/structures/guild.ts @@ -211,7 +211,7 @@ export class Guild extends Base { } } - async getEveryoneRole(): Promise { + async getEveryoneRole (): Promise { return (await this.roles.array().then(arr => arr?.sort((b, a) => a.position - b.position)[0]) as any) as Role } } diff --git a/src/test/cmds/addemoji.ts b/src/test/cmds/addemoji.ts index e2eb669..e3f5a7b 100644 --- a/src/test/cmds/addemoji.ts +++ b/src/test/cmds/addemoji.ts @@ -9,11 +9,11 @@ export default class AddEmojiCommand extends Command { execute(ctx: CommandContext): any { const name = ctx.args[0] - if(name === undefined) return ctx.message.reply('No name was given!') + if (name === undefined) return ctx.message.reply('No name was given!') const url = ctx.argString.slice(name.length).trim() - if(url === '') return ctx.message.reply('No URL was given!') + if (url === '') return ctx.message.reply('No URL was given!') ctx.message.guild?.emojis.create(name, url).then(emoji => { - if(emoji === undefined) throw new Error('Unknown') + if (emoji === undefined) throw new Error('Unknown') ctx.message.reply(`Successfuly added emoji ${emoji.toString()} ${emoji.name}!`) }).catch(e => { ctx.message.reply(`Failed to add emoji. Reason: ${e.message}`)