upgrade(arabot): upgrade sapphire to v4

This commit is contained in:
smyalygames 2023-01-14 22:21:42 +00:00
parent f6b321e454
commit e5dfa51cc9
33 changed files with 1177 additions and 835 deletions

1583
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -26,18 +26,16 @@
}, },
"homepage": "https://github.com/veganhacktivists/arabot#readme", "homepage": "https://github.com/veganhacktivists/arabot#readme",
"dependencies": { "dependencies": {
"@discordjs/builders": "^1.3.0",
"@prisma/client": "^4.0.0", "@prisma/client": "^4.0.0",
"@sapphire/discord.js-utilities": "^5.0.0", "@sapphire/discord.js-utilities": "^6.0.0",
"@sapphire/framework": "^3.1.3", "@sapphire/framework": "^4.0.1",
"@sapphire/plugin-scheduled-tasks": "^4.0.0", "@sapphire/plugin-scheduled-tasks": "^4.0.0",
"@sapphire/plugin-subcommands": "^3.0.0", "@sapphire/plugin-subcommands": "^4.0.0",
"@sapphire/stopwatch": "^1.4.1", "@sapphire/stopwatch": "^1.4.1",
"@sapphire/utilities": "^3.9.2", "@sapphire/utilities": "^3.9.2",
"@types/node": "^18.0.3", "@types/node": "^18.0.3",
"bullmq": "^1.89.1", "bullmq": "^1.89.1",
"discord-api-types": "^0.33.3", "discord.js": "^14.7.1",
"discord.js": "^13.12.0",
"dotenv": "^16.0.1", "dotenv": "^16.0.1",
"ts-node": "^10.8.2", "ts-node": "^10.8.2",
"typescript": "^4.7.4" "typescript": "^4.7.4"

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { N1984 } from '../../utils/gifs'; import { N1984 } from '../../utils/gifs';
class N1984Command extends Command { class N1984Command extends Command {
@ -44,7 +44,7 @@ class N1984Command extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// Get the user // Get the user
// TODO exception handling // TODO exception handling
const member = interaction.member!.user; const member = interaction.member!.user;
@ -54,7 +54,7 @@ class N1984Command extends Command {
// Add a 1 in 1000 chance of Dantas literally making ARA 1984 // Add a 1 in 1000 chance of Dantas literally making ARA 1984
const random1984 = Math.random() < 0.001 ? 'https://c.tenor.com/0BwU0BjWYX4AAAAC/arthuria-dantas.gif' const random1984 = Math.random() < 0.001 ? 'https://c.tenor.com/0BwU0BjWYX4AAAAC/arthuria-dantas.gif'
: N1984[Math.floor(Math.random() * N1984.length)]; : N1984[Math.floor(Math.random() * N1984.length)];
const n1984Embed = new MessageEmbed() const n1984Embed = new EmbedBuilder()
.setColor('#ffffff') .setColor('#ffffff')
.setTitle(`${memberGuildMember.displayName} is happy!`) .setTitle(`${memberGuildMember.displayName} is happy!`)
.setImage(random1984); .setImage(random1984);

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { Happy } from '../../utils/gifs'; import { Happy } from '../../utils/gifs';
class HappyCommand extends Command { class HappyCommand extends Command {
@ -44,7 +44,7 @@ class HappyCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// Get the user // Get the user
// TODO exception handling // TODO exception handling
const member = interaction.member!.user; const member = interaction.member!.user;
@ -52,7 +52,7 @@ class HappyCommand extends Command {
// Creates the embed for the happy reaction // Creates the embed for the happy reaction
const randomHappy = Happy[Math.floor(Math.random() * Happy.length)]; const randomHappy = Happy[Math.floor(Math.random() * Happy.length)];
const happyEmbed = new MessageEmbed() const happyEmbed = new EmbedBuilder()
.setColor('#40ff00') .setColor('#40ff00')
.setTitle(`${memberGuildMember.displayName} is happy!`) .setTitle(`${memberGuildMember.displayName} is happy!`)
.setImage(randomHappy); .setImage(randomHappy);

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { Hugs } from '../../utils/gifs'; import { Hugs } from '../../utils/gifs';
class HugCommand extends Command { class HugCommand extends Command {
@ -46,7 +46,7 @@ class HugCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// Get the users // Get the users
// TODO exception handling // TODO exception handling
const user = interaction.options.getUser('user')!; const user = interaction.options.getUser('user')!;
@ -55,7 +55,7 @@ class HugCommand extends Command {
// Creates the embed for the hug // Creates the embed for the hug
const randomHug = Hugs[Math.floor(Math.random() * Hugs.length)]; const randomHug = Hugs[Math.floor(Math.random() * Hugs.length)];
const hugEmbed = new MessageEmbed() const hugEmbed = new EmbedBuilder()
.setColor('#0099ff') .setColor('#0099ff')
.setTitle(`Hug from ${huggerGuildMember.displayName}`) .setTitle(`Hug from ${huggerGuildMember.displayName}`)
.setImage(randomHug); .setImage(randomHug);

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { Kill } from '../../utils/gifs'; import { Kill } from '../../utils/gifs';
class KillCommand extends Command { class KillCommand extends Command {
@ -46,7 +46,7 @@ class KillCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// Get the users // Get the users
// TODO exception handling // TODO exception handling
const user = interaction.options.getUser('user')!; const user = interaction.options.getUser('user')!;
@ -55,7 +55,7 @@ class KillCommand extends Command {
// Creates the embed for the kill // Creates the embed for the kill
const randomKill = Kill[Math.floor(Math.random() * Kill.length)]; const randomKill = Kill[Math.floor(Math.random() * Kill.length)];
const killEmbed = new MessageEmbed() const killEmbed = new EmbedBuilder()
.setColor('#ff0000') .setColor('#ff0000')
.setTitle(`Kill from ${killerGuildMember.displayName}`) .setTitle(`Kill from ${killerGuildMember.displayName}`)
.setImage(randomKill); .setImage(randomKill);

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { Poke } from '../../utils/gifs'; import { Poke } from '../../utils/gifs';
class PokeCommand extends Command { class PokeCommand extends Command {
@ -47,7 +47,7 @@ class PokeCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// Get the users // Get the users
// TODO exception handling // TODO exception handling
const user = interaction.options.getUser('user')!; const user = interaction.options.getUser('user')!;
@ -56,7 +56,7 @@ class PokeCommand extends Command {
// Creates the embed for the poke // Creates the embed for the poke
const randomPoke = Poke[Math.floor(Math.random() * Poke.length)]; const randomPoke = Poke[Math.floor(Math.random() * Poke.length)];
const pokeEmbed = new MessageEmbed() const pokeEmbed = new EmbedBuilder()
.setColor('#0099ff') .setColor('#0099ff')
.setTitle(`Poke from ${pokerGuildMember.displayName}`) .setTitle(`Poke from ${pokerGuildMember.displayName}`)
.setImage(randomPoke); .setImage(randomPoke);

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { Sad } from '../../utils/gifs'; import { Sad } from '../../utils/gifs';
class SadCommand extends Command { class SadCommand extends Command {
@ -44,7 +44,7 @@ class SadCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// Get the user // Get the user
// TODO exception handling // TODO exception handling
const member = interaction.member!.user; const member = interaction.member!.user;
@ -52,7 +52,7 @@ class SadCommand extends Command {
// Creates the embed for the sad reaction // Creates the embed for the sad reaction
const randomSad = Sad[Math.floor(Math.random() * Sad.length)]; const randomSad = Sad[Math.floor(Math.random() * Sad.length)];
const sadEmbed = new MessageEmbed() const sadEmbed = new EmbedBuilder()
.setColor('#001148') .setColor('#001148')
.setTitle(`${memberGuildMember.displayName} is sad...`) .setTitle(`${memberGuildMember.displayName} is sad...`)
.setImage(randomSad); .setImage(randomSad);

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { MessageEmbed } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { Shrug } from '../../utils/gifs'; import { Shrug } from '../../utils/gifs';
class ShrugCommand extends Command { class ShrugCommand extends Command {
@ -44,7 +44,7 @@ class ShrugCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// Get the user // Get the user
// TODO exception handling // TODO exception handling
const member = interaction.member!.user; const member = interaction.member!.user;
@ -52,7 +52,7 @@ class ShrugCommand extends Command {
// Creates the embed for the shrug reaction // Creates the embed for the shrug reaction
const randomShrug = Shrug[Math.floor(Math.random() * Shrug.length)]; const randomShrug = Shrug[Math.floor(Math.random() * Shrug.length)];
const shrugEmbed = new MessageEmbed() const shrugEmbed = new EmbedBuilder()
.setColor('#001980') .setColor('#001980')
.setTitle(`${memberGuildMember.displayName} shrugs`) .setTitle(`${memberGuildMember.displayName} shrugs`)
.setImage(randomShrug); .setImage(randomShrug);

View File

@ -52,7 +52,7 @@ class BanCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// Get the arguments // Get the arguments
const user = interaction.options.getUser('user'); const user = interaction.options.getUser('user');
const reason = interaction.options.getString('reason'); const reason = interaction.options.getString('reason');

View File

@ -18,6 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { ChannelType, PermissionsBitField } from 'discord.js';
import type { TextChannel } from 'discord.js'; import type { TextChannel } from 'discord.js';
import IDs from '../../utils/ids'; import IDs from '../../utils/ids';
@ -46,7 +47,7 @@ class ToggleOpenCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
const subcommand = interaction.options.getSubcommand(true); const subcommand = interaction.options.getSubcommand(true);
// Checks what subcommand was run // Checks what subcommand was run
@ -67,7 +68,7 @@ class ToggleOpenCommand extends Command {
} }
// Command run // Command run
public async toggleOpen(interaction: Command.ChatInputInteraction) { public async toggleOpen(interaction: Command.ChatInputCommandInteraction) {
// Check if guild is not null // Check if guild is not null
if (interaction.guild === null) { if (interaction.guild === null) {
await interaction.reply({ await interaction.reply({
@ -91,7 +92,7 @@ class ToggleOpenCommand extends Command {
} }
// Check if channel is text // Check if channel is text
if (!channel.isText()) { if (channel.type !== ChannelType.GuildText) {
await interaction.reply({ await interaction.reply({
content: 'Channel is not a text channel!', content: 'Channel is not a text channel!',
ephemeral: true, ephemeral: true,
@ -114,10 +115,10 @@ class ToggleOpenCommand extends Command {
} }
// Checks if the channel is open // Checks if the channel is open
const open = channel.permissionsFor(IDs.roles.vegan.vegan)!.has(['SEND_MESSAGES']); const open = channel.permissionsFor(IDs.roles.vegan.vegan)!.has([PermissionsBitField.Flags.SendMessages]);
// Toggle send message in channel // Toggle send message in channel
await channelText.permissionOverwrites.edit(IDs.roles.vegan.vegan, { SEND_MESSAGES: !open }); await channelText.permissionOverwrites.edit(IDs.roles.vegan.vegan, { SendMessages: !open });
await interaction.reply({ await interaction.reply({
content: `${!open ? 'Opened' : 'Closed'} this channel.`, content: `${!open ? 'Opened' : 'Closed'} this channel.`,

View File

@ -19,11 +19,12 @@
import { Command, RegisterBehavior, Args } from '@sapphire/framework'; import { Command, RegisterBehavior, Args } from '@sapphire/framework';
import { import {
MessageEmbed, ChannelType,
MessageActionRow, EmbedBuilder,
MessageButton, ActionRowBuilder,
Constants, ButtonBuilder,
ButtonInteraction, ButtonInteraction,
ButtonStyle,
} from 'discord.js'; } from 'discord.js';
import type { Message, GuildMember, TextChannel } from 'discord.js'; import type { Message, GuildMember, TextChannel } from 'discord.js';
import { isMessageInstance } from '@sapphire/discord.js-utilities'; import { isMessageInstance } from '@sapphire/discord.js-utilities';
@ -89,7 +90,7 @@ class SusCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
const subcommand = interaction.options.getSubcommand(true); const subcommand = interaction.options.getSubcommand(true);
// Checks what subcommand was run // Checks what subcommand was run
@ -122,7 +123,7 @@ class SusCommand extends Command {
} }
// Subcommand to add sus note // Subcommand to add sus note
private async addNote(interaction: Command.ChatInputInteraction) { private async addNote(interaction: Command.ChatInputCommandInteraction) {
// Get the arguments // Get the arguments
const user = interaction.options.getUser('user'); const user = interaction.options.getUser('user');
const note = interaction.options.getString('note'); const note = interaction.options.getString('note');
@ -176,7 +177,7 @@ class SusCommand extends Command {
}); });
} }
private async listNote(interaction: Command.ChatInputInteraction) { private async listNote(interaction: Command.ChatInputCommandInteraction) {
// Get the arguments // Get the arguments
const user = interaction.options.getUser('user'); const user = interaction.options.getUser('user');
const { guild } = interaction; const { guild } = interaction;
@ -194,7 +195,7 @@ class SusCommand extends Command {
let staffChannel = false; let staffChannel = false;
let { channel } = interaction; let { channel } = interaction;
if (channel !== null) { if (channel !== null) {
if (channel.type === 'GUILD_TEXT') { if (channel.type === ChannelType.GuildText) {
channel = channel as TextChannel; channel = channel as TextChannel;
staffChannel = checkStaff(channel); staffChannel = checkStaff(channel);
} }
@ -214,7 +215,7 @@ class SusCommand extends Command {
} }
// Creates the embed to display the sus note // Creates the embed to display the sus note
const noteEmbed = new MessageEmbed() const noteEmbed = new EmbedBuilder()
.setColor('#0099ff') .setColor('#0099ff')
.setTitle(`${notes.length} sus notes for ${user.username}`) .setTitle(`${notes.length} sus notes for ${user.username}`)
.setThumbnail(user.avatarURL()!); .setThumbnail(user.avatarURL()!);
@ -242,7 +243,7 @@ class SusCommand extends Command {
}); });
} }
private async removeNote(interaction: Command.ChatInputInteraction) { private async removeNote(interaction: Command.ChatInputCommandInteraction) {
// Get the arguments // Get the arguments
const noteId = interaction.options.getInteger('id'); const noteId = interaction.options.getInteger('id');
const { guild, channel } = interaction; const { guild, channel } = interaction;
@ -297,7 +298,7 @@ class SusCommand extends Command {
} }
// Create an embed for the note // Create an embed for the note
const noteEmbed = new MessageEmbed() const noteEmbed = new EmbedBuilder()
.setColor('#ff0000') .setColor('#ff0000')
.setTitle(`Sus note for ${userName}`) .setTitle(`Sus note for ${userName}`)
.setThumbnail(user.avatarURL()!) // TODO avatar does not show when run .setThumbnail(user.avatarURL()!) // TODO avatar does not show when run
@ -307,16 +308,16 @@ class SusCommand extends Command {
}); });
// Create buttons to delete or cancel the deletion // Create buttons to delete or cancel the deletion
const buttons = new MessageActionRow<MessageButton>() const buttons = new ActionRowBuilder<ButtonBuilder>()
.addComponents( .addComponents(
new MessageButton() new ButtonBuilder()
.setCustomId(`delete${noteId}`) .setCustomId(`delete${noteId}`)
.setLabel('Delete') .setLabel('Delete')
.setStyle(Constants.MessageButtonStyles.DANGER), .setStyle(ButtonStyle.Danger),
new MessageButton() new ButtonBuilder()
.setCustomId(`cancel${noteId}`) .setCustomId(`cancel${noteId}`)
.setLabel('Cancel') .setLabel('Cancel')
.setStyle(Constants.MessageButtonStyles.SECONDARY), .setStyle(ButtonStyle.Secondary),
); );
// Sends the note to verify this note is to be deleted // Sends the note to verify this note is to be deleted
@ -367,7 +368,7 @@ class SusCommand extends Command {
}); });
} }
private async removeAllNotes(interaction: Command.ChatInputInteraction) { private async removeAllNotes(interaction: Command.ChatInputCommandInteraction) {
// Get the arguments // Get the arguments
const user = interaction.options.getUser('user'); const user = interaction.options.getUser('user');
const { guild, channel } = interaction; const { guild, channel } = interaction;
@ -409,7 +410,7 @@ class SusCommand extends Command {
} }
// Creates the embed to display the sus note // Creates the embed to display the sus note
const noteEmbed = new MessageEmbed() const noteEmbed = new EmbedBuilder()
.setColor('#ff0000') .setColor('#ff0000')
.setTitle(`Delete ${notes.length} sus notes for ${user.username}?`) .setTitle(`Delete ${notes.length} sus notes for ${user.username}?`)
.setThumbnail(user.avatarURL()!); .setThumbnail(user.avatarURL()!);
@ -430,16 +431,16 @@ class SusCommand extends Command {
} }
// Create buttons to delete or cancel the deletion // Create buttons to delete or cancel the deletion
const buttons = new MessageActionRow<MessageButton>() const buttons = new ActionRowBuilder<ButtonBuilder>()
.addComponents( .addComponents(
new MessageButton() new ButtonBuilder()
.setCustomId(`delete${user.id}`) .setCustomId(`delete${user.id}`)
.setLabel('Delete') .setLabel('Delete')
.setStyle(Constants.MessageButtonStyles.DANGER), .setStyle(ButtonStyle.Danger),
new MessageButton() new ButtonBuilder()
.setCustomId(`cancel${user.id}`) .setCustomId(`cancel${user.id}`)
.setLabel('Cancel') .setLabel('Cancel')
.setStyle(Constants.MessageButtonStyles.SECONDARY), .setStyle(ButtonStyle.Secondary),
); );
// Sends the note to verify this note is to be deleted // Sends the note to verify this note is to be deleted

View File

@ -54,7 +54,7 @@ class UnbanCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// Get the arguments // Get the arguments
const user = interaction.options.getUser('user'); const user = interaction.options.getUser('user');
const mod = interaction.member; const mod = interaction.member;

View File

@ -48,7 +48,7 @@ class ConvincedCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// TODO add database updates // TODO add database updates
// Get the arguments // Get the arguments
const user = interaction.options.getUser('user'); const user = interaction.options.getUser('user');

View File

@ -46,7 +46,7 @@ class StageHostCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// TODO add database updates // TODO add database updates
// Get the arguments // Get the arguments
const user = interaction.options.getUser('user'); const user = interaction.options.getUser('user');

View File

@ -46,7 +46,7 @@ class VegCuriousCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
// TODO add database updates // TODO add database updates
// Get the arguments // Get the arguments
const user = interaction.options.getUser('user'); const user = interaction.options.getUser('user');

View File

@ -37,7 +37,7 @@ class PingCommand extends Command {
} }
// Command run // Command run
public async chatInputRun(interaction: Command.ChatInputInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
const msg = await interaction.reply({ content: 'Ping?', ephemeral: true, fetchReply: true }); const msg = await interaction.reply({ content: 'Ping?', ephemeral: true, fetchReply: true });
if (isMessageInstance(msg)) { if (isMessageInstance(msg)) {

View File

@ -20,6 +20,7 @@
create this file. create this file.
*/ */
import { GatewayIntentBits } from 'discord.js';
import { LogLevel, SapphireClient } from '@sapphire/framework'; import { LogLevel, SapphireClient } from '@sapphire/framework';
import { ScheduledTaskRedisStrategy } from '@sapphire/plugin-scheduled-tasks/register-redis'; import { ScheduledTaskRedisStrategy } from '@sapphire/plugin-scheduled-tasks/register-redis';
@ -33,15 +34,15 @@ const client = new SapphireClient({
level: LogLevel.Debug, level: LogLevel.Debug,
}, },
intents: [ intents: [
'GUILDS', GatewayIntentBits.Guilds,
'GUILD_MEMBERS', GatewayIntentBits.GuildMembers,
'GUILD_BANS', GatewayIntentBits.GuildBans,
'GUILD_EMOJIS_AND_STICKERS', GatewayIntentBits.GuildEmojisAndStickers,
'GUILD_VOICE_STATES', GatewayIntentBits.GuildVoiceStates,
'GUILD_MESSAGES', GatewayIntentBits.GuildMessages,
'GUILD_MESSAGE_REACTIONS', GatewayIntentBits.GuildMessageReactions,
'DIRECT_MESSAGES', GatewayIntentBits.DirectMessages,
'DIRECT_MESSAGE_REACTIONS', GatewayIntentBits.DirectMessageReactions,
], ],
tasks: { tasks: {
// Scheduler with redis // Scheduler with redis

View File

@ -29,13 +29,15 @@ import type {
User, User,
} from 'discord.js'; } from 'discord.js';
import { import {
time,
ChannelType,
PermissionsBitField,
ButtonBuilder,
ButtonInteraction, ButtonInteraction,
Constants, ButtonStyle,
MessageActionRow, ActionRowBuilder,
MessageButton, EmbedBuilder,
MessageEmbed,
} from 'discord.js'; } from 'discord.js';
import { time } from '@discordjs/builders';
import { maxVCs, questionInfo, serverFind } from '../../utils/verificationConfig'; import { maxVCs, questionInfo, serverFind } from '../../utils/verificationConfig';
import { joinVerification, startVerification, finishVerification } from '../../utils/database/verification'; import { joinVerification, startVerification, finishVerification } from '../../utils/database/verification';
import { findNotes } from '../../utils/database/sus'; import { findNotes } from '../../utils/database/sus';
@ -88,7 +90,7 @@ class VerificationJoinVCListener extends Listener {
// Check if a verifier joined a verification VC and update database // Check if a verifier joined a verification VC and update database
if (channel.members.size === 2) { if (channel.members.size === 2) {
await channel.permissionOverwrites.edit(guild.roles.everyone, { await channel.permissionOverwrites.edit(guild.roles.everyone, {
SEND_MESSAGES: true, SendMessages: true,
}); });
if (!channel.name.includes(' - Verification')) { if (!channel.name.includes(' - Verification')) {
@ -134,7 +136,7 @@ class VerificationJoinVCListener extends Listener {
} }
// Check how many voice channels there are // Check how many voice channels there are
const listVoiceChannels = category.children.filter((c) => c.type === 'GUILD_VOICE'); const listVoiceChannels = category.children.cache.filter((c) => c.type === ChannelType.GuildVoice);
// Create a text channel for verifiers only // Create a text channel for verifiers only
// Checks if there are more than 10 voice channels // Checks if there are more than 10 voice channels
@ -144,52 +146,62 @@ class VerificationJoinVCListener extends Listener {
let verificationText: TextChannel; let verificationText: TextChannel;
let bannedName = false; let bannedName = false;
try { try {
verificationText = await guild.channels.create(`✅┃${member.displayName}-verification`, { verificationText = await guild.channels.create({
type: 'GUILD_TEXT', name: `✅┃${member.displayName}-verification`,
type: ChannelType.GuildText,
topic: `Channel for verifiers only. ${member.id} ${channel.id} (Please do not change this)`, topic: `Channel for verifiers only. ${member.id} ${channel.id} (Please do not change this)`,
parent: category.id, parent: category.id,
userLimit: 1, userLimit: 1,
permissionOverwrites: [ permissionOverwrites: [
{ {
id: guild.roles.everyone, id: guild.roles.everyone,
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL'], deny: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.verifyBlock, id: IDs.roles.verifyBlock,
deny: ['VIEW_CHANNEL', 'SEND_MESSAGES'], deny: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.staff.verifier, id: IDs.roles.staff.verifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.staff.trialVerifier, id: IDs.roles.staff.trialVerifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel],
}, },
], ],
}); });
} catch { } catch {
verificationText = await guild.channels.create(`✅┃${member.id}-verification`, { verificationText = await guild.channels.create({
type: 'GUILD_TEXT', name: `✅┃${member.displayName}-verification`,
type: ChannelType.GuildText,
topic: `Channel for verifiers only. ${member.id} ${channel.id} (Please do not change this)`, topic: `Channel for verifiers only. ${member.id} ${channel.id} (Please do not change this)`,
parent: category.id, parent: category.id,
userLimit: 1, userLimit: 1,
permissionOverwrites: [ permissionOverwrites: [
{ {
id: guild.roles.everyone, id: guild.roles.everyone,
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL'], deny: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.verifyBlock, id: IDs.roles.verifyBlock,
deny: ['VIEW_CHANNEL', 'SEND_MESSAGES'], deny: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.staff.verifier, id: IDs.roles.staff.verifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.staff.trialVerifier, id: IDs.roles.staff.trialVerifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel],
}, },
], ],
}); });
@ -218,76 +230,99 @@ class VerificationJoinVCListener extends Listener {
// Checks if there are more than 10 voice channels // Checks if there are more than 10 voice channels
if (listVoiceChannels.size > maxVCs - 1) { if (listVoiceChannels.size > maxVCs - 1) {
await guild.channels.create('Verification', { await guild.channels.create({
type: 'GUILD_VOICE', name: 'Verification',
type: ChannelType.GuildVoice,
parent: category.id, parent: category.id,
userLimit: 1, userLimit: 1,
permissionOverwrites: [ permissionOverwrites: [
{ {
id: guild.roles.everyone, id: guild.roles.everyone,
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'STREAM'], deny: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Stream],
}, },
{ {
id: IDs.roles.verifyBlock, id: IDs.roles.verifyBlock,
deny: ['VIEW_CHANNEL', 'CONNECT', 'SEND_MESSAGES'], deny: [PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.SendMessages],
}, },
{ {
id: IDs.roles.nonvegan.nonvegan, id: IDs.roles.nonvegan.nonvegan,
allow: ['VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.ViewChannel],
deny: ['CONNECT'], deny: [PermissionsBitField.Flags.Connect],
}, },
{ {
id: IDs.roles.vegan.vegan, id: IDs.roles.vegan.vegan,
allow: ['VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.ViewChannel],
deny: ['CONNECT'], deny: [PermissionsBitField.Flags.Connect],
}, },
{ {
id: IDs.roles.vegan.activist, id: IDs.roles.vegan.activist,
deny: ['VIEW_CHANNEL', 'CONNECT'], deny: [PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect],
}, },
{ {
id: IDs.roles.staff.verifier, id: IDs.roles.staff.verifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.MuteMembers],
}, },
{ {
id: IDs.roles.staff.trialVerifier, id: IDs.roles.staff.trialVerifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.MuteMembers],
}, },
], ],
}); });
} else { } else {
await guild.channels.create('Verification', { await guild.channels.create({
type: 'GUILD_VOICE', name: 'Verification',
type: ChannelType.GuildVoice,
parent: category.id, parent: category.id,
userLimit: 1, userLimit: 1,
permissionOverwrites: [ permissionOverwrites: [
{ {
id: guild.roles.everyone, id: guild.roles.everyone,
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'STREAM'], deny: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.SendMessages],
}, },
{ {
id: IDs.roles.verifyBlock, id: IDs.roles.verifyBlock,
deny: ['VIEW_CHANNEL', 'CONNECT', 'SEND_MESSAGES'], deny: [PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.SendMessages],
}, },
{ {
id: IDs.roles.nonvegan.nonvegan, id: IDs.roles.nonvegan.nonvegan,
allow: ['VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.vegan.vegan, id: IDs.roles.vegan.vegan,
allow: ['VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.vegan.activist, id: IDs.roles.vegan.activist,
deny: ['VIEW_CHANNEL', 'CONNECT'], deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect],
}, },
{ {
id: IDs.roles.staff.verifier, id: IDs.roles.staff.verifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.MuteMembers],
}, },
{ {
id: IDs.roles.staff.trialVerifier, id: IDs.roles.staff.trialVerifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.MuteMembers],
}, },
], ],
}); });
@ -297,23 +332,33 @@ class VerificationJoinVCListener extends Listener {
await currentChannel.permissionOverwrites.set([ await currentChannel.permissionOverwrites.set([
{ {
id: guild.roles.everyone, id: guild.roles.everyone,
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'STREAM'], deny: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Stream],
}, },
{ {
id: IDs.roles.verifyBlock, id: IDs.roles.verifyBlock,
deny: ['VIEW_CHANNEL', 'CONNECT', 'SEND_MESSAGES'], deny: [PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.SendMessages],
}, },
{ {
id: IDs.roles.staff.verifier, id: IDs.roles.staff.verifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.MuteMembers],
}, },
{ {
id: IDs.roles.staff.trialVerifier, id: IDs.roles.staff.trialVerifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.MuteMembers],
}, },
{ {
id: member.id, id: member.id,
allow: ['VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.ViewChannel],
}, },
]); ]);
await currentChannel.setUserLimit(0); await currentChannel.setUserLimit(0);
@ -324,7 +369,7 @@ class VerificationJoinVCListener extends Listener {
const joinTime = time(user.joinedAt!); const joinTime = time(user.joinedAt!);
const registerTime = time(user.user.createdAt); const registerTime = time(user.user.createdAt);
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setColor(user.displayHexColor) .setColor(user.displayHexColor)
.setTitle(`Information on ${user.user.username}`) .setTitle(`Information on ${user.user.username}`)
.setThumbnail(user.user.avatarURL()!) .setThumbnail(user.user.avatarURL()!)
@ -341,7 +386,7 @@ class VerificationJoinVCListener extends Listener {
private async getSus(user: GuildMember, guild: Guild) { private async getSus(user: GuildMember, guild: Guild) {
const notes = await findNotes(user.id, true); const notes = await findNotes(user.id, true);
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setColor(user.displayHexColor) .setColor(user.displayHexColor)
.setTitle(`${notes.length} sus notes for ${user.user.username}`); .setTitle(`${notes.length} sus notes for ${user.user.username}`);
@ -501,7 +546,7 @@ class VerificationJoinVCListener extends Listener {
// Confirmation to give roles to the user being verified // Confirmation to give roles to the user being verified
if (info.page === questionLength) { if (info.page === questionLength) {
// Create embed with all the roles the user has // Create embed with all the roles the user has
embed = new MessageEmbed() embed = new EmbedBuilder()
.setColor(embedColor) .setColor(embedColor)
.setTitle(`Give these roles to ${user.displayName}?`) .setTitle(`Give these roles to ${user.displayName}?`)
.setThumbnail(user.avatarURL()!) .setThumbnail(user.avatarURL()!)
@ -510,16 +555,16 @@ class VerificationJoinVCListener extends Listener {
); );
// Create buttons for input // Create buttons for input
buttons = [new MessageActionRow<MessageButton>() buttons = [new ActionRowBuilder<ButtonBuilder>()
.addComponents( .addComponents(
new MessageButton() new ButtonBuilder()
.setCustomId('confirm') .setCustomId('confirm')
.setLabel('Yes') .setLabel('Yes')
.setStyle(Constants.MessageButtonStyles.SUCCESS), .setStyle(ButtonStyle.Success),
new MessageButton() new ButtonBuilder()
.setCustomId('cancel') .setCustomId('cancel')
.setLabel('No') .setLabel('No')
.setStyle(Constants.MessageButtonStyles.DANGER), .setStyle(ButtonStyle.Danger),
)]; )];
await message.edit({ await message.edit({
embeds: [embed], embeds: [embed],
@ -553,7 +598,7 @@ class VerificationJoinVCListener extends Listener {
}, (info.roles.vegan || info.roles.convinced) ? 604800000 : 1814400000); }, (info.roles.vegan || info.roles.convinced) ? 604800000 : 1814400000);
} }
// Add embed saying verification completed // Add embed saying verification completed
embed = new MessageEmbed() embed = new EmbedBuilder()
.setColor('#34c000') .setColor('#34c000')
.setTitle(`Successfully verified ${user.displayName}!`) .setTitle(`Successfully verified ${user.displayName}!`)
.setThumbnail(user.user.avatarURL()!) .setThumbnail(user.user.avatarURL()!)
@ -586,7 +631,7 @@ class VerificationJoinVCListener extends Listener {
} }
private async createEmbed(title: string, color: ColorResolvable) { private async createEmbed(title: string, color: ColorResolvable) {
return new MessageEmbed() return new EmbedBuilder()
.setColor(color) .setColor(color)
.setTitle(title); .setTitle(title);
} }
@ -597,14 +642,14 @@ class VerificationJoinVCListener extends Listener {
for (let i = 0; i < buttons.length; i += 1) { for (let i = 0; i < buttons.length; i += 1) {
// Check if it exceeds the maximum buttons in a ActionRow // Check if it exceeds the maximum buttons in a ActionRow
if (i % 5 === 0) { if (i % 5 === 0) {
buttonActions.push(new MessageActionRow<MessageButton>()); buttonActions.push(new ActionRowBuilder<ButtonBuilder>());
} }
buttonActions[Math.floor(i / 5)] buttonActions[Math.floor(i / 5)]
.addComponents( .addComponents(
new MessageButton() new ButtonBuilder()
.setCustomId(`button${i}`) .setCustomId(`button${i}`)
.setLabel(buttons[i]) .setLabel(buttons[i])
.setStyle(Constants.MessageButtonStyles.SECONDARY), .setStyle(ButtonStyle.Secondary),
); );
} }

View File

@ -21,7 +21,7 @@ import { Listener } from '@sapphire/framework';
import type { import type {
VoiceState, CategoryChannel, VoiceChannel, TextChannel, VoiceState, CategoryChannel, VoiceChannel, TextChannel,
} from 'discord.js'; } from 'discord.js';
import { time } from '@discordjs/builders'; import {time, ChannelType, PermissionsBitField} from 'discord.js';
import { maxVCs, leaveBan } from '../../utils/verificationConfig'; import { maxVCs, leaveBan } from '../../utils/verificationConfig';
import { getUser, checkFinish, countIncomplete } from '../../utils/database/verification'; import { getUser, checkFinish, countIncomplete } from '../../utils/database/verification';
import { fetchRoles } from '../../utils/database/dbExistingUser'; import { fetchRoles } from '../../utils/database/dbExistingUser';
@ -101,7 +101,7 @@ class VerificationLeaveVCListener extends Listener {
} }
// Check how many voice channels there are // Check how many voice channels there are
const listVoiceChannels = category.children.filter((c) => c.type === 'GUILD_VOICE'); const listVoiceChannels = category.children.cache.filter((c) => c.type === ChannelType.GuildVoice);
// Check that it is not deleting the 'Verification' channel (in case bot crashes) // Check that it is not deleting the 'Verification' channel (in case bot crashes)
if (channel.name !== 'Verification') { if (channel.name !== 'Verification') {
@ -112,7 +112,7 @@ class VerificationLeaveVCListener extends Listener {
// Delete text channel // Delete text channel
if (!verifier) { if (!verifier) {
// Gets a list of all the text channels in the verification category // Gets a list of all the text channels in the verification category
const listTextChannels = category.children.filter((c) => c.type === 'GUILD_TEXT'); const listTextChannels = category.children.cache.filter((c) => c.type === ChannelType.GuildText);
listTextChannels.forEach((c) => { listTextChannels.forEach((c) => {
const textChannel = c as TextChannel; const textChannel = c as TextChannel;
// Checks if the channel topic has the user's snowflake // Checks if the channel topic has the user's snowflake
@ -125,38 +125,49 @@ class VerificationLeaveVCListener extends Listener {
// If there are no VCs left in verification after having the channel deleted // If there are no VCs left in verification after having the channel deleted
if (listVoiceChannels.size - 1 === 0) { if (listVoiceChannels.size - 1 === 0) {
// Create a verification channel // Create a verification channel
await guild.channels.create('Verification', { await guild.channels.create({
type: 'GUILD_VOICE', name: 'Verification',
parent: IDs.categories.verification, type: ChannelType.GuildVoice,
parent: category.id,
userLimit: 1, userLimit: 1,
permissionOverwrites: [ permissionOverwrites: [
{ {
id: guild.roles.everyone, id: guild.roles.everyone,
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'STREAM'], deny: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.SendMessages],
}, },
{ {
id: IDs.roles.verifyBlock, id: IDs.roles.verifyBlock,
deny: ['VIEW_CHANNEL', 'CONNECT', 'SEND_MESSAGES'], deny: [PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.SendMessages],
}, },
{ {
id: IDs.roles.nonvegan.nonvegan, id: IDs.roles.nonvegan.nonvegan,
allow: ['VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.vegan.vegan, id: IDs.roles.vegan.vegan,
allow: ['VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.vegan.activist, id: IDs.roles.vegan.activist,
deny: ['VIEW_CHANNEL', 'CONNECT'], deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect],
}, },
{ {
id: IDs.roles.staff.verifier, id: IDs.roles.staff.verifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.MuteMembers],
}, },
{ {
id: IDs.roles.staff.trialVerifier, id: IDs.roles.staff.trialVerifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.MuteMembers],
}, },
], ],
}); });
@ -175,10 +186,10 @@ class VerificationLeaveVCListener extends Listener {
} }
await verification.permissionOverwrites.edit(IDs.roles.nonvegan.nonvegan, { await verification.permissionOverwrites.edit(IDs.roles.nonvegan.nonvegan, {
VIEW_CHANNEL: true, ViewChannel: true,
}); });
await verification.permissionOverwrites.edit(IDs.roles.vegan.vegan, { await verification.permissionOverwrites.edit(IDs.roles.vegan.vegan, {
VIEW_CHANNEL: true, ViewChannel: true,
}); });
} }
} }

View File

@ -24,6 +24,7 @@ import type {
TextChannel, TextChannel,
VoiceChannel, VoiceChannel,
} from 'discord.js'; } from 'discord.js';
import { ChannelType, PermissionsBitField } from 'discord.js';
import IDs from '../../utils/ids'; import IDs from '../../utils/ids';
class VerificationReady extends Listener { class VerificationReady extends Listener {
@ -47,7 +48,7 @@ class VerificationReady extends Listener {
} }
// Check how many voice channels there are // Check how many voice channels there are
const voiceChannels = category.children.filter((c) => c.type === 'GUILD_VOICE'); const voiceChannels = category.children.cache.filter((c) => c.type === ChannelType.GuildVoice);
const currentVCs: VoiceChannel[] = []; const currentVCs: VoiceChannel[] = [];
const emptyVC: string[] = []; const emptyVC: string[] = [];
// Delete voice channels // Delete voice channels
@ -62,7 +63,7 @@ class VerificationReady extends Listener {
}); });
// Delete text channels // Delete text channels
const textChannels = category.children.filter((c) => c.type === 'GUILD_TEXT'); const textChannels = category.children.cache.filter((c) => c.type === ChannelType.GuildText);
textChannels.forEach((c) => { textChannels.forEach((c) => {
const textChannel = c as TextChannel; const textChannel = c as TextChannel;
// Checks if the channel topic has the user's snowflake // Checks if the channel topic has the user's snowflake
@ -81,38 +82,49 @@ class VerificationReady extends Listener {
} }
}); });
if (!verification) { if (!verification) {
await category.guild.channels.create('Verification', { await category.guild.channels.create({
type: 'GUILD_VOICE', name: 'Verification',
parent: IDs.categories.verification, type: ChannelType.GuildVoice,
parent: category.id,
userLimit: 1, userLimit: 1,
permissionOverwrites: [ permissionOverwrites: [
{ {
id: category.guild.roles.everyone, id: category.guild.roles.everyone,
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'STREAM'], deny: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.SendMessages],
}, },
{ {
id: IDs.roles.verifyBlock, id: IDs.roles.verifyBlock,
deny: ['VIEW_CHANNEL', 'CONNECT', 'SEND_MESSAGES'], deny: [PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.SendMessages],
}, },
{ {
id: IDs.roles.nonvegan.nonvegan, id: IDs.roles.nonvegan.nonvegan,
allow: ['VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.vegan.vegan, id: IDs.roles.vegan.vegan,
allow: ['VIEW_CHANNEL'], allow: [PermissionsBitField.Flags.ViewChannel],
}, },
{ {
id: IDs.roles.vegan.activist, id: IDs.roles.vegan.activist,
deny: ['VIEW_CHANNEL', 'CONNECT'], deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect],
}, },
{ {
id: IDs.roles.staff.verifier, id: IDs.roles.staff.verifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.MuteMembers],
}, },
{ {
id: IDs.roles.staff.trialVerifier, id: IDs.roles.staff.trialVerifier,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'], allow: [PermissionsBitField.Flags.SendMessages,
PermissionsBitField.Flags.ViewChannel,
PermissionsBitField.Flags.Connect,
PermissionsBitField.Flags.MuteMembers],
}, },
], ],
}); });

View File

@ -18,7 +18,7 @@
*/ */
import { Listener } from '@sapphire/framework'; import { Listener } from '@sapphire/framework';
import { Constants, MessageActionRow, MessageButton } from 'discord.js'; import { ButtonStyle, ActionRowBuilder, ButtonBuilder } from 'discord.js';
import type { import type {
Client, Client,
@ -56,12 +56,12 @@ class VerificationReady extends Listener {
+ 'You\'ll chat with one of our verifiers who will just ask you a few questions before approving your Vegan role. ' + 'You\'ll chat with one of our verifiers who will just ask you a few questions before approving your Vegan role. '
+ 'Vegans have access to more channels. Voice discussions may be recorded.'; + 'Vegans have access to more channels. Voice discussions may be recorded.';
const button = new MessageActionRow<MessageButton>() const button = new ActionRowBuilder<ButtonBuilder>()
.addComponents( .addComponents(
new MessageButton() new ButtonBuilder()
.setCustomId('welcomeJoin') .setCustomId('welcomeJoin')
.setLabel('Join') .setLabel('Join')
.setStyle(Constants.MessageButtonStyles.SUCCESS), .setStyle(ButtonStyle.Success),
); );
if (message?.author.id !== botId) { if (message?.author.id !== botId) {

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class CoordinatorOnlyPrecondition extends AllFlowsPrecondition {
return this.checkCoordinator(interaction.member! as GuildMember); return this.checkCoordinator(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkCoordinator(interaction.member! as GuildMember); return this.checkCoordinator(interaction.member! as GuildMember);
} }

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class DevCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
return this.checkDevCoordinator(interaction.member! as GuildMember); return this.checkDevCoordinator(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkDevCoordinator(interaction.member! as GuildMember); return this.checkDevCoordinator(interaction.member! as GuildMember);
} }

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class DiversityCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
return this.checkDiversityCoordinator(interaction.member! as GuildMember); return this.checkDiversityCoordinator(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkDiversityCoordinator(interaction.member! as GuildMember); return this.checkDiversityCoordinator(interaction.member! as GuildMember);
} }

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class EventCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
return this.checkEventCoordinator(interaction.member! as GuildMember); return this.checkEventCoordinator(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkEventCoordinator(interaction.member! as GuildMember); return this.checkEventCoordinator(interaction.member! as GuildMember);
} }

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class MentorCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
return this.checkMentorCoordinator(interaction.member! as GuildMember); return this.checkMentorCoordinator(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkMentorCoordinator(interaction.member! as GuildMember); return this.checkMentorCoordinator(interaction.member! as GuildMember);
} }

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class MentorOnlyPrecondition extends AllFlowsPrecondition {
return this.checkMentor(interaction.member! as GuildMember); return this.checkMentor(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkMentor(interaction.member! as GuildMember); return this.checkMentor(interaction.member! as GuildMember);
} }

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class ModOnlyPrecondition extends AllFlowsPrecondition {
return this.checkMod(interaction.member! as GuildMember); return this.checkMod(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkMod(interaction.member! as GuildMember); return this.checkMod(interaction.member! as GuildMember);
} }

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class PatreonOnlyPrecondition extends AllFlowsPrecondition {
return this.checkPatreon(interaction.member! as GuildMember); return this.checkPatreon(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkPatreon(interaction.member! as GuildMember); return this.checkPatreon(interaction.member! as GuildMember);
} }

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class RestrictedAccessOnlyPrecondition extends AllFlowsPrecondition {
return this.checkRestrictedAccess(interaction.member! as GuildMember); return this.checkRestrictedAccess(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkRestrictedAccess(interaction.member! as GuildMember); return this.checkRestrictedAccess(interaction.member! as GuildMember);
} }

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class VerifierCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
return this.checkVerifierCoordinator(interaction.member! as GuildMember); return this.checkVerifierCoordinator(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkVerifierCoordinator(interaction.member! as GuildMember); return this.checkVerifierCoordinator(interaction.member! as GuildMember);
} }

View File

@ -20,7 +20,7 @@
import { AllFlowsPrecondition } from '@sapphire/framework'; import { AllFlowsPrecondition } from '@sapphire/framework';
import type { import type {
CommandInteraction, CommandInteraction,
ContextMenuInteraction, ContextMenuCommandInteraction,
Message, Message,
GuildMember, GuildMember,
} from 'discord.js'; } from 'discord.js';
@ -37,7 +37,7 @@ class VerifierOnlyPrecondition extends AllFlowsPrecondition {
return this.checkVerifier(interaction.member! as GuildMember); return this.checkVerifier(interaction.member! as GuildMember);
} }
public override async contextMenuRun(interaction: ContextMenuInteraction) { public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
// for context menu command // for context menu command
return this.checkVerifier(interaction.member! as GuildMember); return this.checkVerifier(interaction.member! as GuildMember);
} }