Discord.js v14

This commit is contained in:
Dragon Fire
2024-04-07 19:06:19 -04:00
parent 58c81aa912
commit f59826f7ab
272 changed files with 893 additions and 656 deletions
+4 -3
View File
@@ -1,4 +1,5 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
const { joinVoiceChannel } = require('@discordjs/voice');
const Dispatcher = require('../../structures/Dispatcher');
@@ -6,20 +7,20 @@ module.exports = class JoinCommand extends Command {
constructor(client) {
super(client, {
name: 'join',
aliases: ['join-voice-channel', 'join-vc', 'join-voice', 'join-channel', 'connect'],
aliases: ['join-voice-channel', 'join-vc', 'join-voice', 'join-channel', PermissionFlagsBits.Connect],
group: 'util-voice',
memberName: 'join',
description: 'Joins your voice channel.',
guildOnly: true,
guarded: true,
userPermissions: ['CONNECT']
userPermissions: [PermissionFlagsBits.Connect]
});
}
run(msg) {
const voiceChannel = msg.member.voice.channel;
if (!voiceChannel) return msg.reply('Please enter a voice channel first.');
if (!voiceChannel.permissionsFor(this.client.user).has(['CONNECT', 'SPEAK', 'VIEW_CHANNEL'])) {
if (!voiceChannel.permissionsFor(this.client.user).has([PermissionFlagsBits.Connect, PermissionFlagsBits.Speak, 'VIEW_CHANNEL'])) {
return msg.reply('I\'m missing the "Connect", "Speak", or "View Channel" permission for this channel.');
}
if (!voiceChannel.joinable) return msg.reply('Your voice channel is not joinable.');
+2 -1
View File
@@ -1,4 +1,5 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
module.exports = class LeaveCommand extends Command {
constructor(client) {
@@ -20,7 +21,7 @@ module.exports = class LeaveCommand extends Command {
const usage = this.client.registry.commands.get('stop').usage();
return msg.reply(`I am currently playing audio in this server. Please use ${usage} first.`);
}
if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) {
if (!connection.channel.permissionsFor(msg.author).has(PermissionFlagsBits.MoveMembers)) {
return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`);
}
connection.leave();
+2 -1
View File
@@ -1,4 +1,5 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
module.exports = class PauseCommand extends Command {
constructor(client) {
@@ -19,7 +20,7 @@ module.exports = class PauseCommand extends Command {
if (connection.canPlay) {
return msg.reply('I am not currently playing audio in this server.');
}
if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) {
if (!connection.channel.permissionsFor(msg.author).has(PermissionFlagsBits.MoveMembers)) {
return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`);
}
connection.pause();
+2 -1
View File
@@ -1,4 +1,5 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
module.exports = class ResumeCommand extends Command {
constructor(client) {
@@ -19,7 +20,7 @@ module.exports = class ResumeCommand extends Command {
if (connection.canPlay) {
return msg.reply('I am not currently playing audio in this server.');
}
if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) {
if (!connection.channel.permissionsFor(msg.author).has(PermissionFlagsBits.MoveMembers)) {
return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`);
}
connection.unpause();
+2 -1
View File
@@ -1,4 +1,5 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
module.exports = class StopCommand extends Command {
constructor(client) {
@@ -19,7 +20,7 @@ module.exports = class StopCommand extends Command {
if (connection.canPlay) {
return msg.reply('I am not currently playing audio in this server.');
}
if (!connection.channel.permissionsFor(msg.author).has('MOVE_MEMBERS')) {
if (!connection.channel.permissionsFor(msg.author).has(PermissionFlagsBits.MoveMembers)) {
return msg.reply(`You need the "MOVE_MEMBERS" permission to use the \`${this.name}\` command.`);
}
connection.stop();