Requested Changes
This commit is contained in:
parent
87e1aad7e0
commit
94b33c9c8a
5 changed files with 9 additions and 9 deletions
|
@ -14,9 +14,9 @@ export class EmojisManager extends BaseManager<EmojiPayload, Emoji> {
|
|||
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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -211,7 +211,7 @@ export class Guild extends Base {
|
|||
}
|
||||
}
|
||||
|
||||
async getEveryoneRole(): Promise<Role> {
|
||||
async getEveryoneRole (): Promise<Role> {
|
||||
return (await this.roles.array().then(arr => arr?.sort((b, a) => a.position - b.position)[0]) as any) as Role
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}`)
|
||||
|
|
Loading…
Reference in a new issue