diff options
Diffstat (limited to 'src/lib/extensions')
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 8 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushSlashMessage.ts | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index c15ca1c..5a71167 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -51,7 +51,6 @@ import got from 'got'; import humanizeDuration from 'humanize-duration'; import _ from 'lodash'; import moment from 'moment'; -import fetch from 'node-fetch'; import { inspect, InspectOptions, promisify } from 'util'; import CommandErrorListener from '../../../listeners/commands/commandError'; import { ActivePunishment, ActivePunishmentType } from '../../models/ActivePunishment'; @@ -1466,9 +1465,10 @@ export class BushClientUtil extends ClientUtil { public async getPronounsOf(user: User | Snowflake): Promise<Pronoun | undefined> { const _user = await this.resolveNonCachedUser(user); if (!_user) throw new Error(`Cannot find user ${user}`); - const apiRes: { pronouns: PronounCode } | undefined = await fetch( - `https://pronoundb.org/api/v1/lookup?platform=discord&id=${_user.id}` - ).then(async (r) => (r.ok ? ((await r.json()) as { pronouns: PronounCode }) : undefined)); + const apiRes = (await got + .get(`https://pronoundb.org/api/v1/lookup?platform=discord&id=${_user.id}`) + .json() + .catch(() => undefined)) as { pronouns: PronounCode } | undefined; if (!apiRes) return undefined; if (!apiRes.pronouns) throw new Error('apiRes.pronouns is undefined'); diff --git a/src/lib/extensions/discord-akairo/BushSlashMessage.ts b/src/lib/extensions/discord-akairo/BushSlashMessage.ts index 442b0d4..d75d0a7 100644 --- a/src/lib/extensions/discord-akairo/BushSlashMessage.ts +++ b/src/lib/extensions/discord-akairo/BushSlashMessage.ts @@ -4,7 +4,6 @@ import { BushGuild } from '../discord.js/BushGuild'; import { BushGuildMember } from '../discord.js/BushGuildMember'; import { BushUser } from '../discord.js/BushUser'; import { BushClient } from './BushClient'; -import { BushCommand } from './BushCommand'; import { BushCommandUtil } from './BushCommandUtil'; export class BushSlashMessage extends AkairoMessage { @@ -12,8 +11,8 @@ export class BushSlashMessage extends AkairoMessage { public declare util: BushCommandUtil; public declare author: BushUser; public declare member: BushGuildMember | null; - public constructor(client: BushClient, interaction: CommandInteraction, command: BushCommand) { - super(client, interaction, command); + public constructor(client: BushClient, interaction: CommandInteraction) { + super(client, interaction); } public override get guild(): BushGuild | null { |