mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-11-03 15:49:50 +01:00
feat(arabot): add suggestions handler
This commit is contained in:
parent
6e4607161b
commit
a047ade28f
62
src/listeners/suggestions.ts
Normal file
62
src/listeners/suggestions.ts
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
/*
|
||||||
|
Animal Rights Advocates Discord Bot
|
||||||
|
Copyright (C) 2023 Anthony Berg
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Listener } from '@sapphire/framework';
|
||||||
|
import { EmbedBuilder } from 'discord.js';
|
||||||
|
import type { Message } from 'discord.js';
|
||||||
|
import IDs from '#utils/ids';
|
||||||
|
|
||||||
|
export class Suggestions extends Listener {
|
||||||
|
public constructor(context: Listener.Context, options: Listener.Options) {
|
||||||
|
super(context, {
|
||||||
|
...options,
|
||||||
|
event: 'messageCreate',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public async run(message: Message) {
|
||||||
|
if (message.channelId !== IDs.channels.information.suggestions) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mailbox = await this.container.client.channels.cache
|
||||||
|
.get(IDs.channels.staff.mailbox);
|
||||||
|
|
||||||
|
if (mailbox === undefined
|
||||||
|
|| !mailbox.isTextBased()) {
|
||||||
|
this.container.logger.error('Mailbox is not a TextBased channel or is undefined');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const suggestion = new EmbedBuilder()
|
||||||
|
.setColor('#FFFFFF')
|
||||||
|
.setAuthor({ name: `Suggestion from ${message.author.tag}`, iconURL: `${message.author.avatarURL()}` })
|
||||||
|
.addFields(
|
||||||
|
{ name: 'Suggestion:', value: message.content },
|
||||||
|
)
|
||||||
|
.setTimestamp();
|
||||||
|
|
||||||
|
const sent = await mailbox.send({ embeds: [suggestion], content: message.author.toString() });
|
||||||
|
await message.delete();
|
||||||
|
|
||||||
|
await sent.react('👍');
|
||||||
|
await sent.react('👎');
|
||||||
|
await sent.react('<:catshrug:917505035196313671>');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -68,9 +68,11 @@ const devIDs = {
|
|||||||
news: '999431676058927247',
|
news: '999431676058927247',
|
||||||
conduct: '999431676058927248',
|
conduct: '999431676058927248',
|
||||||
roles: '999431676058927250',
|
roles: '999431676058927250',
|
||||||
|
suggestions: '999431676058927251',
|
||||||
},
|
},
|
||||||
staff: {
|
staff: {
|
||||||
coordinators: '999431676058927254',
|
coordinators: '999431676058927254',
|
||||||
|
mailbox: '999431676289622182',
|
||||||
standup: '999431676289622183',
|
standup: '999431676289622183',
|
||||||
verifiers: '999431677006860411',
|
verifiers: '999431677006860411',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -71,9 +71,11 @@ let IDs = {
|
|||||||
news: '866000393259319306',
|
news: '866000393259319306',
|
||||||
conduct: '990728521531920385',
|
conduct: '990728521531920385',
|
||||||
roles: '990761562199457813',
|
roles: '990761562199457813',
|
||||||
|
suggestions: '831940452609556511',
|
||||||
},
|
},
|
||||||
staff: {
|
staff: {
|
||||||
coordinators: '1006240682505142354',
|
coordinators: '1006240682505142354',
|
||||||
|
mailbox: '972364104838824116',
|
||||||
standup: '996009201237233684',
|
standup: '996009201237233684',
|
||||||
verifiers: '873215538627756072',
|
verifiers: '873215538627756072',
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user