From ed8cc4f0be174e73290860c83b1c4bfa93a25150 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Tue, 2 Aug 2022 17:18:47 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=B5=D1=81?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BA=D0=B0=D1=82=D0=B5=D0=B3=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D1=8F=20Music=20=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TO REWRITE/Economy/money.js | 4 +- TO REWRITE/Economy/profile.js | 4 +- TO REWRITE/Economy/transactions.js | 4 +- TO REWRITE/Economy/work.js | 4 +- TO REWRITE/General/report.js | 4 +- TO REWRITE/General/suggest.js | 2 +- TO REWRITE/General/userinfo.js | 8 +- TO REWRITE/Moderation/announcement.js | 99 --------------- TO REWRITE/Music/autoplay.js | 32 ----- TO REWRITE/Music/back.js | 50 -------- TO REWRITE/Music/clip.js | 58 --------- TO REWRITE/Music/clips.js | 46 ------- TO REWRITE/Music/jump.js | 53 -------- TO REWRITE/Music/loop.js | 40 ------ TO REWRITE/Music/np.js | 77 ------------ TO REWRITE/Music/pause.js | 32 ----- TO REWRITE/Music/play.js | 45 ------- TO REWRITE/Music/queue.js | 72 ----------- TO REWRITE/Music/resume.js | 32 ----- TO REWRITE/Music/seek.js | 35 ------ TO REWRITE/Music/skip.js | 52 -------- TO REWRITE/Music/stop.js | 48 -------- TO REWRITE/queue.js | 115 ++++++++++++++++++ base/Guild.js | 5 - base/JaBa.js | 2 +- commands/Fun/lovecalc.js | 2 +- commands/Fun/memes.js | 5 +- commands/General/activity.js | 5 +- commands/General/help.js | 7 +- commands/Moderation/warn.js | 8 +- commands/Moderation/warns.js | 4 +- commands/Music/autoplay.js | 46 +++++++ commands/Music/back.js | 59 +++++++++ commands/Music/clips.js | 114 +++++++++++++++++ commands/Music/jump.js | 65 ++++++++++ commands/Music/loop.js | 90 ++++++++++++++ commands/Music/nowplaying.js | 88 ++++++++++++++ commands/Music/play.js | 64 ++++++++++ commands/Music/seek.js | 54 ++++++++ commands/Music/skip.js | 61 ++++++++++ commands/Music/stop.js | 57 +++++++++ commands/NSFW/nsfw.js | 5 +- commands/Owner/announcement.js | 69 +++++++++++ commands/Owner/eval.js | 4 +- commands/Owner/servers.js | 8 +- events/CommandHandler.js | 2 +- events/Guild/guildCreate.js | 13 +- events/Guild/guildDelete.js | 6 +- events/Guild/guildMemberAdd.js | 27 ++-- events/Guild/guildMemberRemove.js | 25 ++-- events/Guild/guildMemberUpdate.js | 11 +- helpers/birthdays.js | 4 +- languages/ru-RU/moderation/announcement.json | 10 -- languages/ru-RU/music/clip.json | 9 -- languages/ru-RU/music/clips.json | 5 +- languages/ru-RU/music/jump.json | 4 +- languages/ru-RU/music/loop.json | 12 +- .../ru-RU/music/{np.json => nowplaying.json} | 6 +- languages/ru-RU/music/pause.json | 6 - languages/ru-RU/music/play.json | 4 +- languages/ru-RU/music/queue.json | 3 + languages/ru-RU/music/resume.json | 6 - languages/ru-RU/music/seek.json | 4 +- languages/ru-RU/owner/announcement.json | 8 ++ languages/ru-RU/owner/reload.json | 1 + .../{moderation => owner}/announcement.json | 0 package-lock.json | 67 +++++++--- package.json | 9 +- 68 files changed, 1054 insertions(+), 926 deletions(-) delete mode 100644 TO REWRITE/Moderation/announcement.js delete mode 100644 TO REWRITE/Music/autoplay.js delete mode 100644 TO REWRITE/Music/back.js delete mode 100644 TO REWRITE/Music/clip.js delete mode 100644 TO REWRITE/Music/clips.js delete mode 100644 TO REWRITE/Music/jump.js delete mode 100644 TO REWRITE/Music/loop.js delete mode 100644 TO REWRITE/Music/np.js delete mode 100644 TO REWRITE/Music/pause.js delete mode 100644 TO REWRITE/Music/play.js delete mode 100644 TO REWRITE/Music/queue.js delete mode 100644 TO REWRITE/Music/resume.js delete mode 100644 TO REWRITE/Music/seek.js delete mode 100644 TO REWRITE/Music/skip.js delete mode 100644 TO REWRITE/Music/stop.js create mode 100644 TO REWRITE/queue.js create mode 100644 commands/Music/autoplay.js create mode 100644 commands/Music/back.js create mode 100644 commands/Music/clips.js create mode 100644 commands/Music/jump.js create mode 100644 commands/Music/loop.js create mode 100644 commands/Music/nowplaying.js create mode 100644 commands/Music/play.js create mode 100644 commands/Music/seek.js create mode 100644 commands/Music/skip.js create mode 100644 commands/Music/stop.js create mode 100644 commands/Owner/announcement.js delete mode 100644 languages/ru-RU/moderation/announcement.json delete mode 100644 languages/ru-RU/music/clip.json rename languages/ru-RU/music/{np.json => nowplaying.json} (86%) delete mode 100644 languages/ru-RU/music/pause.json delete mode 100644 languages/ru-RU/music/resume.json create mode 100644 languages/ru-RU/owner/announcement.json rename languages/uk-UA/{moderation => owner}/announcement.json (100%) diff --git a/TO REWRITE/Economy/money.js b/TO REWRITE/Economy/money.js index b9c3b3bb..0b425da9 100644 --- a/TO REWRITE/Economy/money.js +++ b/TO REWRITE/Economy/money.js @@ -54,8 +54,8 @@ class Money extends Command { username: member.user.username }), iconURL: member.user.displayAvatarURL({ - size: 512, - format: "png" + extension: "png", + size: 512 }) }) .addFields([ diff --git a/TO REWRITE/Economy/profile.js b/TO REWRITE/Economy/profile.js index 3600f108..93c3db44 100644 --- a/TO REWRITE/Economy/profile.js +++ b/TO REWRITE/Economy/profile.js @@ -57,8 +57,8 @@ class Profile extends Command { username: member.user.tag }), iconURL: member.user.displayAvatarURL({ - size: 512, - format: "png" + extension: "png", + size: 512 }) }) .setImage("attachment://achievements.png") diff --git a/TO REWRITE/Economy/transactions.js b/TO REWRITE/Economy/transactions.js index 316ac760..6f82685c 100644 --- a/TO REWRITE/Economy/transactions.js +++ b/TO REWRITE/Economy/transactions.js @@ -22,8 +22,8 @@ class Transactions extends Command { .setAuthor({ name: message.translate("economy/transactions:EMBED_TRANSACTIONS"), iconURL: message.author.displayAvatarURL({ - size: 512, - format: "png" + extension: "png", + size: 512 }) }) .setColor(data.config.embed.color) diff --git a/TO REWRITE/Economy/work.js b/TO REWRITE/Economy/work.js index 218e57cf..283cbbc1 100644 --- a/TO REWRITE/Economy/work.js +++ b/TO REWRITE/Economy/work.js @@ -43,8 +43,8 @@ class Work extends Command { .setFooter({ text: message.translate("economy/work:AWARD"), iconURL: message.author.displayAvatarURL({ - size: 512, - format: "png" + extension: "png", + size: 512 }) }) .setColor(data.config.embed.color); diff --git a/TO REWRITE/General/report.js b/TO REWRITE/General/report.js index e616953f..ab294c42 100644 --- a/TO REWRITE/General/report.js +++ b/TO REWRITE/General/report.js @@ -36,8 +36,8 @@ class Report extends Command { user: member.user.tag }), iconURL: message.author.displayAvatarURL({ - size: 512, - format: "png" + extension: "png", + size: 512 }) }) .addFields([ diff --git a/TO REWRITE/General/suggest.js b/TO REWRITE/General/suggest.js index c7a3eabb..e5f798d0 100644 --- a/TO REWRITE/General/suggest.js +++ b/TO REWRITE/General/suggest.js @@ -32,8 +32,8 @@ class Suggest extends Command { user: message.author.username }), iconURL: message.author.displayAvatarURL({ + extension: "png", size: 512, - format: "png" }) }) .addFields([ diff --git a/TO REWRITE/General/userinfo.js b/TO REWRITE/General/userinfo.js index 5f292485..d7950f7e 100644 --- a/TO REWRITE/General/userinfo.js +++ b/TO REWRITE/General/userinfo.js @@ -43,8 +43,8 @@ class Userinfo extends Command { .setAuthor({ name: `${user.tag} (${user.id})`, iconURL: user.displayAvatarURL({ - size: 512, - format: "png" + extension: "png", + size: 512 }) }) .setThumbnail(user.displayAvatarURL()) @@ -72,8 +72,8 @@ class Userinfo extends Command { { name: this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"), value: member.displayAvatarURL({ - size: 512, - format: "png" + extension: "png", + size: 512 }) } ]) diff --git a/TO REWRITE/Moderation/announcement.js b/TO REWRITE/Moderation/announcement.js deleted file mode 100644 index 0b7a3e2d..00000000 --- a/TO REWRITE/Moderation/announcement.js +++ /dev/null @@ -1,99 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Announcement extends Command { - constructor(client) { - super(client, { - name: "announcement", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["ann"], - memberPermissions: ["MENTION_EVERYONE"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const text = args.join(" "); - if (!text) return message.error("moderation/announcement:MISSING_TEXT"); - if (text.length > 1030) return message.error("moderation/announcement:TOO_LONG"); - - let mention = null; - const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); - - const filter = m => m.author.id === message.author.id; - const collector = new Discord.MessageCollector(message.channel, { - filter, - time: 240000 - }); - - collector.on("collect", async tmsg => { - if (tmsg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) { - tmsg.delete(); - msg.delete(); - collector.stop(true); - - if (message.deletable) message.delete(); - } - - if (tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) { - tmsg.delete(); - msg.delete(); - const tmsg1 = await message.channel.send(message.translate("moderation/announcement:MENTION_TYPE_PROMPT")); - - const filter = m => m.author.id === message.author.id; - const c = new Discord.MessageCollector(message.channel, { - filter, - time: 60000 - }); - c.on("collect", (m) => { - if (m.content.toLowerCase() === "here") { - mention = "@here"; - tmsg1.delete(); - m.delete(); - collector.stop(true); - c.stop(true); - } else if (m.content.toLowerCase() === "everyone") { - mention = "@everyone"; - tmsg1.delete(); - m.delete(); - collector.stop(true); - c.stop(true); - } - }); - - c.on("end", (collected, reason) => { - if (reason === "time") return message.error("misc:TIMES_UP"); - }); - - if (message.deletable) message.delete(); - } - }); - - collector.on("end", (collected, reason) => { - if (reason === "time") return message.error("misc:TIMES_UP"); - - const embed = new Discord.EmbedBuilder() - .setAuthor({ - name: message.translate("moderation/announcement:TITLE") - }) - .setColor(data.config.embed.color) - .setFooter({ - text: message.author.tag - }) - .setTimestamp() - .setDescription(text); - - message.channel.send({ - content: mention, - embeds: [embed] - }); - }); - } -} - -module.exports = Announcement; \ No newline at end of file diff --git a/TO REWRITE/Music/autoplay.js b/TO REWRITE/Music/autoplay.js deleted file mode 100644 index 2372c601..00000000 --- a/TO REWRITE/Music/autoplay.js +++ /dev/null @@ -1,32 +0,0 @@ -const Command = require("../../base/Command"); - -class AutoPlay extends Command { - constructor(client) { - super(client, { - name: "autoplay", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["autop"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - const autoplay = queue.toggleAutoplay(); - - message.success(`music/autoplay:SUCCESS_${autoplay ? "ENABLED" : "DISABLED"}`); - } -} - -module.exports = AutoPlay; \ No newline at end of file diff --git a/TO REWRITE/Music/back.js b/TO REWRITE/Music/back.js deleted file mode 100644 index 5340b1c5..00000000 --- a/TO REWRITE/Music/back.js +++ /dev/null @@ -1,50 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Back extends Command { - constructor(client) { - super(client, { - name: "back", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["previous"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - if (!queue.previousSongs[0]) return message.error("music/back:NO_PREV_SONG"); - - const embed = new Discord.EmbedBuilder() - .setAuthor({ - name: message.translate("music/back:DESCRIPTION") - }) - .setThumbnail(queue.tracks[0].thumbnail) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - - const m = await message.reply({ - embeds: [embed] - }); - - this.client.player.previous(message); - embed.setDescription(message.translate("music/back:SUCCESS")); - m.edit({ - embeds: [embed] - }); - } -} - -module.exports = Back; \ No newline at end of file diff --git a/TO REWRITE/Music/clip.js b/TO REWRITE/Music/clip.js deleted file mode 100644 index de287a0e..00000000 --- a/TO REWRITE/Music/clip.js +++ /dev/null @@ -1,58 +0,0 @@ -const Command = require("../../base/Command"), - fs = require("fs"), - { joinVoiceChannel, createAudioResource, createAudioPlayer, getVoiceConnection, AudioPlayerStatus } = require("@discordjs/voice"); - -class Clip extends Command { - constructor(client) { - super(client, { - name: "clip", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 2000 - }); - } - - async run(message, args) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - const clip = args[0]; - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (getVoiceConnection(message.guild.id)) return message.error("music/clip:ACTIVE_CLIP"); - if (queue) return message.error("music/clip:ACTIVE_QUEUE"); - if (!clip) return message.error("music/clip:NO_ARG"); - if (!fs.existsSync(`./clips/${clip}.mp3`)) return message.error("music/clip:NO_FILE", { file: clip }); - - try { - const connection = joinVoiceChannel({ - channelId: voice.id, - guildId: message.guild.id, - adapterCreator: message.guild.voiceAdapterCreator - }); - - const resource = createAudioResource(fs.createReadStream(`./clips/${clip}.mp3`)); - const player = createAudioPlayer() - .on("error", err => { - connection.destroy(); - console.error(err.message); - }); - - player.play(resource); - connection.subscribe(player); - - player.on(AudioPlayerStatus.Idle, () => { - connection.destroy(); - }); - } catch (error) { - console.error(error); - } - } -} - -module.exports = Clip; \ No newline at end of file diff --git a/TO REWRITE/Music/clips.js b/TO REWRITE/Music/clips.js deleted file mode 100644 index ab7cec01..00000000 --- a/TO REWRITE/Music/clips.js +++ /dev/null @@ -1,46 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"), - fs = require("fs"); - -class Clips extends Command { - constructor(client) { - super(client, { - name: "clips", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 2000 - }); - } - - async run(message, args, data) { - fs.readdir("./clips", function (err, files) { - if (err) return console.log("Unable to read directory: " + err); - - const clips = []; - - files.forEach(function (file) { - clips.push(file.substring(0, file.length - 4)); - }); - - const embed = new Discord.EmbedBuilder() - .setTitle(message.translate("music/clips:EMBED_TITLE")) - .setDescription(clips.join("\n")) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }) - .setTimestamp(); - message.reply({ - embeds: [embed] - }); - }); - } -} - -module.exports = Clips; \ No newline at end of file diff --git a/TO REWRITE/Music/jump.js b/TO REWRITE/Music/jump.js deleted file mode 100644 index dbbb5a1a..00000000 --- a/TO REWRITE/Music/jump.js +++ /dev/null @@ -1,53 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Jump extends Command { - constructor(client) { - super(client, { - name: "jump", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["j"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const queue = this.client.player.getQueue(message); - const voice = message.member.voice.channel; - const number = parseInt(args[0]); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - if (number < 0) return message.error("music/jump:NO_PREV_SONG", { prefix: data.guild.prefix }); - - const embed = new Discord.EmbedBuilder() - .setAuthor({ - name: message.translate("music/jump:SUCCESS") - }) - .setThumbnail(queue.songs[number].thumbnail) - .setFooter({ - text: data.config.embed.footer - }) - .setColor(data.config.embed.color); - - const m = await message.reply({ - embeds: [embed] - }); - - this.client.player.jump(message, number); - embed.setDescription(message.translate("music/play:NOW_PLAYING", { - songName: queue.songs[number].name - })); - m.edit({ - embeds: [embed] - }); - } -} - -module.exports = Jump; \ No newline at end of file diff --git a/TO REWRITE/Music/loop.js b/TO REWRITE/Music/loop.js deleted file mode 100644 index 05a19d7a..00000000 --- a/TO REWRITE/Music/loop.js +++ /dev/null @@ -1,40 +0,0 @@ -const Command = require("../../base/Command"); - -class Loop extends Command { - constructor(client) { - super(client, { - name: "loop", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["repeat", "l"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - const type = args[0]; - let mode = null; - if (type === "queue" || type === "all") { - mode = this.client.player.setRepeatMode(message, 2); - } else if (type === "song" || type === "single") { - mode = this.client.player.setRepeatMode(message, 1); - } else { - mode = this.client.player.setRepeatMode(message, 0); - } - - message.success(`music/loop:${mode ? mode === 2 ? "QUEUE" : "SONG" : "DISABLED"}`); - } -} - -module.exports = Loop; \ No newline at end of file diff --git a/TO REWRITE/Music/np.js b/TO REWRITE/Music/np.js deleted file mode 100644 index eab34af0..00000000 --- a/TO REWRITE/Music/np.js +++ /dev/null @@ -1,77 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Nowplaying extends Command { - constructor(client) { - super(client, { - name: "nowplaying", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - const track = queue.songs[0]; - - const status = queue => - `${message.translate("music/np:FILTERS")}: \`${ - queue.filters.join(", ") || message.translate("music/np:DISABLED") - }\` | ${message.translate("music/np:REPEAT")}: \`${ - queue.repeatMode - ? queue.repeatMode === 2 ? message.translate("music/np:QUEUE") : message.translate("music/np:SONG") - : message.translate("music/np:DISABLED") - }\` | ${message.translate("music/np:AUTOPLAY")}: \`${ - queue.autoplay - ? message.translate("music/np:ENABLED") - : message.translate("music/np:DISABLED") - }\``; - - const embed = new Discord.EmbedBuilder() - .setAuthor({ - name: message.translate("music/queue:TITLE") - }) - .setThumbnail(track.thumbnail) - .addFields([ - { - name: message.translate("music/np:T_TITLE"), - value: `[${track.name}](${track.url})` - }, - { - name: message.translate("music/np:T_CHANNEL"), - value: track.uploader.name || message.translate("common:UNKNOWN") - }, - { - name: message.translate("music/np:T_DURATION"), - value: `${queue.formattedCurrentTime} / ${track.duration > 1 ? track.formattedDuration : message.translate("music/play:LIVE")}` - }, - { - name: message.translate("music/np:T_CONF"), - value: status(queue) - } - ]) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }) - .setTimestamp(); - - message.reply({ - embeds: [embed] - }); - } -} - -module.exports = Nowplaying; \ No newline at end of file diff --git a/TO REWRITE/Music/pause.js b/TO REWRITE/Music/pause.js deleted file mode 100644 index efa90801..00000000 --- a/TO REWRITE/Music/pause.js +++ /dev/null @@ -1,32 +0,0 @@ -const Command = require("../../base/Command"); - -class Pause extends Command { - constructor(client) { - super(client, { - name: "pause", - dirname: __dirname, - enabled: false, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music:play:NOT_PLAYING"); - - await this.client.player.pause(message); - - message.sendT("music/pause:SUCCESS"); - } -} - -module.exports = Pause; \ No newline at end of file diff --git a/TO REWRITE/Music/play.js b/TO REWRITE/Music/play.js deleted file mode 100644 index 6f0ddb00..00000000 --- a/TO REWRITE/Music/play.js +++ /dev/null @@ -1,45 +0,0 @@ -const Command = require("../../base/Command"), - { PermissionsBitField } = require("discord.js"); - -class Play extends Command { - constructor(client) { - super(client, { - name: "play", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["p"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args) { - const voice = message.member.voice.channel; - const name = args.join(" "); - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!name) return message.error("music/play:MISSING_SONG_NAME"); - - // Check my permissions - const perms = voice.permissionsFor(this.client.user); - if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return message.error("music/play:VOICE_CHANNEL_CONNECT"); - - try { - this.client.player.play(message.member.voice.channel, args.join(" "), { - member: message.member, - textChannel: message.channel, - message - }); - } catch (e) { - message.error("music/play:ERR_OCCURRED", { - error: e - }); - console.error(e); - } - } -} - -module.exports = Play; \ No newline at end of file diff --git a/TO REWRITE/Music/queue.js b/TO REWRITE/Music/queue.js deleted file mode 100644 index 5aac7b8a..00000000 --- a/TO REWRITE/Music/queue.js +++ /dev/null @@ -1,72 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"), - Pagination = require("customizable-discordjs-pagination"); - -class Queue extends Command { - constructor(client) { - super(client, { - name: "queue", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["q"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - if (queue.songs.length === 1) { - const embed = new Discord.EmbedBuilder() - .setAuthor({ - name: message.translate("music/queue:TITLE"), - iconURL: message.guild.iconURL() - }) - .addFields([ - { - name: message.translate("music/np:CURRENTLY_PLAYING"), - value: `[${queue.songs[0].name}](${queue.songs[0].url})\n*${message.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n` - } - ]) - .setColor(data.config.embed.color); - return message.reply({ - embeds: [embed] - }); - } - - const FieldsEmbed = new Pagination.FieldsEmbed(); - - FieldsEmbed.embed - .setColor(data.config.embed.color) - .setAuthor({ - name: message.translate("music/queue:TITLE"), - iconURL: message.guild.iconURL() - }) - .addFields([ - { - name: message.translate("music/np:CURRENTLY_PLAYING"), - value: `[${queue.songs[0].name}](${queue.songs[0].url})\n*${message.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n` - } - ]); - FieldsEmbed - .setArray(queue.songs[1] ? queue.songs.slice(1, queue.songs.length) : []) - .setAuthorizedUsers([message.author.id]) - .setChannel(message.channel) - .setElementsPerPage(5) - .setDeleteOnTimeout(true) - .setPageIndicator(true) - .formatField(message.translate("music/queue:TITLE"), (track) => `**${queue.songs.indexOf(track)}**. [${track.name}](${track.url})\n*${message.translate("music/queue:ADDED")} ${track.member}*\n`) - .build(); - } -} - -module.exports = Queue; \ No newline at end of file diff --git a/TO REWRITE/Music/resume.js b/TO REWRITE/Music/resume.js deleted file mode 100644 index b056d6eb..00000000 --- a/TO REWRITE/Music/resume.js +++ /dev/null @@ -1,32 +0,0 @@ -const Command = require("../../base/Command"); - -class Resume extends Command { - constructor(client) { - super(client, { - name: "resume", - dirname: __dirname, - enabled: false, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music:play:NOT_PLAYING"); - - await this.client.player.resume(message); - - message.sendT("music/resume:SUCCESS"); - } -} - -module.exports = Resume; \ No newline at end of file diff --git a/TO REWRITE/Music/seek.js b/TO REWRITE/Music/seek.js deleted file mode 100644 index 5501b67f..00000000 --- a/TO REWRITE/Music/seek.js +++ /dev/null @@ -1,35 +0,0 @@ -const Command = require("../../base/Command"); -const ms = require("ms"); - -class Seek extends Command { - constructor(client) { - super(client, { - name: "seek", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - const time = ms(args[0]) / 1000; - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - if (isNaN(time)) return message.error("music/seek:INVALID_TIME"); - - await this.client.player.seek(message, time); - - message.sendT("music/seek:SUCCESS"); - } -} - -module.exports = Seek; \ No newline at end of file diff --git a/TO REWRITE/Music/skip.js b/TO REWRITE/Music/skip.js deleted file mode 100644 index 4afd4b1e..00000000 --- a/TO REWRITE/Music/skip.js +++ /dev/null @@ -1,52 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Skip extends Command { - constructor(client) { - super(client, { - name: "skip", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["s"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - if (!queue.songs[1]) return message.error("music/skip:NO_NEXT_SONG"); - - const embed = new Discord.EmbedBuilder() - .setAuthor({ - name: message.translate("music/skip:SUCCESS") - }) - .setThumbnail(queue.songs[1].thumbnail) - .setFooter({ - text: data.config.embed.footer - }) - .setColor(data.config.embed.color); - - const m = await message.reply({ - embeds: [embed] - }); - - this.client.player.skip(message); - embed.setDescription(message.translate("music/play:NOW_PLAYING", { - songName: queue.songs[1].name - })); - m.edit({ - embeds: [embed] - }); - } -} - -module.exports = Skip; \ No newline at end of file diff --git a/TO REWRITE/Music/stop.js b/TO REWRITE/Music/stop.js deleted file mode 100644 index d312d8cf..00000000 --- a/TO REWRITE/Music/stop.js +++ /dev/null @@ -1,48 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Stop extends Command { - constructor(client) { - super(client, { - name: "stop", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["leave", "st"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = await this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - const embed = new Discord.EmbedBuilder() - .setAuthor({ - name: message.translate("music/stop:DESCRIPTION") - }) - .setFooter({ - text: data.config.embed.footer - }) - .setColor(data.config.embed.color); - - const m = await message.reply({ - embeds: [embed] - }); - - this.client.player.stop(message); - embed.setDescription(message.translate("music/stop:SUCCESS")); - m.edit({ - embeds: [embed] - }); - } -} - -module.exports = Stop; \ No newline at end of file diff --git a/TO REWRITE/queue.js b/TO REWRITE/queue.js new file mode 100644 index 00000000..de3abea3 --- /dev/null +++ b/TO REWRITE/queue.js @@ -0,0 +1,115 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"), + { sendPaginatedEmbeds } = require("discord.js-embed-pagination"); + +class Queue extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("queue") + .setDescription(client.translate("music/queue:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const voice = interaction.member.voice.channel; + const queue = client.player.getQueue(interaction); + + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + if (!queue) return interaction.error("music/play:NOT_PLAYING"); + + if (queue.songs.length === 1) { + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("music/queue:TITLE"), + iconURL: interaction.guild.iconURL() + }) + .addFields([ + { + name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"), + value: `[${queue.songs[0].name}](${queue.songs[0].url})\n*${interaction.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n` + } + ]) + .setColor(client.config.embed.color); + return interaction.reply({ + embeds: [embed] + }); + } + + const songs = queue.songs.slice(1, queue.songs.length).map(song => { + return { + name: interaction.translate("music/queue:TITLE"), + value: `**${queue.songs.indexOf(song)}**. [${song.name}](${song.url})\n*${interaction.translate("music/queue:ADDED")} ${song.member}*\n` + }; + }); + + const pages = songs.map(song => { + new EmbedBuilder() + .setAuthor({ + name: interaction.translate("music/queue:TITLE"), + iconURL: interaction.guild.iconURL() + }) + .setColor(client.config.embed.color) + .addFields([ + // { + // name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"), + // value: `[${queue.songs[0].name}](${queue.songs[0].url})\n*${interaction.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n` + // }, + ...songs + ]); + }); + + sendPaginatedEmbeds(interaction, pages, { + previousLabel: interaction.translate("music/queue:"), + nextLabel: interaction.translate("music/queue:"), + pageLabel: interaction.translate("music/queue:"), + content: `${interaction.translate("music/nowplaying:CURRENTLY_PLAYING")}\n[${queue.songs[0].name}](${queue.songs[0].url})\n*${interaction.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`, + showPagePosition: true, + time: 120000 + }); + + // FieldsEmbed.embed + // .setColor(client.config.embed.color) + // .setAuthor({ + // name: interaction.translate("music/queue:TITLE"), + // iconURL: interaction.guild.iconURL() + // }) + // .addFields([ + // { + // name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"), + // value: `[${queue.songs[0].name}](${queue.songs[0].url})\n*${interaction.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n` + // } + // ]); + // FieldsEmbed + // .setArray(queue.songs[1] ? queue.songs.slice(1, queue.songs.length) : []) + // .setAuthorizedUsers([interaction.member.id]) + // .setChannel(interaction.channel) + // .setElementsPerPage(5) + // .setDeleteOnTimeout(true) + // .setPageIndicator(true) + // .formatField(interaction.translate("music/queue:TITLE"), (track) => `**${queue.songs.indexOf(track)}**. [${track.name}](${track.url})\n*${interaction.translate("music/queue:ADDED")} ${track.member}*\n`) + // .build(); + } +} + +module.exports = Queue; \ No newline at end of file diff --git a/base/Guild.js b/base/Guild.js index b335be5d..a196cd26 100644 --- a/base/Guild.js +++ b/base/Guild.js @@ -42,11 +42,6 @@ module.exports = mongoose.model("Guild", new Schema({ kick: false, // The number of warns required to kick the user ban: false // The number of warns required to ban the user }, - // Tickets - tickets: { - enabled: false, // Whether the tickets system is enabled - category: null // The category for the tickets system - }, suggestions: false, // the channel in which the suggestions will be sent modlogs: false, // the channel in which the moderation logs (mute, kick, ban, etc...) will be sent birthdays: false, // the channel in which birtdays announcements will be sent diff --git a/base/JaBa.js b/base/JaBa.js index c0d5e62e..7fac3148 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -90,7 +90,7 @@ class JaBa extends Client { .on("searchResult", (message, result) => { let i = 0; const embed = new EmbedBuilder() - .setDescription(result.map(song => `**${++i} -** ${song.name}`).join("\n")) + .setDescription(result.map(song => `**${++i}** - ${song.name}`).join("\n")) .setFooter({ text: this.translate("music/play:RESULTS_FOOTER", null, message.guild.data.language) }) .setColor(this.config.embed.color); message.reply({ embeds: [embed] }); diff --git a/commands/Fun/lovecalc.js b/commands/Fun/lovecalc.js index 8de8e276..b01566f7 100644 --- a/commands/Fun/lovecalc.js +++ b/commands/Fun/lovecalc.js @@ -40,7 +40,7 @@ class Lovecalc extends BaseCommand { */ async execute(client, interaction) { const firstMember = interaction.options.getMember("first_member"); - const secondMember = interaction.options.getMember("second_member") || interaction.user; + const secondMember = interaction.options.getMember("second_member") || interaction.member; const members = [firstMember, secondMember].sort((a, b) => parseInt(a.id, 10) - parseInt(b.id, 10)); const hash = md5(`${members[0].id}${members[1].user.username}${members[0].user.username}${members[1].id}`); diff --git a/commands/Fun/memes.js b/commands/Fun/memes.js index a681313e..621ff3d6 100644 --- a/commands/Fun/memes.js +++ b/commands/Fun/memes.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector } = require("discord.js"); +const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, ComponentType } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"), fetch = require("node-fetch"); @@ -54,6 +54,7 @@ class Memes extends BaseCommand { }); const collector = new InteractionCollector(client, { + componentType: ComponentType.SelectMenu, message: msg, idle: 60 * 1000 }); @@ -71,7 +72,7 @@ class Memes extends BaseCommand { .setImage(res.url) .setTimestamp(); - msg.update({ + await msg.update({ embeds: [embed] }); }); diff --git a/commands/General/activity.js b/commands/General/activity.js index 0570fd6e..4576f9df 100644 --- a/commands/General/activity.js +++ b/commands/General/activity.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, PermissionsBitField } = require("discord.js"), +const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, PermissionsBitField, ComponentType } = require("discord.js"), { defaultApplications } = require("../../helpers/discordTogether"); const BaseCommand = require("../../base/BaseCommand"); @@ -60,6 +60,7 @@ class Activity extends BaseCommand { }); const collector = new InteractionCollector(client, { + componentType: ComponentType.SelectMenu, message: msg, idle: 60 * 1000 }); @@ -77,7 +78,7 @@ class Activity extends BaseCommand { }) .setTimestamp(); - msg.update({ + await msg.update({ embeds: [embed], components: [] }); diff --git a/commands/General/help.js b/commands/General/help.js index ec4e17be..65797bb6 100644 --- a/commands/General/help.js +++ b/commands/General/help.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, PermissionsBitField } = require("discord.js"); +const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, PermissionsBitField, ComponentType } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"); class Help extends BaseCommand { @@ -48,7 +48,7 @@ class Help extends BaseCommand { commands.forEach(c => { if (!categories.includes(c.category)) { - if (c.category === "Owner" && interaction.user.id !== client.config.owner.id) return; + if (c.category === "Owner" && interaction.member.id !== client.config.owner.id) return; categories.push(c.category); } }); @@ -75,6 +75,7 @@ class Help extends BaseCommand { }); const collector = new InteractionCollector(client, { + componentType: ComponentType.SelectMenu, message: msg, idle: 60 * 1000 }); @@ -107,7 +108,7 @@ class Help extends BaseCommand { }); } else { const embed = generateCommandHelp(client, interaction, arg); - return msg.update({ + await msg.update({ content: null, components: [], embeds: [embed] diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index da742882..e07d7cb9 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -35,8 +35,8 @@ class Warn extends BaseCommand { const memberPosition = member.roles.highest.position; const moderationPosition = interaction.member.roles.highest.position; if (member.user.bot) return; - if (member.id === interaction.user.id) return interaction.error("moderation/warn:YOURSELF"); - if (interaction.guild.ownerId !== interaction.user.id && !(moderationPosition > memberPosition)) return interaction.error("moderation/ban:SUPERIOR"); + if (member.id === interaction.member.id) return interaction.error("moderation/warn:YOURSELF"); + if (interaction.guild.ownerId !== interaction.member.id && !(moderationPosition > memberPosition)) return interaction.error("moderation/ban:SUPERIOR"); const memberData = await client.findOrCreateMember({ id: member.id, @@ -60,7 +60,7 @@ class Warn extends BaseCommand { const submitted = await interaction.awaitModalSubmit({ time: 120000, - filter: i => i.user.id === interaction.user.id, + filter: i => i.user.id === interaction.member.id, }); if (submitted) { @@ -74,7 +74,7 @@ class Warn extends BaseCommand { data.guildData.save(); const caseInfo = { - moderator: interaction.user.id, + moderator: interaction.member.id, date: Date.now(), type: "warn", case: data.guildData.casesCount, diff --git a/commands/Moderation/warns.js b/commands/Moderation/warns.js index 0ad05d77..d6981180 100644 --- a/commands/Moderation/warns.js +++ b/commands/Moderation/warns.js @@ -45,8 +45,8 @@ class Warns extends BaseCommand { member: member.nickname || member.user.username }), iconURL: member.displayAvatarURL({ - size: 512, - format: "png" + extension: "png", + size: 512 }) }) .setColor(client.config.embed.color) diff --git a/commands/Music/autoplay.js b/commands/Music/autoplay.js new file mode 100644 index 00000000..43bbc9eb --- /dev/null +++ b/commands/Music/autoplay.js @@ -0,0 +1,46 @@ +const { SlashCommandBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class AutoPlay extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("autoplay") + .setDescription(client.translate("music/autoplay:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const voice = interaction.member.voice.channel; + const queue = client.player.getQueue(interaction); + + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { ephemeral: true }); + if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { ephemeral: true }); + + const autoplay = queue.toggleAutoplay(); + + interaction.success(`music/autoplay:SUCCESS_${autoplay ? "ENABLED" : "DISABLED"}`); + } +} + +module.exports = AutoPlay; \ No newline at end of file diff --git a/commands/Music/back.js b/commands/Music/back.js new file mode 100644 index 00000000..dd038e70 --- /dev/null +++ b/commands/Music/back.js @@ -0,0 +1,59 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Back extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("back") + .setDescription(client.translate("music/back:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const voice = interaction.member.voice.channel; + const queue = client.player.getQueue(interaction); + + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { ephemeral: true }); + if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { ephemeral: true }); + if (!queue.previousSongs[0]) return interaction.error("music/back:NO_PREV_SONG", null, { ephemeral: true }); + + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("music/back:DESCRIPTION") + }) + .setThumbnail(queue.tracks[0].thumbnail) + .setDescription(interaction.translate("music/back:SUCCESS")) + .setColor(client.config.embed.color) + .setFooter({ + text: client.config.embed.footer + }); + client.player.previous(interaction); + + interaction.reply({ + embeds: [embed] + }); + } +} + +module.exports = Back; \ No newline at end of file diff --git a/commands/Music/clips.js b/commands/Music/clips.js new file mode 100644 index 00000000..0f38a54c --- /dev/null +++ b/commands/Music/clips.js @@ -0,0 +1,114 @@ +const { SlashCommandBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, ComponentType } = require("discord.js"), + { joinVoiceChannel, createAudioResource, createAudioPlayer, getVoiceConnection, AudioPlayerStatus } = require("@discordjs/voice"); +const BaseCommand = require("../../base/BaseCommand"), + fs = require("fs"); + +class Clips extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("clips") + .setDescription(client.translate("music/clips:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + fs.readdir("./clips", async function (err, files) { + if (err) return console.log("Unable to read directory: " + err); + + const clips = files.map(file => { + const fileName = file.substring(0, file.length - 4); + return { + label: fileName, + value: fileName + }; + }); + + const row = new ActionRowBuilder() + .addComponents( + new SelectMenuBuilder() + .setCustomId("clips_select") + .setPlaceholder(client.translate("common:NOTHING_SELECTED")) + .addOptions(clips) + ); + + const msg = await interaction.reply({ + content: interaction.translate("music/clips:AVAILABLE_CLIPS"), + ephemeral: true, + components: [row], + fetchReply: true + }); + + const collector = new InteractionCollector(client, { + componentType: ComponentType.SelectMenu, + message: msg, + idle: 60 * 1000 + }); + + collector.on("collect", async msg => { + const clip = msg?.values[0]; + const voice = msg.member.voice.channel; + const queue = client.player.getQueue(msg); + + if (!voice) return msg.error("music/play:NO_VOICE_CHANNEL"); + if (getVoiceConnection(msg.guild.id)) return msg.error("music/clip:ACTIVE_CLIP"); + if (queue) return msg.error("music/clip:ACTIVE_QUEUE"); + if (!clip) return msg.error("music/clip:NO_ARG"); + if (!fs.existsSync(`./clips/${clip}.mp3`)) return msg.error("music/clip:NO_FILE", { file: clip }); + + try { + const connection = joinVoiceChannel({ + channelId: voice.id, + guildId: msg.guild.id, + adapterCreator: msg.guild.voiceAdapterCreator + }); + + const resource = createAudioResource(fs.createReadStream(`./clips/${clip}.mp3`)); + const player = createAudioPlayer() + .on("error", err => { + connection.destroy(); + console.error(err.message); + }); + + player.play(resource); + connection.subscribe(player); + + player.on(AudioPlayerStatus.Idle, () => { + connection.destroy(); + }); + } catch (error) { + console.error(error); + } + + await msg.update({ + content: interaction.translate("music/clips:PLAYING", { + clip + }), + components: [] + }); + }); + }); + } +} + +module.exports = Clips; \ No newline at end of file diff --git a/commands/Music/jump.js b/commands/Music/jump.js new file mode 100644 index 00000000..4e81dcd1 --- /dev/null +++ b/commands/Music/jump.js @@ -0,0 +1,65 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Jump extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("jump") + .setDescription(client.translate("music/jump:DESCRIPTION")) + .addIntegerOption(option => option.setName("position") + .setDescription("music/jump:POSITION") + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const queue = client.player.getQueue(interaction); + const voice = interaction.member.voice.channel; + const position = interaction.options.getInteger("position"); + + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + if (!queue) return interaction.error("music/play:NOT_PLAYING"); + if (position < 0) return interaction.error("music/jump:NO_PREV_SONG"); + + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("music/jump:SUCCESS") + }) + .setThumbnail(queue.songs[position].thumbnail) + .setDescription(interaction.translate("music/play:NOW_PLAYING", { + songName: queue.songs[position].name + })) + .setFooter({ + text: client.config.embed.footer + }) + .setColor(client.config.embed.color); + client.player.jump(interaction, position); + + interaction.reply({ + embeds: [embed] + }); + } +} + +module.exports = Jump; \ No newline at end of file diff --git a/commands/Music/loop.js b/commands/Music/loop.js new file mode 100644 index 00000000..75826b28 --- /dev/null +++ b/commands/Music/loop.js @@ -0,0 +1,90 @@ +const { SlashCommandBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, ComponentType } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Loop extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("loop") + .setDescription(client.translate("music/loop:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const voice = interaction.member.voice.channel; + const queue = client.player.getQueue(interaction); + + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + if (!queue) return interaction.error("music/play:NOT_PLAYING"); + + const row = new ActionRowBuilder() + .addComponents( + new SelectMenuBuilder() + .setCustomId("nsfw_select") + .setPlaceholder(client.translate("common:NOTHING_SELECTED")) + .addOptions([ + { + label: client.translate("music/loop:QUEUE"), + value: "queue" + }, + { + label: client.translate("music/loop:SONG"), + value: "song" + } + ]) + ); + + const msg = await interaction.reply({ + content: interaction.translate("common:AVAILABLE_CATEGORIES"), + ephemeral: true, + components: [row], + fetchReply: true + }); + + const collector = new InteractionCollector(client, { + componentType: ComponentType.SelectMenu, + message: msg, + idle: 60 * 1000 + }); + + collector.on("collect", async msg => { + const type = msg?.values[0]; + let mode = null; + + if (type === "queue") { + mode = client.player.setRepeatMode(interaction, 2); + } else if (type === "song") { + mode = client.player.setRepeatMode(interaction, 1); + } else { + mode = client.player.setRepeatMode(interaction, 0); + } + + await msg.update({ + content: `music/loop:${mode ? mode === 2 ? "QUEUE_ENABLED" : "SONG_ENABLED" : "DISABLED"}`, + components: [] + }); + }); + } +} + +module.exports = Loop; \ No newline at end of file diff --git a/commands/Music/nowplaying.js b/commands/Music/nowplaying.js new file mode 100644 index 00000000..c9445a2a --- /dev/null +++ b/commands/Music/nowplaying.js @@ -0,0 +1,88 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Nowplaying extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("nowplaying") + .setDescription(client.translate("music/nowplaying:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const voice = interaction.member.voice.channel; + const queue = client.player.getQueue(interaction); + + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + if (!queue) return interaction.error("music/play:NOT_PLAYING"); + + const track = queue.songs[0]; + + const status = queue => + `${interaction.translate("music/nowplaying:REPEAT")}: \`${ + queue.repeatMode + ? queue.repeatMode === 2 ? interaction.translate("music/nowplaying:QUEUE") : interaction.translate("music/nowplaying:SONG") + : interaction.translate("music/nowplaying:DISABLED") + }\` | ${interaction.translate("music/nowplaying:AUTOPLAY")}: \`${ + queue.autoplay + ? interaction.translate("music/nowplaying:ENABLED") + : interaction.translate("music/nowplaying:DISABLED") + }\``; + + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("music/queue:TITLE") + }) + .setThumbnail(track.thumbnail) + .addFields([ + { + name: interaction.translate("music/nowplaying:T_TITLE"), + value: `[${track.name}](${track.url})` + }, + { + name: interaction.translate("music/nowplaying:T_CHANNEL"), + value: track.uploader.name || interaction.translate("common:UNKNOWN") + }, + { + name: interaction.translate("music/nowplaying:T_DURATION"), + value: `${queue.formattedCurrentTime} / ${track.duration > 1 ? track.formattedDuration : interaction.translate("music/play:LIVE")}` + }, + { + name: interaction.translate("music/nowplaying:T_CONF"), + value: status(queue) + } + ]) + .setColor(client.config.embed.color) + .setFooter({ + text: client.config.embed.footer + }) + .setTimestamp(); + + interaction.reply({ + embeds: [embed] + }); + } +} + +module.exports = Nowplaying; \ No newline at end of file diff --git a/commands/Music/play.js b/commands/Music/play.js new file mode 100644 index 00000000..c2a7ef08 --- /dev/null +++ b/commands/Music/play.js @@ -0,0 +1,64 @@ +const { SlashCommandBuilder, PermissionsBitField } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Play extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("play") + .setDescription(client.translate("music/play:DESCRIPTION")) + .addStringOption(option => option.setName("link") + .setDescription(client.translate("music/play:LINK")) + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + await interaction.deferReply(); + + const voice = interaction.member.voice.channel; + const link = interaction.options.getString("link"); + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + + const perms = voice.permissionsFor(client.user); + if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT"); + + try { + client.player.play(interaction.member.voice.channel, link, { + member: interaction.member, + textChannel: interaction.channel + }); + + interaction.editReply({ + content: interaction.translate("music/play:ADDED_QUEUE", { songName: link }) + }); + } catch (e) { + interaction.error("music/play:ERR_OCCURRED", { + error: e + }); + console.error(e); + } + } +} + +module.exports = Play; \ No newline at end of file diff --git a/commands/Music/seek.js b/commands/Music/seek.js new file mode 100644 index 00000000..b85eaf6e --- /dev/null +++ b/commands/Music/seek.js @@ -0,0 +1,54 @@ +const { SlashCommandBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"), + ms = require("ms"); + +class Seek extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("seek") + .setDescription(client.translate("music/seek:DESCRIPTION")) + .addStringOption(option => option.setName("time") + .setDescription("music/seek:TIME") + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const voice = interaction.member.voice.channel; + const queue = client.player.getQueue(interaction); + const time = ms(interaction.options.getString("time")) / 1000; + + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + if (!queue) return interaction.error("music/play:NOT_PLAYING"); + if (isNaN(time)) return interaction.error("music/seek:INVALID_TIME"); + + await client.player.seek(interaction, time); + + interaction.replyT("music/seek:SUCCESS", { + time: ms(interaction.options.getString("time")) + }); + } +} + +module.exports = Seek; \ No newline at end of file diff --git a/commands/Music/skip.js b/commands/Music/skip.js new file mode 100644 index 00000000..883238bb --- /dev/null +++ b/commands/Music/skip.js @@ -0,0 +1,61 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Skip extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("skip") + .setDescription(client.translate("music/skip:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const voice = interaction.member.voice.channel; + const queue = client.player.getQueue(interaction); + + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + if (!queue) return interaction.error("music/play:NOT_PLAYING"); + if (!queue.songs[1]) return interaction.error("music/skip:NO_NEXT_SONG"); + + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("music/skip:SUCCESS") + }) + .setThumbnail(queue.songs[1].thumbnail) + .setDescription(interaction.translate("music/play:NOW_PLAYING", { + songName: queue.songs[1].name + })) + .setFooter({ + text: client.config.embed.footer + }) + .setColor(client.config.embed.color); + client.player.skip(interaction); + + interaction.reply({ + embeds: [embed] + }); + } +} + +module.exports = Skip; \ No newline at end of file diff --git a/commands/Music/stop.js b/commands/Music/stop.js new file mode 100644 index 00000000..08f2d31f --- /dev/null +++ b/commands/Music/stop.js @@ -0,0 +1,57 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Stop extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("stop") + .setDescription(client.translate("music/stop:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const voice = interaction.member.voice.channel; + const queue = client.player.getQueue(interaction); + + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + if (!queue) return interaction.error("music/play:NOT_PLAYING"); + + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("music/stop:DESCRIPTION") + }) + .setDescription(interaction.translate("music/stop:SUCCESS")) + .setFooter({ + text: client.config.embed.footer + }) + .setColor(client.config.embed.color); + client.player.stop(interaction); + + interaction.reply({ + embeds: [embed] + }); + } +} + +module.exports = Stop; \ No newline at end of file diff --git a/commands/NSFW/nsfw.js b/commands/NSFW/nsfw.js index 5a0c0197..b1ecddf7 100644 --- a/commands/NSFW/nsfw.js +++ b/commands/NSFW/nsfw.js @@ -1,4 +1,4 @@ -const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector } = require("discord.js"); +const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, ComponentType } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"), fetch = require("node-fetch"); @@ -57,6 +57,7 @@ class NSFW extends BaseCommand { }); const collector = new InteractionCollector(client, { + componentType: ComponentType.SelectMenu, message: msg, idle: 60 * 1000 }); @@ -74,7 +75,7 @@ class NSFW extends BaseCommand { .setImage(res.url) .setTimestamp(); - msg.update({ + await msg.update({ embeds: [embed] }); }); diff --git a/commands/Owner/announcement.js b/commands/Owner/announcement.js new file mode 100644 index 00000000..31d46e45 --- /dev/null +++ b/commands/Owner/announcement.js @@ -0,0 +1,69 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Announcement extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("announcement") + .setDescription(client.translate("owner/announcement:DESCRIPTION")) + .addStringOption(option => + option.setName("message") + .setDescription(client.translate("owner/say:MESSAGE")) + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: true + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + await interaction.deferReply({ ephemeral: true }); + const text = interaction.options.getString("message"); + if (text.length > 1000) return interaction.error("owner/announcement:TOO_LONG"); + + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("owner/announcement:TITLE") + }) + .setDescription(text) + .setColor(client.config.embed.color) + .setFooter({ + text: interaction.user.tag + }) + .setTimestamp(); + + client.guilds.cache.forEach(async guild => { + if (guild.id === "568120814776614924") return; + const channel = guild.channels.cache.find(g => g.id === guild?.data.plugins.welcome.channel); + await channel.send({ + content: "||@everyone|| ВАЖНОЕ ОБЪЯВЛЕНИЕ!", + embeds: [embed] + }); + }); + + interaction.editReply({ + content: interaction.translate("owner/announcement:SENDED"), + ephemeral: true + }); + } +} + +module.exports = Announcement; \ No newline at end of file diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js index 30e83b0f..fe76982e 100644 --- a/commands/Owner/eval.js +++ b/commands/Owner/eval.js @@ -1,4 +1,3 @@ -/* eslint-disable no-unused-vars */ const { SlashCommandBuilder } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"); @@ -26,7 +25,7 @@ class Eval extends BaseCommand { * * @param {import("../../base/JaBa")} client */ - async onLoad(client) { + async onLoad() { //... } /** @@ -35,6 +34,7 @@ class Eval extends BaseCommand { * @param {import("discord.js").ChatInputCommandInteraction} interaction * @param {Array} data */ + // eslint-disable-next-line no-unused-vars async execute(client, interaction, data) { const code = interaction.options.getString("code"); const result = new Promise((resolve) => resolve(eval(code))); diff --git a/commands/Owner/servers.js b/commands/Owner/servers.js index 4e90f222..cc2d34dc 100644 --- a/commands/Owner/servers.js +++ b/commands/Owner/servers.js @@ -46,9 +46,9 @@ class Servers extends BaseCommand { const embed = new EmbedBuilder() .setAuthor({ name: interaction.user.tag, - iconURL: interaction.user.displayAvatarURL({ - size: 512, - format: "png" + iconURL: interaction.member.displayAvatarURL({ + extension: "png", + size: 512 }) }) .setColor(client.config.embed.color) @@ -124,7 +124,7 @@ class Servers extends BaseCommand { if (reaction._emoji.name === "❌") return msg.delete(); - await reaction.users.remove(interaction.user.id); + await reaction.users.remove(interaction.member.id); }); } } diff --git a/events/CommandHandler.js b/events/CommandHandler.js index 21daf30c..e60466f6 100644 --- a/events/CommandHandler.js +++ b/events/CommandHandler.js @@ -26,7 +26,7 @@ class CommandHandler extends BaseEvent { data.userData = userData; if (command.guildOnly && !interaction.inGuild()) return interaction.replyT("misc:GUILD_ONLY", { ephemeral: true }); - if (command.ownerOnly && interaction.user.id !== client.config.owner.id) return interaction.replyT("misc:OWNER_ONLY", { ephemeral: true }); + if (command.ownerOnly && interaction.member.id !== client.config.owner.id) return interaction.replyT("misc:OWNER_ONLY", { ephemeral: true }); if (interaction.inGuild()) { const guildData = await client.findOrCreateGuild({ diff --git a/events/Guild/guildCreate.js b/events/Guild/guildCreate.js index d112575a..d746d2e9 100644 --- a/events/Guild/guildCreate.js +++ b/events/Guild/guildCreate.js @@ -11,12 +11,13 @@ class GuildCreate extends BaseEvent { /** * + * @param {import("../../base/JaBa")} client * @param {import("discord.js").Guild} guild */ - async execute(guild) { + async execute(client, guild) { const messageOptions = {}; - const userData = await this.client.findOrCreateUser({ + const userData = await client.findOrCreateUser({ id: guild.ownerId }); @@ -36,9 +37,9 @@ class GuildCreate extends BaseEvent { name: "Спасибо что добавили меня на свой сервер!" }) .setDescription("Чтобы получить список команд использууйуте `/help` и посмотрите на административные команды!.") - .setColor(this.client.config.embed.color) + .setColor(client.config.embed.color) .setFooter({ - text: this.client.config.embed.footer + text: client.config.embed.footer }) .setTimestamp(); messageOptions.embed = thanksEmbed; @@ -55,8 +56,8 @@ class GuildCreate extends BaseEvent { iconURL: guild.iconURL() }) .setColor("#32CD32") - .setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${this.client.getNoun(users, this.client.translate("misc:NOUNS:USERS:1"), this.client.translate("misc:NOUNS:USERS:2"), this.client.translate("misc:NOUNS:USERS:5"))} (из них **${bots}** ${this.client.getNoun(bots, this.client.translate("misc:NOUNS:BOTS:1"), this.client.translate("misc:NOUNS:BOTS:2"), this.client.translate("misc:NOUNS:BOTS:5"))})`); - this.client.channels.cache.get(this.client.config.support.logs).send({ + .setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${client.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))} и **${bots}** ${client.getNoun(bots, client.translate("misc:NOUNS:BOTS:1"), client.translate("misc:NOUNS:BOTS:2"), client.translate("misc:NOUNS:BOTS:5"))}`); + client.channels.cache.get(client.config.support.logs).send({ embeds: [embed] }); } diff --git a/events/Guild/guildDelete.js b/events/Guild/guildDelete.js index 13ff80bd..56a438b4 100644 --- a/events/Guild/guildDelete.js +++ b/events/Guild/guildDelete.js @@ -8,11 +8,13 @@ class GuildDelete extends BaseEvent { once: false }); } + /** * + * @param {import("../../base/JaBa")} client * @param {import("discord.js").Guild} guild */ - async execute(guild) { + async execute(client, guild) { const embed = new EmbedBuilder() .setAuthor({ name: guild.name, @@ -20,7 +22,7 @@ class GuildDelete extends BaseEvent { }) .setColor("#B22222") .setDescription(`Вышел с сервера **${guild.name}**.`); - this.client.channels.cache.get(this.client.config.support.logs).send({ + client.channels.cache.get(client.config.support.logs).send({ embeds: [embed] }); } diff --git a/events/Guild/guildMemberAdd.js b/events/Guild/guildMemberAdd.js index d257cd3e..714037c2 100644 --- a/events/Guild/guildMemberAdd.js +++ b/events/Guild/guildMemberAdd.js @@ -26,19 +26,20 @@ class GuildMemberAdd extends BaseEvent { /** * + * @param {import("../../base/JaBa")} client * @param {import("discord.js").GuildMember} member */ - async execute(member) { + async execute(client, member) { if (member.guild && member.guild.id === "568120814776614924") return; await member.guild.members.fetch(); - const guildData = await this.client.findOrCreateGuild({ + const guildData = await client.findOrCreateGuild({ id: member.guild.id }); member.guild.data = guildData; - const memberData = await this.client.findOrCreateMember({ + const memberData = await client.findOrCreateMember({ id: member.id, guildID: member.guild.id }); @@ -63,7 +64,7 @@ class GuildMemberAdd extends BaseEvent { .replace(/{user}/g, member) .replace(/{server}/g, member.guild.name) .replace(/{membercount}/g, member.guild.memberCount) - .replace(/{createdat}/g, this.client.printDate(member.user.createdAt)); + .replace(/{createdat}/g, client.printDate(member.user.createdAt)); if (guildData.plugins.welcome.withImage) { const canvas = Canvas.createCanvas(1024, 450), ctx = canvas.getContext("2d"); @@ -96,13 +97,13 @@ class GuildMemberAdd extends BaseEvent { ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250); // Draw server name - ctx.font = applyText(canvas, member.guild.translate("administration/welcome:IMG_WELCOME", { + ctx.font = applyText(canvas, client.translate("administration/welcome:IMG_WELCOME", { server: member.guild.name - }), 53, 625, "RubikMonoOne"); + }, member.guild.data.language), 53, 625, "RubikMonoOne"); - ctx.fillText(member.guild.translate("administration/welcome:IMG_WELCOME", { + ctx.fillText(client.translate("administration/welcome:IMG_WELCOME", { server: member.guild.name - }), canvas.width - 700, canvas.height - 70); + }, member.guild.data.language), canvas.width - 700, canvas.height - 70); // Draw discriminator ctx.font = "35px RubikMonoOne"; @@ -110,7 +111,7 @@ class GuildMemberAdd extends BaseEvent { // Draw membercount ctx.font = "22px RubikMonoOne"; - ctx.fillText(`${member.guild.memberCount}й ${member.guild.translate("misc:NOUNS:MEMBERS:1")}`, 40, canvas.height - 35); + ctx.fillText(`${member.guild.memberCount}й ${client.translate("misc:NOUNS:MEMBERS:1", null, member.guild.data.language)}`, 40, canvas.height - 35); // Draw # for discriminator ctx.fillStyle = "#FFFFFF"; @@ -121,9 +122,9 @@ class GuildMemberAdd extends BaseEvent { ctx.font = "45px RubikMonoOne"; ctx.strokeStyle = "#000000"; ctx.lineWidth = 10; - ctx.strokeText(member.guild.translate("administration/welcome:TITLE"), canvas.width - 670, canvas.height - 330); + ctx.strokeText(client.translate("administration/welcome:TITLE", null, member.guild.data.language), canvas.width - 670, canvas.height - 330); ctx.fillStyle = "#FFFFFF"; - ctx.fillText(member.guild.translate("administration/welcome:TITLE"), canvas.width - 670, canvas.height - 330); + ctx.fillText(client.translate("administration/welcome:TITLE", null, member.guild.data.language), canvas.width - 670, canvas.height - 330); // Draw avatar circle ctx.beginPath(); @@ -133,8 +134,8 @@ class GuildMemberAdd extends BaseEvent { ctx.stroke(); ctx.closePath(); ctx.clip(); - const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ - format: "png", + const avatar = await Canvas.loadImage(member.displayAvatarURL({ + extension: "jpg", size: 512 })); ctx.drawImage(avatar, 45, 90, 270, 270); diff --git a/events/Guild/guildMemberRemove.js b/events/Guild/guildMemberRemove.js index e0b3427b..3356be89 100644 --- a/events/Guild/guildMemberRemove.js +++ b/events/Guild/guildMemberRemove.js @@ -26,14 +26,15 @@ class GuildMemberRemove extends BaseEvent { /** * + * @param {import("../../base/JaBa")} client * @param {import("discord.js").GuildMember} member */ - async execute(member) { + async execute(client, member) { if (member.guild && member.guild.id === "568120814776614924") return; await member.guild.members.fetch(); - const guildData = await this.client.findOrCreateGuild({ + const guildData = await client.findOrCreateGuild({ id: member.guild.id }); member.guild.data = guildData; @@ -46,7 +47,7 @@ class GuildMemberRemove extends BaseEvent { .replace(/{user}/g, member.user.tag) .replace(/{server}/g, member.guild.name) .replace(/{membercount}/g, member.guild.memberCount) - .replace(/{createdat}/g, this.client.printDate(member.user.createdAt)); + .replace(/{createdat}/g, client.printDate(member.user.createdAt)); if (guildData.plugins.goodbye.withImage) { const canvas = Canvas.createCanvas(1024, 450), ctx = canvas.getContext("2d"); @@ -79,13 +80,13 @@ class GuildMemberRemove extends BaseEvent { ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250); // Draw server name - ctx.font = applyText(canvas, member.guild.translate("administration/goodbye:IMG_GOODBYE", { + ctx.font = applyText(canvas, client.translate("administration/goodbye:IMG_GOODBYE", { server: member.guild.name - }), 53, 625, "RubikMonoOne"); + }, member.guild.data.language), 53, 625, "RubikMonoOne"); - ctx.fillText(member.guild.translate("administration/goodbye:IMG_GOODBYE", { + ctx.fillText(client.translate("administration/goodbye:IMG_GOODBYE", { server: member.guild.name - }), canvas.width - 700, canvas.height - 70); + }, member.guild.data.language), canvas.width - 700, canvas.height - 70); // Draw discriminator ctx.font = "35px RubikMonoOne"; @@ -93,7 +94,7 @@ class GuildMemberRemove extends BaseEvent { // Draw membercount ctx.font = "22px RubikMonoOne"; - ctx.fillText(`${member.guild.memberCount} ${this.client.getNoun(member.guild.memberCount, member.guild.translate("misc:NOUNS:MEMBERS:1"), member.guild.translate("misc:NOUNS:MEMBERS:2"), member.guild.translate("misc:NOUNS:MEMBERS:5"))}`, 40, canvas.height - 35); + ctx.fillText(`${member.guild.memberCount} ${client.getNoun(member.guild.memberCount, client.translate("misc:NOUNS:MEMBERS:1", null, member.guild.data.language), client.translate("misc:NOUNS:MEMBERS:2", null, member.guild.data.language), client.translate("misc:NOUNS:MEMBERS:5", null, member.guild.data.language))}`, 40, canvas.height - 35); // Draw # for discriminator ctx.fillStyle = "#FFFFFF"; @@ -104,9 +105,9 @@ class GuildMemberRemove extends BaseEvent { ctx.font = "45px RubikMonoOne"; ctx.strokeStyle = "#000000"; ctx.lineWidth = 10; - ctx.strokeText(member.guild.translate("administration/goodbye:TITLE"), canvas.width - 670, canvas.height - 330); + ctx.strokeText(client.translate("administration/goodbye:TITLE", null, member.guild.data.language), canvas.width - 670, canvas.height - 330); ctx.fillStyle = "#FFFFFF"; - ctx.fillText(member.guild.translate("administration/goodbye:TITLE"), canvas.width - 670, canvas.height - 330); + ctx.fillText(client.translate("administration/goodbye:TITLE", null, member.guild.data.language), canvas.width - 670, canvas.height - 330); // Draw avatar circle ctx.beginPath(); @@ -116,8 +117,8 @@ class GuildMemberRemove extends BaseEvent { ctx.stroke(); ctx.closePath(); ctx.clip(); - const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ - format: "png", + const avatar = await Canvas.loadImage(member.displayAvatarURL({ + extension: "png", size: 512 })); ctx.drawImage(avatar, 45, 90, 270, 270); diff --git a/events/Guild/guildMemberUpdate.js b/events/Guild/guildMemberUpdate.js index 1ac6bd41..9f4bdf11 100644 --- a/events/Guild/guildMemberUpdate.js +++ b/events/Guild/guildMemberUpdate.js @@ -10,16 +10,17 @@ class GuildMemberUpdate extends BaseEvent { /** * + * @param {import("../../base/JaBa")} client * @param {import("discord.js").GuildMember} oldMember * @param {import("discord.js").GuildMember} newMember */ - async execute(oldMember, newMember) { + async execute(client, oldMember, newMember) { if (oldMember.guild && oldMember.guild.id === "568120814776614924") return; - - if (oldMember.guild.id !== this.client.config.support.id) return; + if (oldMember.guild.id !== client.config.support.id) return; if (oldMember.roles.cache.some((r) => r.name === "Поддержавшие JaBa")) return; - if (newMember.roles.cache.some((r) => r.name === "Поддержавшие JaBa")) { - const userData = await this.client.findOrCreateUser({ + + if (newMember?.roles.cache.some((r) => r.name === "Поддержавшие JaBa")) { + const userData = await client.findOrCreateUser({ id: newMember.id }); userData.achievements.tip.progress.now = 1; diff --git a/helpers/birthdays.js b/helpers/birthdays.js index 0e288e78..b6a2fea6 100644 --- a/helpers/birthdays.js +++ b/helpers/birthdays.js @@ -30,8 +30,8 @@ module.exports.init = async function (client) { .setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ - size: 512, - format: "png" + extension: "png", + size: 512 }) }) .setColor(client.config.embed.color) diff --git a/languages/ru-RU/moderation/announcement.json b/languages/ru-RU/moderation/announcement.json deleted file mode 100644 index 01275cc7..00000000 --- a/languages/ru-RU/moderation/announcement.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "DESCRIPTION": "Отправить объявление в текущий канал!", - "USAGE": "announcement [текст]", - "EXAMPLES": "announcement Новый модератор!", - "MISSING_TEXT": "Укажите текст!", - "TOO_LONG": "Текст должен быть короче 1030 символов!", - "MENTION_PROMPT": "Хотите добавить упоминание к вашему сообщению?\nОтправьте `да` или `нет`!", - "MENTION_TYPE_PROMPT": "Выберите упоминание *@*everyone написав `everyone`, либо *@*here написав `here`!", - "TITLE": "📢 Объявление:" -} \ No newline at end of file diff --git a/languages/ru-RU/music/clip.json b/languages/ru-RU/music/clip.json deleted file mode 100644 index 40894388..00000000 --- a/languages/ru-RU/music/clip.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "DESCRIPTION": "Воспроизвести клип", - "USAGE": "clip [название-файла]", - "EXAMPLES": "clip haha", - "NO_ARG": "Укажите название файла!", - "NO_FILE": "Файл {{file}} отсутствует!", - "ACTIVE_QUEUE": "Не могу воспроизвести клип, т.к. на сервере есть активная очередь!", - "ACTIVE_CLIP": "Уже воспроизводится какой-то файл!" -} \ No newline at end of file diff --git a/languages/ru-RU/music/clips.json b/languages/ru-RU/music/clips.json index 04d8b9e8..11b5790f 100644 --- a/languages/ru-RU/music/clips.json +++ b/languages/ru-RU/music/clips.json @@ -1,6 +1,7 @@ { - "DESCRIPTION": "Показать список доступных звуков", + "DESCRIPTION": "Показать список доступных звуков и воспроизвести выбранный", "USAGE": "clips", "EXAMPLES": "clips", - "EMBED_TITLE": "**Список клипов**" + "AVAILABLE_CLIPS": "Список доступных клипов:", + "PLAYING": "Начато проигрывание клипа `{{clip}}`" } \ No newline at end of file diff --git a/languages/ru-RU/music/jump.json b/languages/ru-RU/music/jump.json index 767c0982..48a412cc 100644 --- a/languages/ru-RU/music/jump.json +++ b/languages/ru-RU/music/jump.json @@ -2,6 +2,6 @@ "DESCRIPTION": "Перейти на заданный трек", "USAGE": "jump [номер]", "EXAMPLES": "jump 3", - "NO_PREV_SONG": "Вы не можете перейти назад, для этого используйте команду `back`!", - "SUCCESS": "Играет выбранный трек!" + "POSITION": "Номер трека в очереди", + "NO_PREV_SONG": "Вы не можете перейти назад, для этого используйте команду `back`!" } \ No newline at end of file diff --git a/languages/ru-RU/music/loop.json b/languages/ru-RU/music/loop.json index ea337ea9..bcd5d70c 100644 --- a/languages/ru-RU/music/loop.json +++ b/languages/ru-RU/music/loop.json @@ -1,8 +1,10 @@ { - "DESCRIPTION": "Включить или отключить повтор очереди/одного трека!", - "USAGE": "loop (queue/all/song/single)", - "EXAMPLES": "loop queue\nloop single", - "QUEUE": "Повтор очереди **включён**!", - "SONG": "Повтор текущего трека **включён**!", + "DESCRIPTION": "Включить или отключить повтор очереди/одного трека", + "USAGE": "loop", + "EXAMPLES": "loop", + "QUEUE": "Очередь", + "SONG": "Текущий трек", + "QUEUE_ENABLED": "Повтор очереди **включён**!", + "SONG_ENABLED": "Повтор текущего трека **включён**!", "DISABLED": "Повтор **отключён**!" } \ No newline at end of file diff --git a/languages/ru-RU/music/np.json b/languages/ru-RU/music/nowplaying.json similarity index 86% rename from languages/ru-RU/music/np.json rename to languages/ru-RU/music/nowplaying.json index 92e22c4c..eb1a3efc 100644 --- a/languages/ru-RU/music/np.json +++ b/languages/ru-RU/music/nowplaying.json @@ -1,7 +1,7 @@ { - "DESCRIPTION": "Показать информацию о играющем сейчас треке!", - "USAGE": "np", - "EXAMPLES": "np", + "DESCRIPTION": "Показать информацию о играющем сейчас треке", + "USAGE": "nowplaying", + "EXAMPLES": "nowplaying", "CURRENTLY_PLAYING": "Сейчас играет", "T_TITLE": "Название", "T_CHANNEL": "Канал", diff --git a/languages/ru-RU/music/pause.json b/languages/ru-RU/music/pause.json deleted file mode 100644 index 808898e0..00000000 --- a/languages/ru-RU/music/pause.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "DESCRIPTION": "Поставить воспроизведение очереди на паузу!", - "USAGE": "pause", - "EXAMPLES": "pause", - "SUCCESS": "⏸️ Воспроизведение очереди приостановлено." -} \ No newline at end of file diff --git a/languages/ru-RU/music/play.json b/languages/ru-RU/music/play.json index 3ffc330a..ffe0a823 100644 --- a/languages/ru-RU/music/play.json +++ b/languages/ru-RU/music/play.json @@ -1,10 +1,10 @@ { - "DESCRIPTION": "Начать воспроизведение трека!", + "DESCRIPTION": "Начать воспроизведение трека", "USAGE": "play [название-трека/ссылка]", "EXAMPLES": "play Never Gonna Give You Up", + "LINK": "Название/Прямая ссылка/Ссылка на YouTube, Spotify или SoundCloud", "NO_VOICE_CHANNEL": "Вы должны находиться в голосовом канале!", "VOICE_CHANNEL_CONNECT": "Я не могу присоедениться к вашему голосовому каналу!", - "MISSING_SONG_NAME": "Укажите название трека или ссылку на него!", "RESULTS_FOOTER": "Укажите число от 1 до 10 (без префикса).", "NO_RESULT": "Ничего не найдено!", "NOW_PLAYING": "Сейчас играет **{{songName}}**", diff --git a/languages/ru-RU/music/queue.json b/languages/ru-RU/music/queue.json index 60e18481..a0bf4a05 100644 --- a/languages/ru-RU/music/queue.json +++ b/languages/ru-RU/music/queue.json @@ -3,5 +3,8 @@ "USAGE": "queue", "EXAMPLES": "queue", "TITLE": "Очередь", + "PREVIOUS": "Пред. страница", + "NEXT": "След. страница", + "PAGE": "Страница", "ADDED": "Добавил" } \ No newline at end of file diff --git a/languages/ru-RU/music/resume.json b/languages/ru-RU/music/resume.json deleted file mode 100644 index 02c1e29e..00000000 --- a/languages/ru-RU/music/resume.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "DESCRIPTION": "Продолжает воспроизведение очереди!", - "USAGE": "resume", - "EXAMPLES": "resume", - "SUCCESS": "▶️ Воспроизведение очереди продолжается!" -} \ No newline at end of file diff --git a/languages/ru-RU/music/seek.json b/languages/ru-RU/music/seek.json index 0a7c416f..93b22a39 100644 --- a/languages/ru-RU/music/seek.json +++ b/languages/ru-RU/music/seek.json @@ -1,7 +1,7 @@ { - "DESCRIPTION": "Перемотать вперед или назад на данное время в текущем треке!", + "DESCRIPTION": "Перемотать вперед или назад на данное время в текущем треке", "USAGE": "seek [время]", "EXAMPLES": "seek 10s\nseek -10s", "INVALID_TIME": "Укажите время!", - "SUCCESS": "▶️ Трек перемотан!" + "SUCCESS": "Трек перемотан на {{time}}!" } \ No newline at end of file diff --git a/languages/ru-RU/owner/announcement.json b/languages/ru-RU/owner/announcement.json new file mode 100644 index 00000000..ce26621f --- /dev/null +++ b/languages/ru-RU/owner/announcement.json @@ -0,0 +1,8 @@ +{ + "DESCRIPTION": "Отправить объявление на все сервера где есть JaBa", + "USAGE": "announcement [текст]", + "EXAMPLES": "announcement Обновление v1.0!", + "TOO_LONG": "Текст должен быть короче 1000 символов!", + "TITLE": "📢 Объявление:", + "SENDED": "Обновление отправлено на все сервера!" +} \ No newline at end of file diff --git a/languages/ru-RU/owner/reload.json b/languages/ru-RU/owner/reload.json index b71f43bc..e3520e35 100644 --- a/languages/ru-RU/owner/reload.json +++ b/languages/ru-RU/owner/reload.json @@ -2,5 +2,6 @@ "DESCRIPTION": "Перезагрузить команду!", "COMMAND": "Команда", "EXAMPLES": "reload help", + "AVAILABLE_COMMANDS": "Доступные команды:", "SUCCESS": "Команда `{{command}}` успешно перезагружена!" } \ No newline at end of file diff --git a/languages/uk-UA/moderation/announcement.json b/languages/uk-UA/owner/announcement.json similarity index 100% rename from languages/uk-UA/moderation/announcement.json rename to languages/uk-UA/owner/announcement.json diff --git a/package-lock.json b/package-lock.json index a4d2dcb1..2f9783d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "jaba", - "version": "TEST", + "version": "4.0pre1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "jaba", - "version": "TEST", + "version": "4.0pre1", "license": "ISC", "dependencies": { "@discordjs/opus": "^0.8.0", @@ -24,11 +24,11 @@ "chalk": "^4.1.0", "colors-generator": "^0.3.4", "cron": "^1.7.2", - "customizable-discordjs-pagination": "^1.3.1", "discord-api-types": "^0.37.0", "discord-giveaways": "^6.0.0", "discord-together": "^1.3.3", - "discord.js": "^14.1.1", + "discord.js": "^14.1.2", + "discord.js-embed-pagination": "^1.0.2", "distube": "^4.0.3", "ejs": "^3.1.3", "express": "^4.17.1", @@ -37,6 +37,7 @@ "gamedig": "^4.0.2", "i18next": "^20.2.2", "i18next-node-fs-backend": "^2.1.3", + "libsodium-wrappers": "^0.7.10", "markdown-table": "2.0.0", "mathjs": "^9.0.0", "md5": "^2.2.1", @@ -1305,11 +1306,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/customizable-discordjs-pagination": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/customizable-discordjs-pagination/-/customizable-discordjs-pagination-1.3.1.tgz", - "integrity": "sha512-6kjYOWKi+4zNs3Os3MvOi2ZqGFmMZgbhXOJRQszbEkAJTvpVtbhzPoDsU222QMk5HfmV2y10NOO9bjpDrRTS/w==" - }, "node_modules/dargs": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", @@ -1521,9 +1517,9 @@ "integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg==" }, "node_modules/discord.js": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.1.1.tgz", - "integrity": "sha512-6Oa2f+Y0+s6B5HTTqcAP7Z6tUmguNTKpzbuTmE1JIeT/aUTr9dVe397D/bvcBSRpJERQzMyEWyEiVQnMRHcx4A==", + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.1.2.tgz", + "integrity": "sha512-apdWNLkjAkeEnuNpB8H6rS/4OgrXQlSAjuuzeodjCOdIXy3OwOjD314V/HiSttcAlr9+r3ONhaT5qvbDad5SIg==", "dependencies": { "@discordjs/builders": "^1.1.0", "@discordjs/collection": "^1.0.1", @@ -1541,6 +1537,11 @@ "node": ">=16.9.0" } }, + "node_modules/discord.js-embed-pagination": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/discord.js-embed-pagination/-/discord.js-embed-pagination-1.0.2.tgz", + "integrity": "sha512-TgGCsJg0G49q9IIMB18AncJ8u0a6TmpFdsA74uMRGEYyt3sa34JBEwxY4KuZK30tQDxPmb3N8GPCoiUg7gpJ+w==" + }, "node_modules/discord.js/node_modules/discord-api-types": { "version": "0.36.3", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz", @@ -2975,6 +2976,19 @@ "node": ">= 0.8.0" } }, + "node_modules/libsodium": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz", + "integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ==" + }, + "node_modules/libsodium-wrappers": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.10.tgz", + "integrity": "sha512-pO3F1Q9NPLB/MWIhehim42b/Fwb30JNScCNh8TcQ/kIc+qGLQch8ag8wb0keK3EP5kbGakk1H8Wwo7v+36rNQg==", + "dependencies": { + "libsodium": "^0.7.0" + } + }, "node_modules/lodash.deburr": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz", @@ -5709,11 +5723,6 @@ "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz", "integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==" }, - "customizable-discordjs-pagination": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/customizable-discordjs-pagination/-/customizable-discordjs-pagination-1.3.1.tgz", - "integrity": "sha512-6kjYOWKi+4zNs3Os3MvOi2ZqGFmMZgbhXOJRQszbEkAJTvpVtbhzPoDsU222QMk5HfmV2y10NOO9bjpDrRTS/w==" - }, "dargs": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", @@ -5871,9 +5880,9 @@ } }, "discord.js": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.1.1.tgz", - "integrity": "sha512-6Oa2f+Y0+s6B5HTTqcAP7Z6tUmguNTKpzbuTmE1JIeT/aUTr9dVe397D/bvcBSRpJERQzMyEWyEiVQnMRHcx4A==", + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.1.2.tgz", + "integrity": "sha512-apdWNLkjAkeEnuNpB8H6rS/4OgrXQlSAjuuzeodjCOdIXy3OwOjD314V/HiSttcAlr9+r3ONhaT5qvbDad5SIg==", "requires": { "@discordjs/builders": "^1.1.0", "@discordjs/collection": "^1.0.1", @@ -5895,6 +5904,11 @@ } } }, + "discord.js-embed-pagination": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/discord.js-embed-pagination/-/discord.js-embed-pagination-1.0.2.tgz", + "integrity": "sha512-TgGCsJg0G49q9IIMB18AncJ8u0a6TmpFdsA74uMRGEYyt3sa34JBEwxY4KuZK30tQDxPmb3N8GPCoiUg7gpJ+w==" + }, "distube": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/distube/-/distube-4.0.3.tgz", @@ -6993,6 +7007,19 @@ "type-check": "~0.4.0" } }, + "libsodium": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.10.tgz", + "integrity": "sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ==" + }, + "libsodium-wrappers": { + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.10.tgz", + "integrity": "sha512-pO3F1Q9NPLB/MWIhehim42b/Fwb30JNScCNh8TcQ/kIc+qGLQch8ag8wb0keK3EP5kbGakk1H8Wwo7v+36rNQg==", + "requires": { + "libsodium": "^0.7.0" + } + }, "lodash.deburr": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz", diff --git a/package.json b/package.json index 591f4e51..a992d59b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jaba", - "version": "TEST", - "description": "A very complete Discord bot (more than 100 commands) that uses the Discord.js", + "version": "4.0pre1", + "description": "My Discord Bot", "main": "index.js", "private": true, "scripts": { @@ -27,11 +27,11 @@ "chalk": "^4.1.0", "colors-generator": "^0.3.4", "cron": "^1.7.2", - "customizable-discordjs-pagination": "^1.3.1", "discord-api-types": "^0.37.0", "discord-giveaways": "^6.0.0", "discord-together": "^1.3.3", - "discord.js": "^14.1.1", + "discord.js": "^14.1.2", + "discord.js-embed-pagination": "^1.0.2", "distube": "^4.0.3", "ejs": "^3.1.3", "express": "^4.17.1", @@ -40,6 +40,7 @@ "gamedig": "^4.0.2", "i18next": "^20.2.2", "i18next-node-fs-backend": "^2.1.3", + "libsodium-wrappers": "^0.7.10", "markdown-table": "2.0.0", "mathjs": "^9.0.0", "md5": "^2.2.1",