diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-24 00:56:16 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-24 00:56:16 -0400 |
commit | 4176b6258e44e4a095376aaf0f4c687244243a69 (patch) | |
tree | 3b9144be9a2045483c90d92fff05b3ca0b288e52 /src/commands/moulberry-bush/giveawayPing.ts | |
parent | e80446e23060c0325bbd6db620920d86694ec3ce (diff) | |
download | tanzanite-4176b6258e44e4a095376aaf0f4c687244243a69.tar.gz tanzanite-4176b6258e44e4a095376aaf0f4c687244243a69.tar.bz2 tanzanite-4176b6258e44e4a095376aaf0f4c687244243a69.zip |
feat(*): Began working on other punishment commands etc
Diffstat (limited to 'src/commands/moulberry-bush/giveawayPing.ts')
-rw-r--r-- | src/commands/moulberry-bush/giveawayPing.ts | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index d308602..19163d7 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -1,5 +1,5 @@ -import { Message, NewsChannel, TextChannel, WebhookClient } from 'discord.js'; import { BushCommand } from '../../lib/extensions/BushCommand'; +import { BushMessage } from '../../lib/extensions/BushMessage'; import AllowedMentions from '../../lib/utils/AllowedMentions'; export default class GiveawayPingCommand extends BushCommand { @@ -19,16 +19,26 @@ export default class GiveawayPingCommand extends BushCommand { ignorePermissions: [], cooldown: 1.44e7, //4 hours ratelimit: 1, - editable: false + editable: false, + restrictedGuilds: ['516977525906341928'], + restrictedChannels: ['767782084981817344', '833855738501267456'] }); } - public async exec(message: Message): Promise<unknown> { - if (message.guild.id !== '516977525906341928') - return message.reply(`${this.client.util.emojis.error} This command may only be run in Moulberry's Bush.`); - if (!['767782084981817344', '833855738501267456'].includes(message.channel.id)) - return message.reply(`${this.client.util.emojis.error} This command may only be run in giveaway channels.`); - await message.delete().catch(() => undefined); - const webhooks = await (message.channel as TextChannel | NewsChannel).fetchWebhooks(); + + public async exec(message: BushMessage): Promise<unknown> { + if (!message.member.permissions.has('MANAGE_GUILD')) + await message.util.reply(`${this.client.util.emojis.error} You are missing the \`manage server\` permission.`); + + await message.delete().catch(() => {}); + + return await message.channel.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.', + allowedMentions: AllowedMentions.roles() + }); + + //! 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'); @@ -37,11 +47,12 @@ export default class GiveawayPingCommand extends BushCommand { const webhook = webhooks.first(); webhookClient = new WebhookClient(webhook.id, webhook.token); } - return webhookClient.send({ - content: `🎉 <@&767782793261875210> Giveaway.\n\n${this.client.util.emojis.mad} 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.`, + 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({ dynamic: true }), allowedMentions: AllowedMentions.roles() - }); + }); */ } } |