Перенесена категория Music

Мелкие правки
This commit is contained in:
JonnyBro 2022-08-02 17:18:47 +05:00
parent 34193eea44
commit ed8cc4f0be
68 changed files with 1054 additions and 926 deletions

View file

@ -54,8 +54,8 @@ class Money extends Command {
username: member.user.username username: member.user.username
}), }),
iconURL: member.user.displayAvatarURL({ iconURL: member.user.displayAvatarURL({
size: 512, extension: "png",
format: "png" size: 512
}) })
}) })
.addFields([ .addFields([

View file

@ -57,8 +57,8 @@ class Profile extends Command {
username: member.user.tag username: member.user.tag
}), }),
iconURL: member.user.displayAvatarURL({ iconURL: member.user.displayAvatarURL({
size: 512, extension: "png",
format: "png" size: 512
}) })
}) })
.setImage("attachment://achievements.png") .setImage("attachment://achievements.png")

View file

@ -22,8 +22,8 @@ class Transactions extends Command {
.setAuthor({ .setAuthor({
name: message.translate("economy/transactions:EMBED_TRANSACTIONS"), name: message.translate("economy/transactions:EMBED_TRANSACTIONS"),
iconURL: message.author.displayAvatarURL({ iconURL: message.author.displayAvatarURL({
size: 512, extension: "png",
format: "png" size: 512
}) })
}) })
.setColor(data.config.embed.color) .setColor(data.config.embed.color)

View file

@ -43,8 +43,8 @@ class Work extends Command {
.setFooter({ .setFooter({
text: message.translate("economy/work:AWARD"), text: message.translate("economy/work:AWARD"),
iconURL: message.author.displayAvatarURL({ iconURL: message.author.displayAvatarURL({
size: 512, extension: "png",
format: "png" size: 512
}) })
}) })
.setColor(data.config.embed.color); .setColor(data.config.embed.color);

View file

@ -36,8 +36,8 @@ class Report extends Command {
user: member.user.tag user: member.user.tag
}), }),
iconURL: message.author.displayAvatarURL({ iconURL: message.author.displayAvatarURL({
size: 512, extension: "png",
format: "png" size: 512
}) })
}) })
.addFields([ .addFields([

View file

@ -32,8 +32,8 @@ class Suggest extends Command {
user: message.author.username user: message.author.username
}), }),
iconURL: message.author.displayAvatarURL({ iconURL: message.author.displayAvatarURL({
extension: "png",
size: 512, size: 512,
format: "png"
}) })
}) })
.addFields([ .addFields([

View file

@ -43,8 +43,8 @@ class Userinfo extends Command {
.setAuthor({ .setAuthor({
name: `${user.tag} (${user.id})`, name: `${user.tag} (${user.id})`,
iconURL: user.displayAvatarURL({ iconURL: user.displayAvatarURL({
size: 512, extension: "png",
format: "png" size: 512
}) })
}) })
.setThumbnail(user.displayAvatarURL()) .setThumbnail(user.displayAvatarURL())
@ -72,8 +72,8 @@ class Userinfo extends Command {
{ {
name: this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"), name: this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"),
value: member.displayAvatarURL({ value: member.displayAvatarURL({
size: 512, extension: "png",
format: "png" size: 512
}) })
} }
]) ])

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

115
TO REWRITE/queue.js Normal file
View file

@ -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;

View file

@ -42,11 +42,6 @@ module.exports = mongoose.model("Guild", new Schema({
kick: false, // The number of warns required to kick the user kick: false, // The number of warns required to kick the user
ban: false // The number of warns required to ban 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 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 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 birthdays: false, // the channel in which birtdays announcements will be sent

View file

@ -90,7 +90,7 @@ class JaBa extends Client {
.on("searchResult", (message, result) => { .on("searchResult", (message, result) => {
let i = 0; let i = 0;
const embed = new EmbedBuilder() 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) }) .setFooter({ text: this.translate("music/play:RESULTS_FOOTER", null, message.guild.data.language) })
.setColor(this.config.embed.color); .setColor(this.config.embed.color);
message.reply({ embeds: [embed] }); message.reply({ embeds: [embed] });

View file

@ -40,7 +40,7 @@ class Lovecalc extends BaseCommand {
*/ */
async execute(client, interaction) { async execute(client, interaction) {
const firstMember = interaction.options.getMember("first_member"); 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 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}`); const hash = md5(`${members[0].id}${members[1].user.username}${members[0].user.username}${members[1].id}`);

View file

@ -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"), const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch"); fetch = require("node-fetch");
@ -54,6 +54,7 @@ class Memes extends BaseCommand {
}); });
const collector = new InteractionCollector(client, { const collector = new InteractionCollector(client, {
componentType: ComponentType.SelectMenu,
message: msg, message: msg,
idle: 60 * 1000 idle: 60 * 1000
}); });
@ -71,7 +72,7 @@ class Memes extends BaseCommand {
.setImage(res.url) .setImage(res.url)
.setTimestamp(); .setTimestamp();
msg.update({ await msg.update({
embeds: [embed] embeds: [embed]
}); });
}); });

View file

@ -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"); { defaultApplications } = require("../../helpers/discordTogether");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
@ -60,6 +60,7 @@ class Activity extends BaseCommand {
}); });
const collector = new InteractionCollector(client, { const collector = new InteractionCollector(client, {
componentType: ComponentType.SelectMenu,
message: msg, message: msg,
idle: 60 * 1000 idle: 60 * 1000
}); });
@ -77,7 +78,7 @@ class Activity extends BaseCommand {
}) })
.setTimestamp(); .setTimestamp();
msg.update({ await msg.update({
embeds: [embed], embeds: [embed],
components: [] components: []
}); });

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class Help extends BaseCommand { class Help extends BaseCommand {
@ -48,7 +48,7 @@ class Help extends BaseCommand {
commands.forEach(c => { commands.forEach(c => {
if (!categories.includes(c.category)) { 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); categories.push(c.category);
} }
}); });
@ -75,6 +75,7 @@ class Help extends BaseCommand {
}); });
const collector = new InteractionCollector(client, { const collector = new InteractionCollector(client, {
componentType: ComponentType.SelectMenu,
message: msg, message: msg,
idle: 60 * 1000 idle: 60 * 1000
}); });
@ -107,7 +108,7 @@ class Help extends BaseCommand {
}); });
} else { } else {
const embed = generateCommandHelp(client, interaction, arg); const embed = generateCommandHelp(client, interaction, arg);
return msg.update({ await msg.update({
content: null, content: null,
components: [], components: [],
embeds: [embed] embeds: [embed]

View file

@ -35,8 +35,8 @@ class Warn extends BaseCommand {
const memberPosition = member.roles.highest.position; const memberPosition = member.roles.highest.position;
const moderationPosition = interaction.member.roles.highest.position; const moderationPosition = interaction.member.roles.highest.position;
if (member.user.bot) return; if (member.user.bot) return;
if (member.id === interaction.user.id) return interaction.error("moderation/warn:YOURSELF"); if (member.id === interaction.member.id) return interaction.error("moderation/warn:YOURSELF");
if (interaction.guild.ownerId !== interaction.user.id && !(moderationPosition > memberPosition)) return interaction.error("moderation/ban:SUPERIOR"); if (interaction.guild.ownerId !== interaction.member.id && !(moderationPosition > memberPosition)) return interaction.error("moderation/ban:SUPERIOR");
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
@ -60,7 +60,7 @@ class Warn extends BaseCommand {
const submitted = await interaction.awaitModalSubmit({ const submitted = await interaction.awaitModalSubmit({
time: 120000, time: 120000,
filter: i => i.user.id === interaction.user.id, filter: i => i.user.id === interaction.member.id,
}); });
if (submitted) { if (submitted) {
@ -74,7 +74,7 @@ class Warn extends BaseCommand {
data.guildData.save(); data.guildData.save();
const caseInfo = { const caseInfo = {
moderator: interaction.user.id, moderator: interaction.member.id,
date: Date.now(), date: Date.now(),
type: "warn", type: "warn",
case: data.guildData.casesCount, case: data.guildData.casesCount,

View file

@ -45,8 +45,8 @@ class Warns extends BaseCommand {
member: member.nickname || member.user.username member: member.nickname || member.user.username
}), }),
iconURL: member.displayAvatarURL({ iconURL: member.displayAvatarURL({
size: 512, extension: "png",
format: "png" size: 512
}) })
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)

View file

@ -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;

59
commands/Music/back.js Normal file
View file

@ -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;

114
commands/Music/clips.js Normal file
View file

@ -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;

65
commands/Music/jump.js Normal file
View file

@ -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;

90
commands/Music/loop.js Normal file
View file

@ -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;

View file

@ -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;

64
commands/Music/play.js Normal file
View file

@ -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;

54
commands/Music/seek.js Normal file
View file

@ -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;

61
commands/Music/skip.js Normal file
View file

@ -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;

57
commands/Music/stop.js Normal file
View file

@ -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;

View file

@ -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"), const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch"); fetch = require("node-fetch");
@ -57,6 +57,7 @@ class NSFW extends BaseCommand {
}); });
const collector = new InteractionCollector(client, { const collector = new InteractionCollector(client, {
componentType: ComponentType.SelectMenu,
message: msg, message: msg,
idle: 60 * 1000 idle: 60 * 1000
}); });
@ -74,7 +75,7 @@ class NSFW extends BaseCommand {
.setImage(res.url) .setImage(res.url)
.setTimestamp(); .setTimestamp();
msg.update({ await msg.update({
embeds: [embed] embeds: [embed]
}); });
}); });

View file

@ -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;

View file

@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
const { SlashCommandBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
@ -26,7 +25,7 @@ class Eval extends BaseCommand {
* *
* @param {import("../../base/JaBa")} client * @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 {import("discord.js").ChatInputCommandInteraction} interaction
* @param {Array} data * @param {Array} data
*/ */
// eslint-disable-next-line no-unused-vars
async execute(client, interaction, data) { async execute(client, interaction, data) {
const code = interaction.options.getString("code"); const code = interaction.options.getString("code");
const result = new Promise((resolve) => resolve(eval(code))); const result = new Promise((resolve) => resolve(eval(code)));

View file

@ -46,9 +46,9 @@ class Servers extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.tag, name: interaction.user.tag,
iconURL: interaction.user.displayAvatarURL({ iconURL: interaction.member.displayAvatarURL({
size: 512, extension: "png",
format: "png" size: 512
}) })
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
@ -124,7 +124,7 @@ class Servers extends BaseCommand {
if (reaction._emoji.name === "❌") return msg.delete(); if (reaction._emoji.name === "❌") return msg.delete();
await reaction.users.remove(interaction.user.id); await reaction.users.remove(interaction.member.id);
}); });
} }
} }

View file

@ -26,7 +26,7 @@ class CommandHandler extends BaseEvent {
data.userData = userData; data.userData = userData;
if (command.guildOnly && !interaction.inGuild()) return interaction.replyT("misc:GUILD_ONLY", { ephemeral: true }); 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()) { if (interaction.inGuild()) {
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({

View file

@ -11,12 +11,13 @@ class GuildCreate extends BaseEvent {
/** /**
* *
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").Guild} guild * @param {import("discord.js").Guild} guild
*/ */
async execute(guild) { async execute(client, guild) {
const messageOptions = {}; const messageOptions = {};
const userData = await this.client.findOrCreateUser({ const userData = await client.findOrCreateUser({
id: guild.ownerId id: guild.ownerId
}); });
@ -36,9 +37,9 @@ class GuildCreate extends BaseEvent {
name: "Спасибо что добавили меня на свой сервер!" name: "Спасибо что добавили меня на свой сервер!"
}) })
.setDescription("Чтобы получить список команд использууйуте `/help` и посмотрите на административные команды!.") .setDescription("Чтобы получить список команд использууйуте `/help` и посмотрите на административные команды!.")
.setColor(this.client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: this.client.config.embed.footer text: client.config.embed.footer
}) })
.setTimestamp(); .setTimestamp();
messageOptions.embed = thanksEmbed; messageOptions.embed = thanksEmbed;
@ -55,8 +56,8 @@ class GuildCreate extends BaseEvent {
iconURL: guild.iconURL() iconURL: guild.iconURL()
}) })
.setColor("#32CD32") .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"))})`); .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"))}`);
this.client.channels.cache.get(this.client.config.support.logs).send({ client.channels.cache.get(client.config.support.logs).send({
embeds: [embed] embeds: [embed]
}); });
} }

View file

@ -8,11 +8,13 @@ class GuildDelete extends BaseEvent {
once: false once: false
}); });
} }
/** /**
* *
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").Guild} guild * @param {import("discord.js").Guild} guild
*/ */
async execute(guild) { async execute(client, guild) {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: guild.name, name: guild.name,
@ -20,7 +22,7 @@ class GuildDelete extends BaseEvent {
}) })
.setColor("#B22222") .setColor("#B22222")
.setDescription(`Вышел с сервера **${guild.name}**.`); .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] embeds: [embed]
}); });
} }

View file

@ -26,19 +26,20 @@ class GuildMemberAdd extends BaseEvent {
/** /**
* *
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").GuildMember} member * @param {import("discord.js").GuildMember} member
*/ */
async execute(member) { async execute(client, member) {
if (member.guild && member.guild.id === "568120814776614924") return; if (member.guild && member.guild.id === "568120814776614924") return;
await member.guild.members.fetch(); await member.guild.members.fetch();
const guildData = await this.client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
id: member.guild.id id: member.guild.id
}); });
member.guild.data = guildData; member.guild.data = guildData;
const memberData = await this.client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildID: member.guild.id guildID: member.guild.id
}); });
@ -63,7 +64,7 @@ class GuildMemberAdd extends BaseEvent {
.replace(/{user}/g, member) .replace(/{user}/g, member)
.replace(/{server}/g, member.guild.name) .replace(/{server}/g, member.guild.name)
.replace(/{membercount}/g, member.guild.memberCount) .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) { if (guildData.plugins.welcome.withImage) {
const canvas = Canvas.createCanvas(1024, 450), const canvas = Canvas.createCanvas(1024, 450),
ctx = canvas.getContext("2d"); ctx = canvas.getContext("2d");
@ -96,13 +97,13 @@ class GuildMemberAdd extends BaseEvent {
ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250); ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250);
// Draw server name // 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 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 server: member.guild.name
}), canvas.width - 700, canvas.height - 70); }, member.guild.data.language), canvas.width - 700, canvas.height - 70);
// Draw discriminator // Draw discriminator
ctx.font = "35px RubikMonoOne"; ctx.font = "35px RubikMonoOne";
@ -110,7 +111,7 @@ class GuildMemberAdd extends BaseEvent {
// Draw membercount // Draw membercount
ctx.font = "22px RubikMonoOne"; 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 // Draw # for discriminator
ctx.fillStyle = "#FFFFFF"; ctx.fillStyle = "#FFFFFF";
@ -121,9 +122,9 @@ class GuildMemberAdd extends BaseEvent {
ctx.font = "45px RubikMonoOne"; ctx.font = "45px RubikMonoOne";
ctx.strokeStyle = "#000000"; ctx.strokeStyle = "#000000";
ctx.lineWidth = 10; 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.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 // Draw avatar circle
ctx.beginPath(); ctx.beginPath();
@ -133,8 +134,8 @@ class GuildMemberAdd extends BaseEvent {
ctx.stroke(); ctx.stroke();
ctx.closePath(); ctx.closePath();
ctx.clip(); ctx.clip();
const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ const avatar = await Canvas.loadImage(member.displayAvatarURL({
format: "png", extension: "jpg",
size: 512 size: 512
})); }));
ctx.drawImage(avatar, 45, 90, 270, 270); ctx.drawImage(avatar, 45, 90, 270, 270);

View file

@ -26,14 +26,15 @@ class GuildMemberRemove extends BaseEvent {
/** /**
* *
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").GuildMember} member * @param {import("discord.js").GuildMember} member
*/ */
async execute(member) { async execute(client, member) {
if (member.guild && member.guild.id === "568120814776614924") return; if (member.guild && member.guild.id === "568120814776614924") return;
await member.guild.members.fetch(); await member.guild.members.fetch();
const guildData = await this.client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
id: member.guild.id id: member.guild.id
}); });
member.guild.data = guildData; member.guild.data = guildData;
@ -46,7 +47,7 @@ class GuildMemberRemove extends BaseEvent {
.replace(/{user}/g, member.user.tag) .replace(/{user}/g, member.user.tag)
.replace(/{server}/g, member.guild.name) .replace(/{server}/g, member.guild.name)
.replace(/{membercount}/g, member.guild.memberCount) .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) { if (guildData.plugins.goodbye.withImage) {
const canvas = Canvas.createCanvas(1024, 450), const canvas = Canvas.createCanvas(1024, 450),
ctx = canvas.getContext("2d"); ctx = canvas.getContext("2d");
@ -79,13 +80,13 @@ class GuildMemberRemove extends BaseEvent {
ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250); ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250);
// Draw server name // 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 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 server: member.guild.name
}), canvas.width - 700, canvas.height - 70); }, member.guild.data.language), canvas.width - 700, canvas.height - 70);
// Draw discriminator // Draw discriminator
ctx.font = "35px RubikMonoOne"; ctx.font = "35px RubikMonoOne";
@ -93,7 +94,7 @@ class GuildMemberRemove extends BaseEvent {
// Draw membercount // Draw membercount
ctx.font = "22px RubikMonoOne"; 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 // Draw # for discriminator
ctx.fillStyle = "#FFFFFF"; ctx.fillStyle = "#FFFFFF";
@ -104,9 +105,9 @@ class GuildMemberRemove extends BaseEvent {
ctx.font = "45px RubikMonoOne"; ctx.font = "45px RubikMonoOne";
ctx.strokeStyle = "#000000"; ctx.strokeStyle = "#000000";
ctx.lineWidth = 10; 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.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 // Draw avatar circle
ctx.beginPath(); ctx.beginPath();
@ -116,8 +117,8 @@ class GuildMemberRemove extends BaseEvent {
ctx.stroke(); ctx.stroke();
ctx.closePath(); ctx.closePath();
ctx.clip(); ctx.clip();
const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ const avatar = await Canvas.loadImage(member.displayAvatarURL({
format: "png", extension: "png",
size: 512 size: 512
})); }));
ctx.drawImage(avatar, 45, 90, 270, 270); ctx.drawImage(avatar, 45, 90, 270, 270);

View file

@ -10,16 +10,17 @@ class GuildMemberUpdate extends BaseEvent {
/** /**
* *
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").GuildMember} oldMember * @param {import("discord.js").GuildMember} oldMember
* @param {import("discord.js").GuildMember} newMember * @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 && oldMember.guild.id === "568120814776614924") return;
if (oldMember.guild.id !== client.config.support.id) return;
if (oldMember.guild.id !== this.client.config.support.id) return;
if (oldMember.roles.cache.some((r) => r.name === "Поддержавшие JaBa")) 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 id: newMember.id
}); });
userData.achievements.tip.progress.now = 1; userData.achievements.tip.progress.now = 1;

View file

@ -30,8 +30,8 @@ module.exports.init = async function (client) {
.setAuthor({ .setAuthor({
name: client.user.username, name: client.user.username,
iconURL: client.user.displayAvatarURL({ iconURL: client.user.displayAvatarURL({
size: 512, extension: "png",
format: "png" size: 512
}) })
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)

View file

@ -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": "📢 Объявление:"
}

View file

@ -1,9 +0,0 @@
{
"DESCRIPTION": "Воспроизвести клип",
"USAGE": "clip [название-файла]",
"EXAMPLES": "clip haha",
"NO_ARG": "Укажите название файла!",
"NO_FILE": "Файл {{file}} отсутствует!",
"ACTIVE_QUEUE": "Не могу воспроизвести клип, т.к. на сервере есть активная очередь!",
"ACTIVE_CLIP": "Уже воспроизводится какой-то файл!"
}

View file

@ -1,6 +1,7 @@
{ {
"DESCRIPTION": "Показать список доступных звуков", "DESCRIPTION": "Показать список доступных звуков и воспроизвести выбранный",
"USAGE": "clips", "USAGE": "clips",
"EXAMPLES": "clips", "EXAMPLES": "clips",
"EMBED_TITLE": "**Список клипов**" "AVAILABLE_CLIPS": "Список доступных клипов:",
"PLAYING": "Начато проигрывание клипа `{{clip}}`"
} }

View file

@ -2,6 +2,6 @@
"DESCRIPTION": "Перейти на заданный трек", "DESCRIPTION": "Перейти на заданный трек",
"USAGE": "jump [номер]", "USAGE": "jump [номер]",
"EXAMPLES": "jump 3", "EXAMPLES": "jump 3",
"NO_PREV_SONG": "Вы не можете перейти назад, для этого используйте команду `back`!", "POSITION": "Номер трека в очереди",
"SUCCESS": "Играет выбранный трек!" "NO_PREV_SONG": "Вы не можете перейти назад, для этого используйте команду `back`!"
} }

View file

@ -1,8 +1,10 @@
{ {
"DESCRIPTION": "Включить или отключить повтор очереди/одного трека!", "DESCRIPTION": "Включить или отключить повтор очереди/одного трека",
"USAGE": "loop (queue/all/song/single)", "USAGE": "loop",
"EXAMPLES": "loop queue\nloop single", "EXAMPLES": "loop",
"QUEUE": "Повтор очереди **включён**!", "QUEUE": "Очередь",
"SONG": "Повтор текущего трека **включён**!", "SONG": "Текущий трек",
"QUEUE_ENABLED": "Повтор очереди **включён**!",
"SONG_ENABLED": "Повтор текущего трека **включён**!",
"DISABLED": "Повтор **отключён**!" "DISABLED": "Повтор **отключён**!"
} }

View file

@ -1,7 +1,7 @@
{ {
"DESCRIPTION": "Показать информацию о играющем сейчас треке!", "DESCRIPTION": "Показать информацию о играющем сейчас треке",
"USAGE": "np", "USAGE": "nowplaying",
"EXAMPLES": "np", "EXAMPLES": "nowplaying",
"CURRENTLY_PLAYING": "Сейчас играет", "CURRENTLY_PLAYING": "Сейчас играет",
"T_TITLE": "Название", "T_TITLE": "Название",
"T_CHANNEL": "Канал", "T_CHANNEL": "Канал",

View file

@ -1,6 +0,0 @@
{
"DESCRIPTION": "Поставить воспроизведение очереди на паузу!",
"USAGE": "pause",
"EXAMPLES": "pause",
"SUCCESS": "⏸️ Воспроизведение очереди приостановлено."
}

View file

@ -1,10 +1,10 @@
{ {
"DESCRIPTION": "Начать воспроизведение трека!", "DESCRIPTION": "Начать воспроизведение трека",
"USAGE": "play [название-трека/ссылка]", "USAGE": "play [название-трека/ссылка]",
"EXAMPLES": "play Never Gonna Give You Up", "EXAMPLES": "play Never Gonna Give You Up",
"LINK": "Название/Прямая ссылка/Ссылка на YouTube, Spotify или SoundCloud",
"NO_VOICE_CHANNEL": "Вы должны находиться в голосовом канале!", "NO_VOICE_CHANNEL": "Вы должны находиться в голосовом канале!",
"VOICE_CHANNEL_CONNECT": "Я не могу присоедениться к вашему голосовому каналу!", "VOICE_CHANNEL_CONNECT": "Я не могу присоедениться к вашему голосовому каналу!",
"MISSING_SONG_NAME": "Укажите название трека или ссылку на него!",
"RESULTS_FOOTER": "Укажите число от 1 до 10 (без префикса).", "RESULTS_FOOTER": "Укажите число от 1 до 10 (без префикса).",
"NO_RESULT": "Ничего не найдено!", "NO_RESULT": "Ничего не найдено!",
"NOW_PLAYING": "Сейчас играет **{{songName}}**", "NOW_PLAYING": "Сейчас играет **{{songName}}**",

View file

@ -3,5 +3,8 @@
"USAGE": "queue", "USAGE": "queue",
"EXAMPLES": "queue", "EXAMPLES": "queue",
"TITLE": "Очередь", "TITLE": "Очередь",
"PREVIOUS": "Пред. страница",
"NEXT": "След. страница",
"PAGE": "Страница",
"ADDED": "Добавил" "ADDED": "Добавил"
} }

View file

@ -1,6 +0,0 @@
{
"DESCRIPTION": "Продолжает воспроизведение очереди!",
"USAGE": "resume",
"EXAMPLES": "resume",
"SUCCESS": "▶️ Воспроизведение очереди продолжается!"
}

View file

@ -1,7 +1,7 @@
{ {
"DESCRIPTION": "Перемотать вперед или назад на данное время в текущем треке!", "DESCRIPTION": "Перемотать вперед или назад на данное время в текущем треке",
"USAGE": "seek [время]", "USAGE": "seek [время]",
"EXAMPLES": "seek 10s\nseek -10s", "EXAMPLES": "seek 10s\nseek -10s",
"INVALID_TIME": "Укажите время!", "INVALID_TIME": "Укажите время!",
"SUCCESS": "▶️ Трек перемотан!" "SUCCESS": "Трек перемотан на {{time}}!"
} }

View file

@ -0,0 +1,8 @@
{
"DESCRIPTION": "Отправить объявление на все сервера где есть JaBa",
"USAGE": "announcement [текст]",
"EXAMPLES": "announcement Обновление v1.0!",
"TOO_LONG": "Текст должен быть короче 1000 символов!",
"TITLE": "📢 Объявление:",
"SENDED": "Обновление отправлено на все сервера!"
}

View file

@ -2,5 +2,6 @@
"DESCRIPTION": "Перезагрузить команду!", "DESCRIPTION": "Перезагрузить команду!",
"COMMAND": "Команда", "COMMAND": "Команда",
"EXAMPLES": "reload help", "EXAMPLES": "reload help",
"AVAILABLE_COMMANDS": "Доступные команды:",
"SUCCESS": "Команда `{{command}}` успешно перезагружена!" "SUCCESS": "Команда `{{command}}` успешно перезагружена!"
} }

67
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "jaba", "name": "jaba",
"version": "TEST", "version": "4.0pre1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "jaba", "name": "jaba",
"version": "TEST", "version": "4.0pre1",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@discordjs/opus": "^0.8.0", "@discordjs/opus": "^0.8.0",
@ -24,11 +24,11 @@
"chalk": "^4.1.0", "chalk": "^4.1.0",
"colors-generator": "^0.3.4", "colors-generator": "^0.3.4",
"cron": "^1.7.2", "cron": "^1.7.2",
"customizable-discordjs-pagination": "^1.3.1",
"discord-api-types": "^0.37.0", "discord-api-types": "^0.37.0",
"discord-giveaways": "^6.0.0", "discord-giveaways": "^6.0.0",
"discord-together": "^1.3.3", "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", "distube": "^4.0.3",
"ejs": "^3.1.3", "ejs": "^3.1.3",
"express": "^4.17.1", "express": "^4.17.1",
@ -37,6 +37,7 @@
"gamedig": "^4.0.2", "gamedig": "^4.0.2",
"i18next": "^20.2.2", "i18next": "^20.2.2",
"i18next-node-fs-backend": "^2.1.3", "i18next-node-fs-backend": "^2.1.3",
"libsodium-wrappers": "^0.7.10",
"markdown-table": "2.0.0", "markdown-table": "2.0.0",
"mathjs": "^9.0.0", "mathjs": "^9.0.0",
"md5": "^2.2.1", "md5": "^2.2.1",
@ -1305,11 +1306,6 @@
"url": "https://github.com/sponsors/fb55" "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": { "node_modules/dargs": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz",
@ -1521,9 +1517,9 @@
"integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg==" "integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg=="
}, },
"node_modules/discord.js": { "node_modules/discord.js": {
"version": "14.1.1", "version": "14.1.2",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.1.1.tgz", "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.1.2.tgz",
"integrity": "sha512-6Oa2f+Y0+s6B5HTTqcAP7Z6tUmguNTKpzbuTmE1JIeT/aUTr9dVe397D/bvcBSRpJERQzMyEWyEiVQnMRHcx4A==", "integrity": "sha512-apdWNLkjAkeEnuNpB8H6rS/4OgrXQlSAjuuzeodjCOdIXy3OwOjD314V/HiSttcAlr9+r3ONhaT5qvbDad5SIg==",
"dependencies": { "dependencies": {
"@discordjs/builders": "^1.1.0", "@discordjs/builders": "^1.1.0",
"@discordjs/collection": "^1.0.1", "@discordjs/collection": "^1.0.1",
@ -1541,6 +1537,11 @@
"node": ">=16.9.0" "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": { "node_modules/discord.js/node_modules/discord-api-types": {
"version": "0.36.3", "version": "0.36.3",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz",
@ -2975,6 +2976,19 @@
"node": ">= 0.8.0" "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": { "node_modules/lodash.deburr": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz", "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", "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz",
"integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==" "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": { "dargs": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz",
@ -5871,9 +5880,9 @@
} }
}, },
"discord.js": { "discord.js": {
"version": "14.1.1", "version": "14.1.2",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.1.1.tgz", "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.1.2.tgz",
"integrity": "sha512-6Oa2f+Y0+s6B5HTTqcAP7Z6tUmguNTKpzbuTmE1JIeT/aUTr9dVe397D/bvcBSRpJERQzMyEWyEiVQnMRHcx4A==", "integrity": "sha512-apdWNLkjAkeEnuNpB8H6rS/4OgrXQlSAjuuzeodjCOdIXy3OwOjD314V/HiSttcAlr9+r3ONhaT5qvbDad5SIg==",
"requires": { "requires": {
"@discordjs/builders": "^1.1.0", "@discordjs/builders": "^1.1.0",
"@discordjs/collection": "^1.0.1", "@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": { "distube": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/distube/-/distube-4.0.3.tgz", "resolved": "https://registry.npmjs.org/distube/-/distube-4.0.3.tgz",
@ -6993,6 +7007,19 @@
"type-check": "~0.4.0" "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": { "lodash.deburr": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz", "resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz",

View file

@ -1,7 +1,7 @@
{ {
"name": "jaba", "name": "jaba",
"version": "TEST", "version": "4.0pre1",
"description": "A very complete Discord bot (more than 100 commands) that uses the Discord.js", "description": "My Discord Bot",
"main": "index.js", "main": "index.js",
"private": true, "private": true,
"scripts": { "scripts": {
@ -27,11 +27,11 @@
"chalk": "^4.1.0", "chalk": "^4.1.0",
"colors-generator": "^0.3.4", "colors-generator": "^0.3.4",
"cron": "^1.7.2", "cron": "^1.7.2",
"customizable-discordjs-pagination": "^1.3.1",
"discord-api-types": "^0.37.0", "discord-api-types": "^0.37.0",
"discord-giveaways": "^6.0.0", "discord-giveaways": "^6.0.0",
"discord-together": "^1.3.3", "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", "distube": "^4.0.3",
"ejs": "^3.1.3", "ejs": "^3.1.3",
"express": "^4.17.1", "express": "^4.17.1",
@ -40,6 +40,7 @@
"gamedig": "^4.0.2", "gamedig": "^4.0.2",
"i18next": "^20.2.2", "i18next": "^20.2.2",
"i18next-node-fs-backend": "^2.1.3", "i18next-node-fs-backend": "^2.1.3",
"libsodium-wrappers": "^0.7.10",
"markdown-table": "2.0.0", "markdown-table": "2.0.0",
"mathjs": "^9.0.0", "mathjs": "^9.0.0",
"md5": "^2.2.1", "md5": "^2.2.1",