mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-19 01:04:13 +02:00
upgrade(arabot): upgrade sapphire to v4
This commit is contained in:
parent
f6b321e454
commit
e5dfa51cc9
1583
package-lock.json
generated
1583
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -26,18 +26,16 @@
|
||||
},
|
||||
"homepage": "https://github.com/veganhacktivists/arabot#readme",
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^1.3.0",
|
||||
"@prisma/client": "^4.0.0",
|
||||
"@sapphire/discord.js-utilities": "^5.0.0",
|
||||
"@sapphire/framework": "^3.1.3",
|
||||
"@sapphire/discord.js-utilities": "^6.0.0",
|
||||
"@sapphire/framework": "^4.0.1",
|
||||
"@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/utilities": "^3.9.2",
|
||||
"@types/node": "^18.0.3",
|
||||
"bullmq": "^1.89.1",
|
||||
"discord-api-types": "^0.33.3",
|
||||
"discord.js": "^13.12.0",
|
||||
"discord.js": "^14.7.1",
|
||||
"dotenv": "^16.0.1",
|
||||
"ts-node": "^10.8.2",
|
||||
"typescript": "^4.7.4"
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { N1984 } from '../../utils/gifs';
|
||||
|
||||
class N1984Command extends Command {
|
||||
@ -44,7 +44,7 @@ class N1984Command extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Get the user
|
||||
// TODO exception handling
|
||||
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
|
||||
const random1984 = Math.random() < 0.001 ? 'https://c.tenor.com/0BwU0BjWYX4AAAAC/arthuria-dantas.gif'
|
||||
: N1984[Math.floor(Math.random() * N1984.length)];
|
||||
const n1984Embed = new MessageEmbed()
|
||||
const n1984Embed = new EmbedBuilder()
|
||||
.setColor('#ffffff')
|
||||
.setTitle(`${memberGuildMember.displayName} is happy!`)
|
||||
.setImage(random1984);
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { Happy } from '../../utils/gifs';
|
||||
|
||||
class HappyCommand extends Command {
|
||||
@ -44,7 +44,7 @@ class HappyCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Get the user
|
||||
// TODO exception handling
|
||||
const member = interaction.member!.user;
|
||||
@ -52,7 +52,7 @@ class HappyCommand extends Command {
|
||||
|
||||
// Creates the embed for the happy reaction
|
||||
const randomHappy = Happy[Math.floor(Math.random() * Happy.length)];
|
||||
const happyEmbed = new MessageEmbed()
|
||||
const happyEmbed = new EmbedBuilder()
|
||||
.setColor('#40ff00')
|
||||
.setTitle(`${memberGuildMember.displayName} is happy!`)
|
||||
.setImage(randomHappy);
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { Hugs } from '../../utils/gifs';
|
||||
|
||||
class HugCommand extends Command {
|
||||
@ -46,7 +46,7 @@ class HugCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Get the users
|
||||
// TODO exception handling
|
||||
const user = interaction.options.getUser('user')!;
|
||||
@ -55,7 +55,7 @@ class HugCommand extends Command {
|
||||
|
||||
// Creates the embed for the hug
|
||||
const randomHug = Hugs[Math.floor(Math.random() * Hugs.length)];
|
||||
const hugEmbed = new MessageEmbed()
|
||||
const hugEmbed = new EmbedBuilder()
|
||||
.setColor('#0099ff')
|
||||
.setTitle(`Hug from ${huggerGuildMember.displayName}`)
|
||||
.setImage(randomHug);
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { Kill } from '../../utils/gifs';
|
||||
|
||||
class KillCommand extends Command {
|
||||
@ -46,7 +46,7 @@ class KillCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Get the users
|
||||
// TODO exception handling
|
||||
const user = interaction.options.getUser('user')!;
|
||||
@ -55,7 +55,7 @@ class KillCommand extends Command {
|
||||
|
||||
// Creates the embed for the kill
|
||||
const randomKill = Kill[Math.floor(Math.random() * Kill.length)];
|
||||
const killEmbed = new MessageEmbed()
|
||||
const killEmbed = new EmbedBuilder()
|
||||
.setColor('#ff0000')
|
||||
.setTitle(`Kill from ${killerGuildMember.displayName}`)
|
||||
.setImage(randomKill);
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { Poke } from '../../utils/gifs';
|
||||
|
||||
class PokeCommand extends Command {
|
||||
@ -47,7 +47,7 @@ class PokeCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Get the users
|
||||
// TODO exception handling
|
||||
const user = interaction.options.getUser('user')!;
|
||||
@ -56,7 +56,7 @@ class PokeCommand extends Command {
|
||||
|
||||
// Creates the embed for the poke
|
||||
const randomPoke = Poke[Math.floor(Math.random() * Poke.length)];
|
||||
const pokeEmbed = new MessageEmbed()
|
||||
const pokeEmbed = new EmbedBuilder()
|
||||
.setColor('#0099ff')
|
||||
.setTitle(`Poke from ${pokerGuildMember.displayName}`)
|
||||
.setImage(randomPoke);
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { Sad } from '../../utils/gifs';
|
||||
|
||||
class SadCommand extends Command {
|
||||
@ -44,7 +44,7 @@ class SadCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Get the user
|
||||
// TODO exception handling
|
||||
const member = interaction.member!.user;
|
||||
@ -52,7 +52,7 @@ class SadCommand extends Command {
|
||||
|
||||
// Creates the embed for the sad reaction
|
||||
const randomSad = Sad[Math.floor(Math.random() * Sad.length)];
|
||||
const sadEmbed = new MessageEmbed()
|
||||
const sadEmbed = new EmbedBuilder()
|
||||
.setColor('#001148')
|
||||
.setTitle(`${memberGuildMember.displayName} is sad...`)
|
||||
.setImage(randomSad);
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { Shrug } from '../../utils/gifs';
|
||||
|
||||
class ShrugCommand extends Command {
|
||||
@ -44,7 +44,7 @@ class ShrugCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Get the user
|
||||
// TODO exception handling
|
||||
const member = interaction.member!.user;
|
||||
@ -52,7 +52,7 @@ class ShrugCommand extends Command {
|
||||
|
||||
// Creates the embed for the shrug reaction
|
||||
const randomShrug = Shrug[Math.floor(Math.random() * Shrug.length)];
|
||||
const shrugEmbed = new MessageEmbed()
|
||||
const shrugEmbed = new EmbedBuilder()
|
||||
.setColor('#001980')
|
||||
.setTitle(`${memberGuildMember.displayName} shrugs`)
|
||||
.setImage(randomShrug);
|
||||
|
@ -52,7 +52,7 @@ class BanCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Get the arguments
|
||||
const user = interaction.options.getUser('user');
|
||||
const reason = interaction.options.getString('reason');
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { ChannelType, PermissionsBitField } from 'discord.js';
|
||||
import type { TextChannel } from 'discord.js';
|
||||
import IDs from '../../utils/ids';
|
||||
|
||||
@ -46,7 +47,7 @@ class ToggleOpenCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
const subcommand = interaction.options.getSubcommand(true);
|
||||
|
||||
// Checks what subcommand was run
|
||||
@ -67,7 +68,7 @@ class ToggleOpenCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async toggleOpen(interaction: Command.ChatInputInteraction) {
|
||||
public async toggleOpen(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Check if guild is not null
|
||||
if (interaction.guild === null) {
|
||||
await interaction.reply({
|
||||
@ -91,7 +92,7 @@ class ToggleOpenCommand extends Command {
|
||||
}
|
||||
|
||||
// Check if channel is text
|
||||
if (!channel.isText()) {
|
||||
if (channel.type !== ChannelType.GuildText) {
|
||||
await interaction.reply({
|
||||
content: 'Channel is not a text channel!',
|
||||
ephemeral: true,
|
||||
@ -114,10 +115,10 @@ class ToggleOpenCommand extends Command {
|
||||
}
|
||||
|
||||
// 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
|
||||
await channelText.permissionOverwrites.edit(IDs.roles.vegan.vegan, { SEND_MESSAGES: !open });
|
||||
await channelText.permissionOverwrites.edit(IDs.roles.vegan.vegan, { SendMessages: !open });
|
||||
|
||||
await interaction.reply({
|
||||
content: `${!open ? 'Opened' : 'Closed'} this channel.`,
|
||||
|
@ -19,11 +19,12 @@
|
||||
|
||||
import { Command, RegisterBehavior, Args } from '@sapphire/framework';
|
||||
import {
|
||||
MessageEmbed,
|
||||
MessageActionRow,
|
||||
MessageButton,
|
||||
Constants,
|
||||
ChannelType,
|
||||
EmbedBuilder,
|
||||
ActionRowBuilder,
|
||||
ButtonBuilder,
|
||||
ButtonInteraction,
|
||||
ButtonStyle,
|
||||
} from 'discord.js';
|
||||
import type { Message, GuildMember, TextChannel } from 'discord.js';
|
||||
import { isMessageInstance } from '@sapphire/discord.js-utilities';
|
||||
@ -89,7 +90,7 @@ class SusCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
const subcommand = interaction.options.getSubcommand(true);
|
||||
|
||||
// Checks what subcommand was run
|
||||
@ -122,7 +123,7 @@ class SusCommand extends Command {
|
||||
}
|
||||
|
||||
// Subcommand to add sus note
|
||||
private async addNote(interaction: Command.ChatInputInteraction) {
|
||||
private async addNote(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Get the arguments
|
||||
const user = interaction.options.getUser('user');
|
||||
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
|
||||
const user = interaction.options.getUser('user');
|
||||
const { guild } = interaction;
|
||||
@ -194,7 +195,7 @@ class SusCommand extends Command {
|
||||
let staffChannel = false;
|
||||
let { channel } = interaction;
|
||||
if (channel !== null) {
|
||||
if (channel.type === 'GUILD_TEXT') {
|
||||
if (channel.type === ChannelType.GuildText) {
|
||||
channel = channel as TextChannel;
|
||||
staffChannel = checkStaff(channel);
|
||||
}
|
||||
@ -214,7 +215,7 @@ class SusCommand extends Command {
|
||||
}
|
||||
|
||||
// Creates the embed to display the sus note
|
||||
const noteEmbed = new MessageEmbed()
|
||||
const noteEmbed = new EmbedBuilder()
|
||||
.setColor('#0099ff')
|
||||
.setTitle(`${notes.length} sus notes for ${user.username}`)
|
||||
.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
|
||||
const noteId = interaction.options.getInteger('id');
|
||||
const { guild, channel } = interaction;
|
||||
@ -297,7 +298,7 @@ class SusCommand extends Command {
|
||||
}
|
||||
|
||||
// Create an embed for the note
|
||||
const noteEmbed = new MessageEmbed()
|
||||
const noteEmbed = new EmbedBuilder()
|
||||
.setColor('#ff0000')
|
||||
.setTitle(`Sus note for ${userName}`)
|
||||
.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
|
||||
const buttons = new MessageActionRow<MessageButton>()
|
||||
const buttons = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`delete${noteId}`)
|
||||
.setLabel('Delete')
|
||||
.setStyle(Constants.MessageButtonStyles.DANGER),
|
||||
new MessageButton()
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`cancel${noteId}`)
|
||||
.setLabel('Cancel')
|
||||
.setStyle(Constants.MessageButtonStyles.SECONDARY),
|
||||
.setStyle(ButtonStyle.Secondary),
|
||||
);
|
||||
|
||||
// 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
|
||||
const user = interaction.options.getUser('user');
|
||||
const { guild, channel } = interaction;
|
||||
@ -409,7 +410,7 @@ class SusCommand extends Command {
|
||||
}
|
||||
|
||||
// Creates the embed to display the sus note
|
||||
const noteEmbed = new MessageEmbed()
|
||||
const noteEmbed = new EmbedBuilder()
|
||||
.setColor('#ff0000')
|
||||
.setTitle(`Delete ${notes.length} sus notes for ${user.username}?`)
|
||||
.setThumbnail(user.avatarURL()!);
|
||||
@ -430,16 +431,16 @@ class SusCommand extends Command {
|
||||
}
|
||||
|
||||
// Create buttons to delete or cancel the deletion
|
||||
const buttons = new MessageActionRow<MessageButton>()
|
||||
const buttons = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`delete${user.id}`)
|
||||
.setLabel('Delete')
|
||||
.setStyle(Constants.MessageButtonStyles.DANGER),
|
||||
new MessageButton()
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`cancel${user.id}`)
|
||||
.setLabel('Cancel')
|
||||
.setStyle(Constants.MessageButtonStyles.SECONDARY),
|
||||
.setStyle(ButtonStyle.Secondary),
|
||||
);
|
||||
|
||||
// Sends the note to verify this note is to be deleted
|
||||
|
@ -54,7 +54,7 @@ class UnbanCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// Get the arguments
|
||||
const user = interaction.options.getUser('user');
|
||||
const mod = interaction.member;
|
||||
|
@ -48,7 +48,7 @@ class ConvincedCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// TODO add database updates
|
||||
// Get the arguments
|
||||
const user = interaction.options.getUser('user');
|
||||
|
@ -46,7 +46,7 @@ class StageHostCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// TODO add database updates
|
||||
// Get the arguments
|
||||
const user = interaction.options.getUser('user');
|
||||
|
@ -46,7 +46,7 @@ class VegCuriousCommand extends Command {
|
||||
}
|
||||
|
||||
// Command run
|
||||
public async chatInputRun(interaction: Command.ChatInputInteraction) {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
// TODO add database updates
|
||||
// Get the arguments
|
||||
const user = interaction.options.getUser('user');
|
||||
|
@ -37,7 +37,7 @@ class PingCommand extends Command {
|
||||
}
|
||||
|
||||
// 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 });
|
||||
|
||||
if (isMessageInstance(msg)) {
|
||||
|
19
src/index.ts
19
src/index.ts
@ -20,6 +20,7 @@
|
||||
create this file.
|
||||
*/
|
||||
|
||||
import { GatewayIntentBits } from 'discord.js';
|
||||
import { LogLevel, SapphireClient } from '@sapphire/framework';
|
||||
import { ScheduledTaskRedisStrategy } from '@sapphire/plugin-scheduled-tasks/register-redis';
|
||||
|
||||
@ -33,15 +34,15 @@ const client = new SapphireClient({
|
||||
level: LogLevel.Debug,
|
||||
},
|
||||
intents: [
|
||||
'GUILDS',
|
||||
'GUILD_MEMBERS',
|
||||
'GUILD_BANS',
|
||||
'GUILD_EMOJIS_AND_STICKERS',
|
||||
'GUILD_VOICE_STATES',
|
||||
'GUILD_MESSAGES',
|
||||
'GUILD_MESSAGE_REACTIONS',
|
||||
'DIRECT_MESSAGES',
|
||||
'DIRECT_MESSAGE_REACTIONS',
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildBans,
|
||||
GatewayIntentBits.GuildEmojisAndStickers,
|
||||
GatewayIntentBits.GuildVoiceStates,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.GuildMessageReactions,
|
||||
GatewayIntentBits.DirectMessages,
|
||||
GatewayIntentBits.DirectMessageReactions,
|
||||
],
|
||||
tasks: {
|
||||
// Scheduler with redis
|
||||
|
@ -29,13 +29,15 @@ import type {
|
||||
User,
|
||||
} from 'discord.js';
|
||||
import {
|
||||
time,
|
||||
ChannelType,
|
||||
PermissionsBitField,
|
||||
ButtonBuilder,
|
||||
ButtonInteraction,
|
||||
Constants,
|
||||
MessageActionRow,
|
||||
MessageButton,
|
||||
MessageEmbed,
|
||||
ButtonStyle,
|
||||
ActionRowBuilder,
|
||||
EmbedBuilder,
|
||||
} from 'discord.js';
|
||||
import { time } from '@discordjs/builders';
|
||||
import { maxVCs, questionInfo, serverFind } from '../../utils/verificationConfig';
|
||||
import { joinVerification, startVerification, finishVerification } from '../../utils/database/verification';
|
||||
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
|
||||
if (channel.members.size === 2) {
|
||||
await channel.permissionOverwrites.edit(guild.roles.everyone, {
|
||||
SEND_MESSAGES: true,
|
||||
SendMessages: true,
|
||||
});
|
||||
|
||||
if (!channel.name.includes(' - Verification')) {
|
||||
@ -134,7 +136,7 @@ class VerificationJoinVCListener extends Listener {
|
||||
}
|
||||
|
||||
// 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
|
||||
// Checks if there are more than 10 voice channels
|
||||
@ -144,52 +146,62 @@ class VerificationJoinVCListener extends Listener {
|
||||
let verificationText: TextChannel;
|
||||
let bannedName = false;
|
||||
try {
|
||||
verificationText = await guild.channels.create(`✅┃${member.displayName}-verification`, {
|
||||
type: 'GUILD_TEXT',
|
||||
verificationText = await guild.channels.create({
|
||||
name: `✅┃${member.displayName}-verification`,
|
||||
type: ChannelType.GuildText,
|
||||
topic: `Channel for verifiers only. ${member.id} ${channel.id} (Please do not change this)`,
|
||||
parent: category.id,
|
||||
userLimit: 1,
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: guild.roles.everyone,
|
||||
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL'],
|
||||
deny: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.verifyBlock,
|
||||
deny: ['VIEW_CHANNEL', 'SEND_MESSAGES'],
|
||||
deny: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.staff.verifier,
|
||||
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'],
|
||||
allow: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.staff.trialVerifier,
|
||||
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'],
|
||||
allow: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
],
|
||||
});
|
||||
} catch {
|
||||
verificationText = await guild.channels.create(`✅┃${member.id}-verification`, {
|
||||
type: 'GUILD_TEXT',
|
||||
verificationText = await guild.channels.create({
|
||||
name: `✅┃${member.displayName}-verification`,
|
||||
type: ChannelType.GuildText,
|
||||
topic: `Channel for verifiers only. ${member.id} ${channel.id} (Please do not change this)`,
|
||||
parent: category.id,
|
||||
userLimit: 1,
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: guild.roles.everyone,
|
||||
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL'],
|
||||
deny: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.verifyBlock,
|
||||
deny: ['VIEW_CHANNEL', 'SEND_MESSAGES'],
|
||||
deny: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.staff.verifier,
|
||||
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'],
|
||||
allow: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
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
|
||||
if (listVoiceChannels.size > maxVCs - 1) {
|
||||
await guild.channels.create('Verification', {
|
||||
type: 'GUILD_VOICE',
|
||||
await guild.channels.create({
|
||||
name: 'Verification',
|
||||
type: ChannelType.GuildVoice,
|
||||
parent: category.id,
|
||||
userLimit: 1,
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: guild.roles.everyone,
|
||||
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'STREAM'],
|
||||
deny: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel,
|
||||
PermissionsBitField.Flags.Stream],
|
||||
},
|
||||
{
|
||||
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,
|
||||
allow: ['VIEW_CHANNEL'],
|
||||
deny: ['CONNECT'],
|
||||
allow: [PermissionsBitField.Flags.ViewChannel],
|
||||
deny: [PermissionsBitField.Flags.Connect],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.vegan.vegan,
|
||||
allow: ['VIEW_CHANNEL'],
|
||||
deny: ['CONNECT'],
|
||||
allow: [PermissionsBitField.Flags.ViewChannel],
|
||||
deny: [PermissionsBitField.Flags.Connect],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.vegan.activist,
|
||||
deny: ['VIEW_CHANNEL', 'CONNECT'],
|
||||
deny: [PermissionsBitField.Flags.ViewChannel,
|
||||
PermissionsBitField.Flags.Connect],
|
||||
},
|
||||
{
|
||||
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,
|
||||
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'],
|
||||
allow: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel,
|
||||
PermissionsBitField.Flags.Connect,
|
||||
PermissionsBitField.Flags.MuteMembers],
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
await guild.channels.create('Verification', {
|
||||
type: 'GUILD_VOICE',
|
||||
await guild.channels.create({
|
||||
name: 'Verification',
|
||||
type: ChannelType.GuildVoice,
|
||||
parent: category.id,
|
||||
userLimit: 1,
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: guild.roles.everyone,
|
||||
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'STREAM'],
|
||||
deny: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel,
|
||||
PermissionsBitField.Flags.SendMessages],
|
||||
},
|
||||
{
|
||||
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,
|
||||
allow: ['VIEW_CHANNEL'],
|
||||
allow: [PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.vegan.vegan,
|
||||
allow: ['VIEW_CHANNEL'],
|
||||
allow: [PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.vegan.activist,
|
||||
deny: ['VIEW_CHANNEL', 'CONNECT'],
|
||||
deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect],
|
||||
},
|
||||
{
|
||||
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,
|
||||
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([
|
||||
{
|
||||
id: guild.roles.everyone,
|
||||
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'STREAM'],
|
||||
deny: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel,
|
||||
PermissionsBitField.Flags.Stream],
|
||||
},
|
||||
{
|
||||
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,
|
||||
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,
|
||||
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'],
|
||||
allow: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel,
|
||||
PermissionsBitField.Flags.Connect,
|
||||
PermissionsBitField.Flags.MuteMembers],
|
||||
},
|
||||
{
|
||||
id: member.id,
|
||||
allow: ['VIEW_CHANNEL'],
|
||||
allow: [PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
]);
|
||||
await currentChannel.setUserLimit(0);
|
||||
@ -324,7 +369,7 @@ class VerificationJoinVCListener extends Listener {
|
||||
const joinTime = time(user.joinedAt!);
|
||||
const registerTime = time(user.user.createdAt);
|
||||
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(user.displayHexColor)
|
||||
.setTitle(`Information on ${user.user.username}`)
|
||||
.setThumbnail(user.user.avatarURL()!)
|
||||
@ -341,7 +386,7 @@ class VerificationJoinVCListener extends Listener {
|
||||
private async getSus(user: GuildMember, guild: Guild) {
|
||||
const notes = await findNotes(user.id, true);
|
||||
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(user.displayHexColor)
|
||||
.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
|
||||
if (info.page === questionLength) {
|
||||
// Create embed with all the roles the user has
|
||||
embed = new MessageEmbed()
|
||||
embed = new EmbedBuilder()
|
||||
.setColor(embedColor)
|
||||
.setTitle(`Give these roles to ${user.displayName}?`)
|
||||
.setThumbnail(user.avatarURL()!)
|
||||
@ -510,16 +555,16 @@ class VerificationJoinVCListener extends Listener {
|
||||
);
|
||||
|
||||
// Create buttons for input
|
||||
buttons = [new MessageActionRow<MessageButton>()
|
||||
buttons = [new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
new ButtonBuilder()
|
||||
.setCustomId('confirm')
|
||||
.setLabel('Yes')
|
||||
.setStyle(Constants.MessageButtonStyles.SUCCESS),
|
||||
new MessageButton()
|
||||
.setStyle(ButtonStyle.Success),
|
||||
new ButtonBuilder()
|
||||
.setCustomId('cancel')
|
||||
.setLabel('No')
|
||||
.setStyle(Constants.MessageButtonStyles.DANGER),
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
)];
|
||||
await message.edit({
|
||||
embeds: [embed],
|
||||
@ -553,7 +598,7 @@ class VerificationJoinVCListener extends Listener {
|
||||
}, (info.roles.vegan || info.roles.convinced) ? 604800000 : 1814400000);
|
||||
}
|
||||
// Add embed saying verification completed
|
||||
embed = new MessageEmbed()
|
||||
embed = new EmbedBuilder()
|
||||
.setColor('#34c000')
|
||||
.setTitle(`Successfully verified ${user.displayName}!`)
|
||||
.setThumbnail(user.user.avatarURL()!)
|
||||
@ -586,7 +631,7 @@ class VerificationJoinVCListener extends Listener {
|
||||
}
|
||||
|
||||
private async createEmbed(title: string, color: ColorResolvable) {
|
||||
return new MessageEmbed()
|
||||
return new EmbedBuilder()
|
||||
.setColor(color)
|
||||
.setTitle(title);
|
||||
}
|
||||
@ -597,14 +642,14 @@ class VerificationJoinVCListener extends Listener {
|
||||
for (let i = 0; i < buttons.length; i += 1) {
|
||||
// Check if it exceeds the maximum buttons in a ActionRow
|
||||
if (i % 5 === 0) {
|
||||
buttonActions.push(new MessageActionRow<MessageButton>());
|
||||
buttonActions.push(new ActionRowBuilder<ButtonBuilder>());
|
||||
}
|
||||
buttonActions[Math.floor(i / 5)]
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`button${i}`)
|
||||
.setLabel(buttons[i])
|
||||
.setStyle(Constants.MessageButtonStyles.SECONDARY),
|
||||
.setStyle(ButtonStyle.Secondary),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ import { Listener } from '@sapphire/framework';
|
||||
import type {
|
||||
VoiceState, CategoryChannel, VoiceChannel, TextChannel,
|
||||
} from 'discord.js';
|
||||
import { time } from '@discordjs/builders';
|
||||
import {time, ChannelType, PermissionsBitField} from 'discord.js';
|
||||
import { maxVCs, leaveBan } from '../../utils/verificationConfig';
|
||||
import { getUser, checkFinish, countIncomplete } from '../../utils/database/verification';
|
||||
import { fetchRoles } from '../../utils/database/dbExistingUser';
|
||||
@ -101,7 +101,7 @@ class VerificationLeaveVCListener extends Listener {
|
||||
}
|
||||
|
||||
// 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)
|
||||
if (channel.name !== 'Verification') {
|
||||
@ -112,7 +112,7 @@ class VerificationLeaveVCListener extends Listener {
|
||||
// Delete text channel
|
||||
if (!verifier) {
|
||||
// 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) => {
|
||||
const textChannel = c as TextChannel;
|
||||
// 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 (listVoiceChannels.size - 1 === 0) {
|
||||
// Create a verification channel
|
||||
await guild.channels.create('Verification', {
|
||||
type: 'GUILD_VOICE',
|
||||
parent: IDs.categories.verification,
|
||||
await guild.channels.create({
|
||||
name: 'Verification',
|
||||
type: ChannelType.GuildVoice,
|
||||
parent: category.id,
|
||||
userLimit: 1,
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: guild.roles.everyone,
|
||||
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'STREAM'],
|
||||
deny: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel,
|
||||
PermissionsBitField.Flags.SendMessages],
|
||||
},
|
||||
{
|
||||
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,
|
||||
allow: ['VIEW_CHANNEL'],
|
||||
allow: [PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.vegan.vegan,
|
||||
allow: ['VIEW_CHANNEL'],
|
||||
allow: [PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.vegan.activist,
|
||||
deny: ['VIEW_CHANNEL', 'CONNECT'],
|
||||
deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect],
|
||||
},
|
||||
{
|
||||
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,
|
||||
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, {
|
||||
VIEW_CHANNEL: true,
|
||||
ViewChannel: true,
|
||||
});
|
||||
await verification.permissionOverwrites.edit(IDs.roles.vegan.vegan, {
|
||||
VIEW_CHANNEL: true,
|
||||
ViewChannel: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import type {
|
||||
TextChannel,
|
||||
VoiceChannel,
|
||||
} from 'discord.js';
|
||||
import { ChannelType, PermissionsBitField } from 'discord.js';
|
||||
import IDs from '../../utils/ids';
|
||||
|
||||
class VerificationReady extends Listener {
|
||||
@ -47,7 +48,7 @@ class VerificationReady extends Listener {
|
||||
}
|
||||
|
||||
// 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 emptyVC: string[] = [];
|
||||
// Delete voice channels
|
||||
@ -62,7 +63,7 @@ class VerificationReady extends Listener {
|
||||
});
|
||||
|
||||
// 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) => {
|
||||
const textChannel = c as TextChannel;
|
||||
// Checks if the channel topic has the user's snowflake
|
||||
@ -81,38 +82,49 @@ class VerificationReady extends Listener {
|
||||
}
|
||||
});
|
||||
if (!verification) {
|
||||
await category.guild.channels.create('Verification', {
|
||||
type: 'GUILD_VOICE',
|
||||
parent: IDs.categories.verification,
|
||||
await category.guild.channels.create({
|
||||
name: 'Verification',
|
||||
type: ChannelType.GuildVoice,
|
||||
parent: category.id,
|
||||
userLimit: 1,
|
||||
permissionOverwrites: [
|
||||
{
|
||||
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,
|
||||
deny: ['VIEW_CHANNEL', 'CONNECT', 'SEND_MESSAGES'],
|
||||
deny: [PermissionsBitField.Flags.ViewChannel,
|
||||
PermissionsBitField.Flags.Connect,
|
||||
PermissionsBitField.Flags.SendMessages],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.nonvegan.nonvegan,
|
||||
allow: ['VIEW_CHANNEL'],
|
||||
allow: [PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.vegan.vegan,
|
||||
allow: ['VIEW_CHANNEL'],
|
||||
allow: [PermissionsBitField.Flags.ViewChannel],
|
||||
},
|
||||
{
|
||||
id: IDs.roles.vegan.activist,
|
||||
deny: ['VIEW_CHANNEL', 'CONNECT'],
|
||||
deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.Connect],
|
||||
},
|
||||
{
|
||||
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,
|
||||
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'CONNECT', 'MUTE_MEMBERS'],
|
||||
allow: [PermissionsBitField.Flags.SendMessages,
|
||||
PermissionsBitField.Flags.ViewChannel,
|
||||
PermissionsBitField.Flags.Connect,
|
||||
PermissionsBitField.Flags.MuteMembers],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import { Listener } from '@sapphire/framework';
|
||||
import { Constants, MessageActionRow, MessageButton } from 'discord.js';
|
||||
import { ButtonStyle, ActionRowBuilder, ButtonBuilder } from 'discord.js';
|
||||
|
||||
import type {
|
||||
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. '
|
||||
+ 'Vegans have access to more channels. Voice discussions may be recorded.';
|
||||
|
||||
const button = new MessageActionRow<MessageButton>()
|
||||
const button = new ActionRowBuilder<ButtonBuilder>()
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
new ButtonBuilder()
|
||||
.setCustomId('welcomeJoin')
|
||||
.setLabel('Join')
|
||||
.setStyle(Constants.MessageButtonStyles.SUCCESS),
|
||||
.setStyle(ButtonStyle.Success),
|
||||
);
|
||||
|
||||
if (message?.author.id !== botId) {
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class CoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class DevCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkDevCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkDevCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class DiversityCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkDiversityCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkDiversityCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class EventCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkEventCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkEventCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class MentorCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkMentorCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkMentorCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class MentorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkMentor(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkMentor(interaction.member! as GuildMember);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class ModOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkMod(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkMod(interaction.member! as GuildMember);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class PatreonOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkPatreon(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkPatreon(interaction.member! as GuildMember);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class RestrictedAccessOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkRestrictedAccess(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkRestrictedAccess(interaction.member! as GuildMember);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class VerifierCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkVerifierCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkVerifierCoordinator(interaction.member! as GuildMember);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { AllFlowsPrecondition } from '@sapphire/framework';
|
||||
import type {
|
||||
CommandInteraction,
|
||||
ContextMenuInteraction,
|
||||
ContextMenuCommandInteraction,
|
||||
Message,
|
||||
GuildMember,
|
||||
} from 'discord.js';
|
||||
@ -37,7 +37,7 @@ class VerifierOnlyPrecondition extends AllFlowsPrecondition {
|
||||
return this.checkVerifier(interaction.member! as GuildMember);
|
||||
}
|
||||
|
||||
public override async contextMenuRun(interaction: ContextMenuInteraction) {
|
||||
public override async contextMenuRun(interaction: ContextMenuCommandInteraction) {
|
||||
// for context menu command
|
||||
return this.checkVerifier(interaction.member! as GuildMember);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user