diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-17 20:03:05 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-17 20:03:05 -0400 |
commit | e1c613829950a534d9f45c00a033b83575be3b3c (patch) | |
tree | 2de1e5231217211ae4087c46cc74dc46c584507a /src/commands/moulberry-bush | |
parent | 0e87bbd3940d89defcb04926587b35c8f4d1947f (diff) | |
download | tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.gz tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.bz2 tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.zip |
remove global client variable
Diffstat (limited to 'src/commands/moulberry-bush')
-rw-r--r-- | src/commands/moulberry-bush/giveawayPing.ts | 35 | ||||
-rw-r--r-- | src/commands/moulberry-bush/report.ts | 2 |
2 files changed, 20 insertions, 17 deletions
diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index 0cadd6a..d93e0c9 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -1,4 +1,5 @@ import { AllowedMentions, BushCommand, clientSendAndPermCheck, emojis, type CommandMessage } from '#lib'; +import assert from 'assert'; import { PermissionFlagsBits } from 'discord.js'; export default class GiveawayPingCommand extends BushCommand { @@ -29,6 +30,8 @@ export default class GiveawayPingCommand extends BushCommand { } public override async exec(message: CommandMessage) { + assert(message.inGuild()); + if (!message.member!.permissions.has(PermissionFlagsBits.ManageGuild) && !message.member!.user.isOwner()) await message.util.reply(`${emojis.error} You are missing the **ManageGuild** permission.`); @@ -41,21 +44,21 @@ export default class GiveawayPingCommand extends BushCommand { }); //! Broken - /* const webhooks = await (message.channel as TextChannel | NewsChannel).fetchWebhooks(); - let webhookClient: WebhookClient; - if (webhooks.size < 1) { - const webhook = await (message.channel as TextChannel | NewsChannel).createWebhook('Giveaway ping webhook'); - webhookClient = new WebhookClient(webhook.id, webhook.token); - } else { - const webhook = webhooks.first(); - webhookClient = new WebhookClient(webhook.id, webhook.token); - } - return await webhookClient.send({ - content: - '🎉 <@&767782793261875210> Giveaway.\n\n<:mad:783046135392239626> Spamming, line breaking, gibberish etc. disqualifies you from winning. We can and will ban you from giveaways. Winners will all be checked and rerolled if needed.', - username: `${message.member.nickname || message.author.username}`, - avatarURL: message.author.avatarURL(), - allowedMentions: AllowedMentions.roles() - }); */ + // const webhooks = await message.channel.fetchWebhooks(); + // let webhookClient: WebhookClient; + // if (webhooks.size < 1) { + // const webhook = await message.channel.createWebhook('Giveaway ping webhook'); + // webhookClient = new WebhookClient(webhook.id, webhook.token); + // } else { + // const webhook = webhooks.first(); + // webhookClient = new WebhookClient(webhook.id, webhook.token); + // } + // return await webhookClient.send({ + // content: + // '🎉 <@&767782793261875210> Giveaway.\n\n<:mad:783046135392239626> Spamming, line breaking, gibberish etc. disqualifies you from winning. We can and will ban you from giveaways. Winners will all be checked and rerolled if needed.', + // username: `${message.member?.nickname ?? message.author.username}`, + // avatarURL: message.author.avatarURL(), + // allowedMentions: AllowedMentions.roles() + // }); } } diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 06c1ad2..47e45f9 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -112,7 +112,7 @@ export default class ReportCommand extends BushCommand { await ReportMessage.react(emojis.check); await ReportMessage.react(emojis.cross); } catch { - void client.console.warn('ReportCommand', 'Could not react to report message.'); + void this.client.console.warn('ReportCommand', 'Could not react to report message.'); } }); return await message.util.reply('Successfully made a report.'); |