mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
v4.4.3
This commit is contained in:
parent
427e1c6ae2
commit
cc0fd759f7
92 changed files with 428 additions and 440 deletions
|
@ -41,7 +41,7 @@ class JaBaClient extends Client {
|
||||||
this.player.events.on("playerStart", async (queue, track) => {
|
this.player.events.on("playerStart", async (queue, track) => {
|
||||||
const m = (
|
const m = (
|
||||||
await queue.metadata.channel.send({
|
await queue.metadata.channel.send({
|
||||||
content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language),
|
content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.data.guild.language),
|
||||||
})
|
})
|
||||||
).id;
|
).id;
|
||||||
|
|
||||||
|
@ -58,14 +58,14 @@ class JaBaClient extends Client {
|
||||||
if (message && message.deletable) message.delete();
|
if (message && message.deletable) message.delete();
|
||||||
}, 5 * 60 * 1000);
|
}, 5 * 60 * 1000);
|
||||||
});
|
});
|
||||||
this.player.events.on("emptyQueue", queue => queue.metadata.channel.send(this.translate("music/play:QUEUE_ENDED", null, queue.metadata.channel.guild.data.language)));
|
this.player.events.on("emptyQueue", queue => queue.metadata.channel.send(this.translate("music/play:QUEUE_ENDED", null, queue.metadata.data.guild.language)));
|
||||||
this.player.events.on("emptyChannel", queue => queue.metadata.channel.send(this.translate("music/play:STOP_EMPTY", null, queue.metadata.channel.guild.data.language)));
|
this.player.events.on("emptyChannel", queue => queue.metadata.channel.send(this.translate("music/play:STOP_EMPTY", null, queue.metadata.data.guild.language)));
|
||||||
this.player.events.on("playerError", (queue, e) => {
|
this.player.events.on("playerError", (queue, e) => {
|
||||||
queue.metadata.channel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e.message }, queue.metadata.channel.guild.data.language) });
|
queue.metadata.channel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e.message }, queue.metadata.data.guild.language) });
|
||||||
console.log(e);
|
console.log(e);
|
||||||
});
|
});
|
||||||
this.player.events.on("error", (queue, e) => {
|
this.player.events.on("error", (queue, e) => {
|
||||||
queue.metadata.channel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e.message }, queue.metadata.channel.guild.data.language) });
|
queue.metadata.channel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e.message }, queue.metadata.data.guild.language) });
|
||||||
console.log(e);
|
console.log(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ class JaBaClient extends Client {
|
||||||
* @returns {String} Bot's default language
|
* @returns {String} Bot's default language
|
||||||
*/
|
*/
|
||||||
get defaultLanguage() {
|
get defaultLanguage() {
|
||||||
return this.languages.find(language => language.default).name;
|
return this.languages.find(language => language.default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +159,7 @@ class JaBaClient extends Client {
|
||||||
* @param {Array} args Arguments for translation
|
* @param {Array} args Arguments for translation
|
||||||
* @param {String} locale Language
|
* @param {String} locale Language
|
||||||
*/
|
*/
|
||||||
translate(key, args, locale = this.defaultLanguage) {
|
translate(key, args, locale = this.defaultLanguage.name) {
|
||||||
const lang = this.translations.get(locale);
|
const lang = this.translations.get(locale);
|
||||||
|
|
||||||
return lang(key, args);
|
return lang(key, args);
|
||||||
|
@ -224,7 +224,7 @@ class JaBaClient extends Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads a command
|
* Removes a command from cache
|
||||||
* @param {String} dir Directory where command is located
|
* @param {String} dir Directory where command is located
|
||||||
* @param {String} name Command name
|
* @param {String} name Command name
|
||||||
* @returns
|
* @returns
|
||||||
|
|
|
@ -46,7 +46,6 @@ class Ban extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -23,17 +23,18 @@ class ImportMee6 extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
const level = (await Mee6Api.getUserXp(interaction.guildId, interaction.member)).level;
|
const level = (await Mee6Api.getUserXp(interaction.guildId, interaction.member)).level;
|
||||||
|
|
||||||
data.memberData.level = level;
|
interaction.data.member.level = level;
|
||||||
|
interaction.data.member.exp = 0;
|
||||||
|
|
||||||
data.memberData.markModified("level");
|
interaction.data.member.markModified("level");
|
||||||
await data.memberData.save();
|
interaction.data.member.markModified("exp");
|
||||||
|
await interaction.data.member.save();
|
||||||
|
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: interaction.translate("owner/debug:SUCCESS_LEVEL", {
|
content: interaction.translate("owner/debug:SUCCESS_LEVEL", {
|
||||||
|
|
|
@ -46,7 +46,6 @@ class Kick extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -33,6 +33,8 @@ class Memes extends BaseCommand {
|
||||||
if (interaction.customId === "memes_select") {
|
if (interaction.customId === "memes_select") {
|
||||||
interaction.deferUpdate();
|
interaction.deferUpdate();
|
||||||
|
|
||||||
|
interaction.guild.data = await client.findOrCreateGuild(interaction.guildId);
|
||||||
|
|
||||||
const tag = interaction.values[0];
|
const tag = interaction.values[0];
|
||||||
const res = await fetch(`https://meme-api.com/gimme/${tag}`).then(response => response.json());
|
const res = await fetch(`https://meme-api.com/gimme/${tag}`).then(response => response.json());
|
||||||
|
|
||||||
|
@ -53,7 +55,6 @@ class Memes extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
|
@ -25,7 +25,6 @@ class Staff extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.guild.members.fetch();
|
await interaction.guild.members.fetch();
|
||||||
|
|
|
@ -65,28 +65,28 @@ class Automod extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const state = interaction.options.getBoolean("state"),
|
const { data } = interaction,
|
||||||
|
state = interaction.options.getBoolean("state"),
|
||||||
channel = interaction.options.getChannel("channel"),
|
channel = interaction.options.getChannel("channel"),
|
||||||
command = interaction.options.getSubcommand();
|
command = interaction.options.getSubcommand();
|
||||||
|
|
||||||
if (command === "toggle") {
|
if (command === "toggle") {
|
||||||
data.guildData.plugins.automod = {
|
data.guild.plugins.automod = {
|
||||||
enabled: state,
|
enabled: state,
|
||||||
ignored: [],
|
ignored: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
data.guildData.markModified("plugins.automod");
|
data.guild.markModified("plugins.automod");
|
||||||
await data.guildData.save();
|
await data.guild.save();
|
||||||
|
|
||||||
interaction.success(`administration/automod:${state ? "ENABLED" : "DISABLED"}`);
|
interaction.success(`administration/automod:${state ? "ENABLED" : "DISABLED"}`);
|
||||||
} else if (command === "ignore") {
|
} else if (command === "ignore") {
|
||||||
data.guildData.plugins.automod.ignored.push(channel.id);
|
data.guild.plugins.automod.ignored.push(channel.id);
|
||||||
|
|
||||||
data.guildData.markModified("plugins.automod");
|
data.guild.markModified("plugins.automod");
|
||||||
await data.guildData.save();
|
await data.guild.save();
|
||||||
|
|
||||||
interaction.success("administration/automod:DISABLED_CHANNEL", {
|
interaction.success("administration/automod:DISABLED_CHANNEL", {
|
||||||
channel: channel.toString(),
|
channel: channel.toString(),
|
||||||
|
|
|
@ -45,29 +45,29 @@ class Autorole extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const state = interaction.options.getBoolean("state"),
|
const guildData = interaction.data.guild,
|
||||||
|
state = interaction.options.getBoolean("state"),
|
||||||
role = interaction.options.getRole("role");
|
role = interaction.options.getRole("role");
|
||||||
|
|
||||||
data.guildData.plugins.autorole = {
|
guildData.plugins.autorole = {
|
||||||
enabled: state,
|
enabled: state,
|
||||||
role,
|
role,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (state && role) {
|
if (state && role) {
|
||||||
data.guildData.markModified("plugins.autorole");
|
guildData.markModified("plugins.autorole");
|
||||||
await data.guildData.save();
|
await guildData.save();
|
||||||
|
|
||||||
interaction.success("administration/autorole:ENABLED", {
|
interaction.success("administration/autorole:ENABLED", {
|
||||||
role: role.toString(),
|
role: role.toString(),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
data.guildData.plugins.autorole.enabled = false;
|
guildData.plugins.autorole.enabled = false;
|
||||||
|
|
||||||
data.guildData.markModified("plugins.autorole");
|
guildData.markModified("plugins.autorole");
|
||||||
await data.guildData.save();
|
await guildData.save();
|
||||||
|
|
||||||
interaction.success("administration/autorole:DISABLED");
|
interaction.success("administration/autorole:DISABLED");
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,14 +84,12 @@ class Config extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const command = interaction.options.getSubcommand();
|
const guildData = interaction.data.guild,
|
||||||
|
command = interaction.options.getSubcommand();
|
||||||
|
|
||||||
if (command === "list") {
|
if (command === "list") {
|
||||||
const guildData = data.guildData;
|
|
||||||
|
|
||||||
const embed = client.embed({
|
const embed = client.embed({
|
||||||
author: {
|
author: {
|
||||||
name: interaction.guild.name,
|
name: interaction.guild.name,
|
||||||
|
@ -173,7 +171,7 @@ class Config extends BaseCommand {
|
||||||
state = interaction.options.getBoolean("state"),
|
state = interaction.options.getBoolean("state"),
|
||||||
channel = interaction.options.getChannel("channel");
|
channel = interaction.options.getChannel("channel");
|
||||||
|
|
||||||
await changeSetting(interaction, setting, state, channel, data.guildData);
|
await changeSetting(interaction, setting, state, channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,20 +182,20 @@ class Config extends BaseCommand {
|
||||||
* @param {String} setting
|
* @param {String} setting
|
||||||
* @param {Boolean} state
|
* @param {Boolean} state
|
||||||
* @param {import("discord.js").GuildTextBasedChannel | import("discord.js").CategoryChannel} channel
|
* @param {import("discord.js").GuildTextBasedChannel | import("discord.js").CategoryChannel} channel
|
||||||
* @param {import("../../base/Guild")} guildData
|
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async function changeSetting(interaction, setting, state, channel, guildData) {
|
async function changeSetting(interaction, setting, state, channel) {
|
||||||
const settingSplitted = setting.split(".");
|
const settingSplitted = setting.split("."),
|
||||||
|
data = interaction.data.guild;
|
||||||
|
|
||||||
if (settingSplitted.length === 2) {
|
if (settingSplitted.length === 2) {
|
||||||
if (guildData.plugins[settingSplitted[0]] === undefined) guildData.plugins[settingSplitted[0]] = {};
|
if (data.plugins[settingSplitted[0]] === undefined) data.plugins[settingSplitted[0]] = {};
|
||||||
|
|
||||||
if (!state) {
|
if (!state) {
|
||||||
guildData.plugins[settingSplitted[0]][settingSplitted[1]] = null;
|
data.plugins[settingSplitted[0]][settingSplitted[1]] = null;
|
||||||
|
|
||||||
guildData.markModified(`plugins.${settingSplitted[0]}`);
|
data.markModified(`plugins.${settingSplitted[0]}`);
|
||||||
await guildData.save();
|
await data.save();
|
||||||
|
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: `${interaction.translate(`administration/config:${settingSplitted.length === 2 ? settingSplitted[1].toUpperCase() : setting.toUpperCase()}`)}: **${interaction.translate("common:DISABLED")}**`,
|
content: `${interaction.translate(`administration/config:${settingSplitted.length === 2 ? settingSplitted[1].toUpperCase() : setting.toUpperCase()}`)}: **${interaction.translate("common:DISABLED")}**`,
|
||||||
|
@ -207,10 +205,10 @@ async function changeSetting(interaction, setting, state, channel, guildData) {
|
||||||
if (settingSplitted[1] === "ticketsCategory" && channel.type !== ChannelType.GuildCategory) return interaction.reply({ content: interaction.translate("administration/config:TICKETS_NOT_CATEGORY"), ephemeral: true });
|
if (settingSplitted[1] === "ticketsCategory" && channel.type !== ChannelType.GuildCategory) return interaction.reply({ content: interaction.translate("administration/config:TICKETS_NOT_CATEGORY"), ephemeral: true });
|
||||||
|
|
||||||
if (channel) {
|
if (channel) {
|
||||||
guildData.plugins[settingSplitted[0]][settingSplitted[1]] = channel.id;
|
data.plugins[settingSplitted[0]][settingSplitted[1]] = channel.id;
|
||||||
|
|
||||||
guildData.markModified(`plugins.${settingSplitted[0]}`);
|
data.markModified(`plugins.${settingSplitted[0]}`);
|
||||||
await guildData.save();
|
await data.save();
|
||||||
|
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: `${interaction.translate(`administration/config:${settingSplitted.length === 2 ? settingSplitted[1].toUpperCase() : setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`,
|
content: `${interaction.translate(`administration/config:${settingSplitted.length === 2 ? settingSplitted[1].toUpperCase() : setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`,
|
||||||
|
@ -219,17 +217,17 @@ async function changeSetting(interaction, setting, state, channel, guildData) {
|
||||||
} else
|
} else
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: `${interaction.translate(`administration/config:${settingSplitted.length === 2 ? settingSplitted[1].toUpperCase() : setting.toUpperCase()}`)}: ${
|
content: `${interaction.translate(`administration/config:${settingSplitted.length === 2 ? settingSplitted[1].toUpperCase() : setting.toUpperCase()}`)}: ${
|
||||||
guildData.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${guildData.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`
|
data.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${data.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`
|
||||||
}`,
|
}`,
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!state) {
|
if (!state) {
|
||||||
guildData.plugins[setting] = null;
|
data.plugins[setting] = null;
|
||||||
|
|
||||||
guildData.markModified(`plugins.${setting}`);
|
data.markModified(`plugins.${setting}`);
|
||||||
await guildData.save();
|
await data.save();
|
||||||
|
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:DISABLED")}**`,
|
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:DISABLED")}**`,
|
||||||
|
@ -237,10 +235,10 @@ async function changeSetting(interaction, setting, state, channel, guildData) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (channel) {
|
if (channel) {
|
||||||
guildData.plugins[setting] = channel.id;
|
data.plugins[setting] = channel.id;
|
||||||
|
|
||||||
guildData.markModified(`plugins.${setting}`);
|
data.markModified(`plugins.${setting}`);
|
||||||
await guildData.save();
|
await data.save();
|
||||||
|
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`,
|
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`,
|
||||||
|
@ -249,7 +247,7 @@ async function changeSetting(interaction, setting, state, channel, guildData) {
|
||||||
} else
|
} else
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${
|
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${
|
||||||
guildData.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${guildData.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`
|
data.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${data.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`
|
||||||
}`,
|
}`,
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -81,10 +81,10 @@ class Goodbye extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const command = interaction.options.getSubcommand();
|
const guildData = interaction.data.guild,
|
||||||
|
command = interaction.options.getSubcommand();
|
||||||
|
|
||||||
if (command === "test") {
|
if (command === "test") {
|
||||||
client.emit("guildMemberRemove", interaction.member);
|
client.emit("guildMemberRemove", interaction.member);
|
||||||
|
@ -94,15 +94,15 @@ class Goodbye extends BaseCommand {
|
||||||
const state = interaction.options.getBoolean("state");
|
const state = interaction.options.getBoolean("state");
|
||||||
|
|
||||||
if (!state) {
|
if (!state) {
|
||||||
data.guildData.plugins.goodbye = {
|
guildData.plugins.goodbye = {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
message: null,
|
message: null,
|
||||||
channelID: null,
|
channelID: null,
|
||||||
withImage: null,
|
withImage: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
data.guildData.markModified("plugins.goodbye");
|
guildData.markModified("plugins.goodbye");
|
||||||
await data.guildData.save();
|
await guildData.save();
|
||||||
|
|
||||||
interaction.success("administration/goodbye:DISABLED", null, { ephemeral: true });
|
interaction.success("administration/goodbye:DISABLED", null, { ephemeral: true });
|
||||||
} else {
|
} else {
|
||||||
|
@ -110,15 +110,15 @@ class Goodbye extends BaseCommand {
|
||||||
const message = interaction.options.getString("message") || interaction.translate("administration/goodbye:DEFAULT_MESSAGE");
|
const message = interaction.options.getString("message") || interaction.translate("administration/goodbye:DEFAULT_MESSAGE");
|
||||||
const image = interaction.options.getBoolean("image") === true ? true : false;
|
const image = interaction.options.getBoolean("image") === true ? true : false;
|
||||||
|
|
||||||
data.guildData.plugins.goodbye = {
|
guildData.plugins.goodbye = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
channel: channel.id,
|
channel: channel.id,
|
||||||
message: message,
|
message: message,
|
||||||
withImage: image,
|
withImage: image,
|
||||||
};
|
};
|
||||||
|
|
||||||
data.guildData.markModified("plugins.goodbye");
|
guildData.markModified("plugins.goodbye");
|
||||||
await data.guildData.save();
|
await guildData.save();
|
||||||
|
|
||||||
interaction.success("administration/goodbye:ENABLED", {
|
interaction.success("administration/goodbye:ENABLED", {
|
||||||
channel: `${channel.toString()}`,
|
channel: `${channel.toString()}`,
|
||||||
|
|
|
@ -89,6 +89,9 @@ class Selectroles extends BaseCommand {
|
||||||
if (!interaction.isStringSelectMenu()) return;
|
if (!interaction.isStringSelectMenu()) return;
|
||||||
|
|
||||||
if (interaction.customId === "auto_roles") {
|
if (interaction.customId === "auto_roles") {
|
||||||
|
interaction.data = [];
|
||||||
|
interaction.data.guild = await client.findOrCreateGuild(interaction.guildId);
|
||||||
|
|
||||||
const removed = interaction.component.options.filter(option => {
|
const removed = interaction.component.options.filter(option => {
|
||||||
return !interaction.values.includes(option.value);
|
return !interaction.values.includes(option.value);
|
||||||
});
|
});
|
||||||
|
@ -113,7 +116,6 @@ class Selectroles extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
|
@ -62,7 +62,6 @@ class Set extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const type = interaction.options.getString("type"),
|
const type = interaction.options.getString("type"),
|
||||||
|
|
|
@ -37,16 +37,16 @@ class Setlang extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const lang = interaction.options.getString("language"),
|
const guildData = interaction.data.guild,
|
||||||
|
lang = interaction.options.getString("language"),
|
||||||
language = client.languages.find(l => l.name === lang);
|
language = client.languages.find(l => l.name === lang);
|
||||||
|
|
||||||
data.guildData.language = language.name;
|
guildData.language = language.name;
|
||||||
|
|
||||||
data.guildData.markModified("language");
|
guildData.markModified("language");
|
||||||
await data.guildData.save();
|
await guildData.save();
|
||||||
|
|
||||||
return interaction.success("administration/setlang:SUCCESS", {
|
return interaction.success("administration/setlang:SUCCESS", {
|
||||||
lang: language.nativeName,
|
lang: language.nativeName,
|
||||||
|
|
|
@ -36,16 +36,14 @@ class Stealemoji extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const parsedEmoji = parseEmoji(interaction.options.getString("emoji")),
|
const parsedEmoji = parseEmoji(interaction.options.getString("emoji"));
|
||||||
ext = parsedEmoji.animated ? "gif" : "png";
|
|
||||||
|
|
||||||
interaction.guild.emojis
|
interaction.guild.emojis
|
||||||
.create({
|
.create({
|
||||||
name: parsedEmoji.name,
|
name: parsedEmoji.name,
|
||||||
attachment: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${ext}`,
|
attachment: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${parsedEmoji.animated ? "gif" : "png"}`,
|
||||||
})
|
})
|
||||||
.then(emoji =>
|
.then(emoji =>
|
||||||
interaction.success("administration/stealemoji:SUCCESS", {
|
interaction.success("administration/stealemoji:SUCCESS", {
|
||||||
|
|
|
@ -81,10 +81,10 @@ class Welcome extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const command = interaction.options.getSubcommand();
|
const guildData = interaction.data.guild,
|
||||||
|
command = interaction.options.getSubcommand();
|
||||||
|
|
||||||
if (command === "test") {
|
if (command === "test") {
|
||||||
client.emit("guildMemberAdd", interaction.member);
|
client.emit("guildMemberAdd", interaction.member);
|
||||||
|
@ -94,15 +94,15 @@ class Welcome extends BaseCommand {
|
||||||
const state = interaction.options.getBoolean("state");
|
const state = interaction.options.getBoolean("state");
|
||||||
|
|
||||||
if (!state) {
|
if (!state) {
|
||||||
data.guildData.plugins.welcome = {
|
guildData.plugins.welcome = {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
message: null,
|
message: null,
|
||||||
channelID: null,
|
channelID: null,
|
||||||
withImage: null,
|
withImage: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
data.guildData.markModified("plugins.welcome");
|
guildData.markModified("plugins.welcome");
|
||||||
await data.guildData.save();
|
await guildData.save();
|
||||||
|
|
||||||
interaction.success("administration/welcome:DISABLED", null, { ephemeral: true });
|
interaction.success("administration/welcome:DISABLED", null, { ephemeral: true });
|
||||||
} else {
|
} else {
|
||||||
|
@ -110,15 +110,15 @@ class Welcome extends BaseCommand {
|
||||||
const message = interaction.options.getString("message") || interaction.translate("administration/welcome:DEFAULT_MESSAGE");
|
const message = interaction.options.getString("message") || interaction.translate("administration/welcome:DEFAULT_MESSAGE");
|
||||||
const image = interaction.options.getBoolean("image") === true ? true : false;
|
const image = interaction.options.getBoolean("image") === true ? true : false;
|
||||||
|
|
||||||
data.guildData.plugins.welcome = {
|
guildData.plugins.welcome = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
channel: channel.id,
|
channel: channel.id,
|
||||||
message: message,
|
message: message,
|
||||||
withImage: image,
|
withImage: image,
|
||||||
};
|
};
|
||||||
|
|
||||||
data.guildData.markModified("plugins.welcome");
|
guildData.markModified("plugins.welcome");
|
||||||
await data.guildData.save();
|
await guildData.save();
|
||||||
|
|
||||||
interaction.success("administration/welcome:ENABLED", {
|
interaction.success("administration/welcome:ENABLED", {
|
||||||
channel: `${channel.toString()}`,
|
channel: `${channel.toString()}`,
|
||||||
|
|
|
@ -34,13 +34,12 @@ class Achievements extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const user = interaction.options.getUser("user") || interaction.member;
|
const user = interaction.options.getUser("user") || interaction.member;
|
||||||
if (user.bot) return interaction.error("economy/profile:BOT_USER");
|
if (user.bot) return interaction.error("economy/profile:BOT_USER");
|
||||||
|
|
||||||
const userData = user.id === interaction.user.id ? data.userData : await client.findOrCreateUser(user.id);
|
const userData = user.id === interaction.user.id ? interaction.data.user : await client.findOrCreateUser(user.id);
|
||||||
|
|
||||||
const embed = client.embed({
|
const embed = client.embed({
|
||||||
author: {
|
author: {
|
||||||
|
|
|
@ -46,25 +46,26 @@ class Bank extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const choice = interaction.options.getString("option");
|
const memberData = interaction.data.member,
|
||||||
|
choice = interaction.options.getString("option");
|
||||||
|
|
||||||
if (choice === "deposit") {
|
if (choice === "deposit") {
|
||||||
const credits = interaction.options.getString("credits").toLowerCase() === "all" ? data.memberData.money : interaction.options.getString("credits");
|
const credits = interaction.options.getString("credits").toLowerCase() === "all" ? memberData.money : interaction.options.getString("credits");
|
||||||
|
|
||||||
if (isNaN(credits) || credits < 1) return interaction.error("misc:OPTION_NAN_ALL");
|
if (isNaN(credits) || credits < 1) return interaction.error("misc:OPTION_NAN_ALL");
|
||||||
if (data.memberData.money < credits)
|
if (memberData.money < credits)
|
||||||
return interaction.error("economy/bank:NOT_ENOUGH_CREDIT", {
|
return interaction.error("economy/bank:NOT_ENOUGH_CREDIT", {
|
||||||
money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
data.memberData.money -= credits;
|
memberData.money -= credits;
|
||||||
data.memberData.bankSold += credits;
|
memberData.bankSold += credits;
|
||||||
|
|
||||||
data.memberData.markModified("money");
|
memberData.markModified("money");
|
||||||
data.memberData.markModified("bankSold");
|
memberData.markModified("bankSold");
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
user: interaction.translate("economy/transactions:BANK"),
|
user: interaction.translate("economy/transactions:BANK"),
|
||||||
|
@ -72,15 +73,16 @@ class Bank extends BaseCommand {
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
type: "send",
|
type: "send",
|
||||||
};
|
};
|
||||||
data.memberData.transactions.push(info);
|
memberData.transactions.push(info);
|
||||||
|
|
||||||
interaction.success("economy/bank:SUCCESS_DEP", {
|
interaction.success("economy/bank:SUCCESS_DEP", {
|
||||||
money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const credits = interaction.options.getString("credits") === "all" ? data.memberData.bankSold : interaction.options.getString("credits");
|
const credits = interaction.options.getString("credits") === "all" ? memberData.bankSold : interaction.options.getString("credits");
|
||||||
|
|
||||||
if (isNaN(credits) || credits < 1) return interaction.error("misc:OPTION_NAN_ALL");
|
if (isNaN(credits) || credits < 1) return interaction.error("misc:OPTION_NAN_ALL");
|
||||||
if (data.memberData.bankSold < credits)
|
if (memberData.bankSold < credits)
|
||||||
return interaction.error("economy/bank:NOT_ENOUGH_BANK", {
|
return interaction.error("economy/bank:NOT_ENOUGH_BANK", {
|
||||||
money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
});
|
});
|
||||||
|
@ -92,14 +94,14 @@ class Bank extends BaseCommand {
|
||||||
type: "got",
|
type: "got",
|
||||||
};
|
};
|
||||||
|
|
||||||
data.memberData.transactions.push(info);
|
memberData.transactions.push(info);
|
||||||
|
|
||||||
data.memberData.money += credits;
|
memberData.money += credits;
|
||||||
data.memberData.bankSold -= credits;
|
memberData.bankSold -= credits;
|
||||||
|
|
||||||
data.memberData.markModified("money");
|
memberData.markModified("money");
|
||||||
data.memberData.markModified("bankSold");
|
memberData.markModified("bankSold");
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
interaction.success("economy/bank:SUCCESS_WD", {
|
interaction.success("economy/bank:SUCCESS_WD", {
|
||||||
money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
|
|
|
@ -69,10 +69,10 @@ class Birthdate extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const day = interaction.options.getInteger("day"),
|
const userData = interaction.data.user,
|
||||||
|
day = interaction.options.getInteger("day"),
|
||||||
month = interaction.options.getInteger("month"),
|
month = interaction.options.getInteger("month"),
|
||||||
year = interaction.options.getInteger("year"),
|
year = interaction.options.getInteger("year"),
|
||||||
date = new Date(year, month - 1, day),
|
date = new Date(year, month - 1, day),
|
||||||
|
@ -82,10 +82,10 @@ class Birthdate extends BaseCommand {
|
||||||
if (date.getTime() > Date.now()) return interaction.error("economy/birthdate:DATE_TOO_HIGH");
|
if (date.getTime() > Date.now()) return interaction.error("economy/birthdate:DATE_TOO_HIGH");
|
||||||
if (date.getTime() < Date.now() - 2.523e12) return interaction.error("economy/birthdate:DATE_TOO_LOW");
|
if (date.getTime() < Date.now() - 2.523e12) return interaction.error("economy/birthdate:DATE_TOO_LOW");
|
||||||
|
|
||||||
data.userData.birthdate = d;
|
userData.birthdate = d;
|
||||||
|
|
||||||
data.userData.markModified("birthdate");
|
userData.markModified("birthdate");
|
||||||
await data.userData.save();
|
await userData.save();
|
||||||
|
|
||||||
interaction.success("economy/birthdate:SUCCESS", {
|
interaction.success("economy/birthdate:SUCCESS", {
|
||||||
date: `<t:${d}:D>`,
|
date: `<t:${d}:D>`,
|
||||||
|
|
|
@ -25,16 +25,17 @@ class Divorce extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
if (!data.userData.lover) return interaction.error("economy/divorce:NOT_MARRIED");
|
const userData = interaction.data.user;
|
||||||
const user = client.users.cache.get(data.userData.lover) || (await client.users.fetch(data.userData.lover));
|
|
||||||
|
|
||||||
data.userData.lover = null;
|
if (!userData.lover) return interaction.error("economy/divorce:NOT_MARRIED");
|
||||||
|
const user = client.users.cache.get(userData.lover) || await client.users.fetch(userData.lover);
|
||||||
|
|
||||||
data.userData.markModified("lover");
|
userData.lover = null;
|
||||||
await data.userData.save();
|
|
||||||
|
userData.markModified("lover");
|
||||||
|
await userData.save();
|
||||||
|
|
||||||
const oldLover = await client.findOrCreateUser(user.id);
|
const oldLover = await client.findOrCreateUser(user.id);
|
||||||
oldLover.lover = null;
|
oldLover.lover = null;
|
||||||
|
@ -46,11 +47,13 @@ class Divorce extends BaseCommand {
|
||||||
user: user.toString(),
|
user: user.toString(),
|
||||||
});
|
});
|
||||||
|
|
||||||
user.send({
|
try {
|
||||||
content: interaction.translate("economy/divorce:DIVORCED_U", {
|
user.send({
|
||||||
user: interaction.member.toString(),
|
content: interaction.translate("economy/divorce:DIVORCED_U", {
|
||||||
}),
|
user: interaction.member.toString(),
|
||||||
});
|
}),
|
||||||
|
});
|
||||||
|
} catch (e) { /**/ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Leaderboard extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -36,17 +36,18 @@ class Marry extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
if (data.userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED");
|
const userData = interaction.data.user;
|
||||||
|
|
||||||
|
if (userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED");
|
||||||
|
|
||||||
const member = interaction.options.getMember("user");
|
const member = interaction.options.getMember("user");
|
||||||
if (member.user.bot) return interaction.error("economy/marry:BOT_USER");
|
if (member.user.bot) return interaction.error("economy/marry:BOT_USER");
|
||||||
if (member.id === interaction.member.id) return interaction.error("economy/marry:YOURSELF");
|
if (member.id === interaction.member.id) return interaction.error("economy/marry:YOURSELF");
|
||||||
|
|
||||||
const userData = await client.findOrCreateUser(member.id);
|
const otherUserData = await client.findOrCreateUser(member.id);
|
||||||
if (userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED_USER", { user: member.toString() });
|
if (otherUserData.lover) return interaction.error("economy/marry:ALREADY_MARRIED_USER", { user: member.toString() });
|
||||||
|
|
||||||
for (const requester in pendings) {
|
for (const requester in pendings) {
|
||||||
const receiver = pendings[requester];
|
const receiver = pendings[requester];
|
||||||
|
@ -118,13 +119,13 @@ class Marry extends BaseCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reason) {
|
if (reason) {
|
||||||
data.userData.lover = member.id;
|
userData.lover = member.id;
|
||||||
userData.lover = interaction.member.id;
|
otherUserData.lover = interaction.member.id;
|
||||||
|
|
||||||
data.userData.markModified("lover");
|
|
||||||
userData.markModified("lover");
|
userData.markModified("lover");
|
||||||
await data.userData.save();
|
otherUserData.markModified("lover");
|
||||||
await userData.save();
|
await userData.save();
|
||||||
|
await otherUserData.save();
|
||||||
|
|
||||||
const messageOptions = {
|
const messageOptions = {
|
||||||
content: `${member.toString()} :heart: ${interaction.member.toString()}`,
|
content: `${member.toString()} :heart: ${interaction.member.toString()}`,
|
||||||
|
@ -137,9 +138,18 @@ class Marry extends BaseCommand {
|
||||||
};
|
};
|
||||||
|
|
||||||
let sent = false;
|
let sent = false;
|
||||||
if (!userData.achievements.married.achieved) {
|
if (!otherUserData.achievements.married.achieved) {
|
||||||
interaction.followUp(messageOptions);
|
interaction.followUp(messageOptions);
|
||||||
sent = true;
|
sent = true;
|
||||||
|
otherUserData.achievements.married.achieved = true;
|
||||||
|
otherUserData.achievements.married.progress.now = 1;
|
||||||
|
|
||||||
|
otherUserData.markModified("achievements");
|
||||||
|
await otherUserData.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!userData.achievements.married.achieved) {
|
||||||
|
if (!sent) interaction.followUp(messageOptions);
|
||||||
userData.achievements.married.achieved = true;
|
userData.achievements.married.achieved = true;
|
||||||
userData.achievements.married.progress.now = 1;
|
userData.achievements.married.progress.now = 1;
|
||||||
|
|
||||||
|
@ -147,15 +157,6 @@ class Marry extends BaseCommand {
|
||||||
await userData.save();
|
await userData.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.userData.achievements.married.achieved) {
|
|
||||||
if (!sent) interaction.followUp(messageOptions);
|
|
||||||
data.userData.achievements.married.achieved = true;
|
|
||||||
data.userData.achievements.married.progress.now = 1;
|
|
||||||
|
|
||||||
data.userData.markModified("achievements");
|
|
||||||
await data.userData.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
return interaction.editReply({
|
return interaction.editReply({
|
||||||
content: interaction.translate("economy/marry:SUCCESS", {
|
content: interaction.translate("economy/marry:SUCCESS", {
|
||||||
creator: interaction.member.toString(),
|
creator: interaction.member.toString(),
|
||||||
|
|
|
@ -34,17 +34,17 @@ class Money extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
const member = interaction.options.getMember("user") || interaction.member;
|
const member = interaction.options.getMember("user") || interaction.member;
|
||||||
if (member.user.bot) return interaction.error("economy/money:BOT_USER");
|
if (member.user.bot) return interaction.error("economy/money:BOT_USER");
|
||||||
|
|
||||||
const memberData = member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ id: member.id, guildId: interaction.guildId });
|
const memberData = member.id === interaction.user.id ? interaction.data.member : await client.findOrCreateMember({ id: member.id, guildId: interaction.guildId });
|
||||||
|
|
||||||
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));
|
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));
|
||||||
|
|
||||||
let globalMoney = 0;
|
let globalMoney = 0;
|
||||||
await client.functions.asyncForEach(guilds, async guild => {
|
await client.functions.asyncForEach(guilds, async guild => {
|
||||||
const data = await client.findOrCreateMember({
|
const data = await client.findOrCreateMember({
|
||||||
|
|
|
@ -45,53 +45,53 @@ class Pay extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const member = interaction.options.getMember("user");
|
const memberData = interaction.data.member,
|
||||||
if (member.user.bot) return interaction.error("economy/pay:BOT_USER");
|
otherMember = interaction.options.getMember("user");
|
||||||
if (member.id === interaction.member.id) return interaction.error("economy/pay:YOURSELF");
|
if (otherMember.user.bot) return interaction.error("economy/pay:BOT_USER");
|
||||||
|
if (otherMember.id === interaction.member.id) return interaction.error("economy/pay:YOURSELF");
|
||||||
|
|
||||||
const amount = interaction.options.getInteger("amount");
|
const amount = interaction.options.getInteger("amount");
|
||||||
if (amount <= 0) return interaction.error("misc:MORE_THAN_ZERO");
|
if (amount <= 0) return interaction.error("misc:MORE_THAN_ZERO");
|
||||||
if (amount > data.memberData.money)
|
if (amount > memberData.money)
|
||||||
return interaction.error("economy/pay:ENOUGH_MONEY", {
|
return interaction.error("economy/pay:ENOUGH_MONEY", {
|
||||||
amount: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}`,
|
amount: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const memberData = await client.findOrCreateMember({
|
const otherMemberData = await client.findOrCreateMember({
|
||||||
id: member.id,
|
id: otherMember.id,
|
||||||
guildId: interaction.guildId,
|
guildId: interaction.guildId,
|
||||||
});
|
});
|
||||||
|
|
||||||
data.memberData.money -= amount;
|
memberData.money -= amount;
|
||||||
|
|
||||||
data.memberData.markModified("money");
|
|
||||||
await data.memberData.save();
|
|
||||||
|
|
||||||
memberData.money += amount;
|
|
||||||
|
|
||||||
memberData.markModified("money");
|
memberData.markModified("money");
|
||||||
await memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
|
otherMemberData.money += amount;
|
||||||
|
|
||||||
|
otherMemberData.markModified("money");
|
||||||
|
await otherMemberData.save();
|
||||||
|
|
||||||
const info1 = {
|
const info1 = {
|
||||||
user: member.user.getUsername(),
|
user: otherMember.user.getUsername(),
|
||||||
amount: amount,
|
amount: amount,
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
type: "send",
|
type: "send",
|
||||||
};
|
};
|
||||||
data.memberData.transactions.push(info1);
|
memberData.transactions.push(info1);
|
||||||
|
|
||||||
const info2 = {
|
const info2 = {
|
||||||
user: member.user.getUsername(),
|
user: otherMember.user.getUsername(),
|
||||||
amount: amount,
|
amount: amount,
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
type: "got",
|
type: "got",
|
||||||
};
|
};
|
||||||
data.memberData.transactions.push(info2);
|
otherMemberData.transactions.push(info2);
|
||||||
|
|
||||||
interaction.success("economy/pay:SUCCESS", {
|
interaction.success("economy/pay:SUCCESS", {
|
||||||
user: member.toString(),
|
user: otherMember.toString(),
|
||||||
amount: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
amount: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,16 +34,15 @@ class Profile extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
const member = interaction.options.getMember("user") || interaction.member;
|
const member = interaction.options.getMember("user") || interaction.member;
|
||||||
if (member.user.bot) return interaction.error("economy/profile:BOT_USER");
|
if (member.user.bot) return interaction.error("economy/profile:BOT_USER");
|
||||||
|
|
||||||
const memberData = member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ id: member.id, guildId: interaction.guildId });
|
const memberData = member.id === interaction.user.id ? interaction.data.member : await client.findOrCreateMember({ id: member.id, guildId: interaction.guildId });
|
||||||
const userData = member.id === interaction.user.id ? data.userData : await client.findOrCreateUser(member.id);
|
const userData = member.id === interaction.user.id ? interaction.data.user : await client.findOrCreateUser(member.id);
|
||||||
if (userData.lover && !client.users.cache.find(u => u.id === userData.lover)) await client.users.fetch(userData.lover, true);
|
if (userData.lover && !client.users.cache.find(u => u.id === userData.lover)) await client.users.fetch(userData.lover, true);
|
||||||
|
|
||||||
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));
|
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));
|
||||||
|
@ -123,14 +122,14 @@ class Profile extends BaseCommand {
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const buffer = await userData.getAchievements();
|
const achievements = await userData.getAchievements();
|
||||||
|
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
name: "achievements.png",
|
name: "achievements.png",
|
||||||
attachment: buffer,
|
attachment: achievements,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,10 +35,10 @@ class Rep extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const isInCooldown = data.userData.cooldowns?.rep;
|
const userData = interaction.data.user,
|
||||||
|
isInCooldown = userData.cooldowns?.rep;
|
||||||
|
|
||||||
if (isInCooldown) {
|
if (isInCooldown) {
|
||||||
if (isInCooldown > Date.now())
|
if (isInCooldown > Date.now())
|
||||||
|
@ -52,21 +52,21 @@ class Rep extends BaseCommand {
|
||||||
if (user.id === interaction.user.id) return interaction.error("economy/rep:YOURSELF");
|
if (user.id === interaction.user.id) return interaction.error("economy/rep:YOURSELF");
|
||||||
|
|
||||||
const toWait = Math.floor((Date.now() + 12 * 60 * 60 * 1000) / 1000); // 12 hours
|
const toWait = Math.floor((Date.now() + 12 * 60 * 60 * 1000) / 1000); // 12 hours
|
||||||
if (!data.userData.cooldowns) data.userData.cooldowns = {};
|
if (!userData.cooldowns) userData.cooldowns = {};
|
||||||
|
|
||||||
data.userData.cooldowns.rep = toWait;
|
userData.cooldowns.rep = toWait;
|
||||||
|
|
||||||
data.userData.markModified("cooldowns");
|
userData.markModified("cooldowns");
|
||||||
await data.userData.save();
|
await userData.save();
|
||||||
|
|
||||||
const userData = await client.findOrCreateUser(user.id);
|
const otherUserData = await client.findOrCreateUser(user.id);
|
||||||
|
|
||||||
userData.rep++;
|
otherUserData.rep++;
|
||||||
|
|
||||||
if (!userData.achievements.rep.achieved) {
|
if (!otherUserData.achievements.rep.achieved) {
|
||||||
userData.achievements.rep.progress.now = userData.rep > userData.achievements.rep.progress.total ? userData.achievements.rep.progress.total : userData.rep;
|
otherUserData.achievements.rep.progress.now = otherUserData.rep > otherUserData.achievements.rep.progress.total ? otherUserData.achievements.rep.progress.total : otherUserData.rep;
|
||||||
if (userData.achievements.rep.progress.now >= userData.achievements.rep.progress.total) {
|
if (otherUserData.achievements.rep.progress.now >= otherUserData.achievements.rep.progress.total) {
|
||||||
userData.achievements.rep.achieved = true;
|
otherUserData.achievements.rep.achieved = true;
|
||||||
interaction.followUp({
|
interaction.followUp({
|
||||||
content: `${user}`,
|
content: `${user}`,
|
||||||
files: [
|
files: [
|
||||||
|
@ -79,8 +79,8 @@ class Rep extends BaseCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
userData.markModified("rep");
|
otherUserData.markModified("rep");
|
||||||
await userData.save();
|
await otherUserData.save();
|
||||||
|
|
||||||
interaction.success("economy/rep:SUCCESS", {
|
interaction.success("economy/rep:SUCCESS", {
|
||||||
user: user.toString(),
|
user: user.toString(),
|
||||||
|
|
|
@ -45,32 +45,32 @@ class Rob extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const member = interaction.options.getMember("user");
|
const memberData = interaction.data.member,
|
||||||
if (member.user.bot) return interaction.error("economy/pay:BOT_USER");
|
otherMember = interaction.options.getMember("user");
|
||||||
if (member.id === interaction.member.id) return interaction.error("economy/rob:YOURSELF");
|
if (otherMember.user.bot) return interaction.error("economy/pay:BOT_USER");
|
||||||
|
if (otherMember.id === interaction.member.id) return interaction.error("economy/rob:YOURSELF");
|
||||||
|
|
||||||
const amount = interaction.options.getInteger("amount");
|
const amount = interaction.options.getInteger("amount");
|
||||||
if (amount <= 0) return interaction.error("misc:MORE_THAN_ZERO");
|
if (amount <= 0) return interaction.error("misc:MORE_THAN_ZERO");
|
||||||
|
|
||||||
const memberData = await client.findOrCreateMember({
|
const otherMemberData = await client.findOrCreateMember({
|
||||||
id: member.id,
|
id: otherMember.id,
|
||||||
guildId: interaction.guildId,
|
guildId: interaction.guildId,
|
||||||
});
|
});
|
||||||
if (amount > memberData.money) return interaction.error("economy/rob:NOT_ENOUGH_MEMBER", { user: member.toString() });
|
if (amount > otherMemberData.money) return interaction.error("economy/rob:NOT_ENOUGH_MEMBER", { user: otherMember.toString() });
|
||||||
|
|
||||||
const isInCooldown = memberData.cooldowns.rob || 0;
|
const isInCooldown = otherMemberData.cooldowns.rob || 0;
|
||||||
if (isInCooldown) {
|
if (isInCooldown) {
|
||||||
if (isInCooldown > Date.now()) return interaction.error("economy/rob:COOLDOWN", { user: member.toString() });
|
if (isInCooldown > Date.now()) return interaction.error("economy/rob:COOLDOWN", { user: otherMember.toString() });
|
||||||
}
|
}
|
||||||
|
|
||||||
const potentiallyLose = Math.floor(amount * 1.5);
|
const potentiallyLose = Math.floor(amount * 1.5);
|
||||||
if (potentiallyLose > data.memberData.money)
|
if (potentiallyLose > memberData.money)
|
||||||
return interaction.error("economy/rob:NOT_ENOUGH_AUTHOR", {
|
return interaction.error("economy/rob:NOT_ENOUGH_AUTHOR", {
|
||||||
moneyMin: `**${potentiallyLose}** ${client.functions.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
moneyMin: `**${potentiallyLose}** ${client.functions.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
moneyCurrent: `**${data.memberData.money}** ${client.functions.getNoun(data.memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
moneyCurrent: `**${memberData.money}** ${client.functions.getNoun(memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const itsAWon = Math.floor(client.functions.randomNum(0, 100) < 25);
|
const itsAWon = Math.floor(client.functions.randomNum(0, 100) < 25);
|
||||||
|
@ -79,23 +79,23 @@ class Rob extends BaseCommand {
|
||||||
const toWait = Date.now() + 6 * 60 * 60 * 1000,
|
const toWait = Date.now() + 6 * 60 * 60 * 1000,
|
||||||
randomNum = client.functions.randomNum(1, 2);
|
randomNum = client.functions.randomNum(1, 2);
|
||||||
|
|
||||||
memberData.cooldowns.rob = toWait;
|
otherMemberData.cooldowns.rob = toWait;
|
||||||
|
|
||||||
memberData.markModified("cooldowns");
|
otherMemberData.markModified("cooldowns");
|
||||||
await memberData.save();
|
await otherMemberData.save();
|
||||||
|
|
||||||
interaction.replyT("economy/rob:ROB_WON_" + randomNum, {
|
interaction.replyT("economy/rob:ROB_WON_" + randomNum, {
|
||||||
money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
user: member.toString(),
|
user: otherMember.toString(),
|
||||||
});
|
});
|
||||||
|
|
||||||
data.memberData.money += amount;
|
memberData.money += amount;
|
||||||
memberData.money -= amount;
|
otherMemberData.money -= amount;
|
||||||
|
|
||||||
data.memberData.markModified("money");
|
|
||||||
memberData.markModified("money");
|
memberData.markModified("money");
|
||||||
await data.memberData.save();
|
otherMemberData.markModified("money");
|
||||||
await memberData.save();
|
await memberData.save();
|
||||||
|
await otherMemberData.save();
|
||||||
} else {
|
} else {
|
||||||
const won = Math.floor(amount * 0.9),
|
const won = Math.floor(amount * 0.9),
|
||||||
randomNum = client.functions.randomNum(1, 2);
|
randomNum = client.functions.randomNum(1, 2);
|
||||||
|
@ -103,16 +103,16 @@ class Rob extends BaseCommand {
|
||||||
interaction.replyT("economy/rob:ROB_LOSE_" + randomNum, {
|
interaction.replyT("economy/rob:ROB_LOSE_" + randomNum, {
|
||||||
fine: `**${potentiallyLose}** ${client.functions.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
fine: `**${potentiallyLose}** ${client.functions.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
offset: `**${won}** ${client.functions.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
offset: `**${won}** ${client.functions.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
user: member.toString(),
|
user: otherMember.toString(),
|
||||||
});
|
});
|
||||||
|
|
||||||
data.memberData.money -= potentiallyLose;
|
memberData.money -= potentiallyLose;
|
||||||
memberData.money += won;
|
otherMemberData.money += won;
|
||||||
|
|
||||||
data.memberData.markModified("money");
|
|
||||||
memberData.markModified("money");
|
memberData.markModified("money");
|
||||||
await data.memberData.save();
|
otherMemberData.markModified("money");
|
||||||
await memberData.save();
|
await memberData.save();
|
||||||
|
await otherMemberData.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,16 +35,16 @@ class Setbio extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const newBio = interaction.options.getString("text");
|
const userData = interaction.data.user,
|
||||||
|
newBio = interaction.options.getString("text");
|
||||||
if (newBio.length > 150) return interaction.error("economy/setbio:MAX_CHARACTERS");
|
if (newBio.length > 150) return interaction.error("economy/setbio:MAX_CHARACTERS");
|
||||||
|
|
||||||
data.userData.bio = newBio;
|
userData.bio = newBio;
|
||||||
|
|
||||||
data.userData.markModified("bio");
|
userData.markModified("bio");
|
||||||
await data.userData.save();
|
await userData.save();
|
||||||
|
|
||||||
interaction.success("economy/setbio:SUCCESS");
|
interaction.success("economy/setbio:SUCCESS");
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,13 @@ class Slots extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
const amount = interaction.options.getInteger("amount");
|
const { member: memberData, user: userData } = interaction.data,
|
||||||
if (amount > data.memberData.money)
|
amount = interaction.options.getInteger("amount");
|
||||||
|
if (amount > memberData.money)
|
||||||
return interaction.error("economy/slots:NOT_ENOUGH", {
|
return interaction.error("economy/slots:NOT_ENOUGH", {
|
||||||
money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||||
}, { edit: true });
|
}, { edit: true });
|
||||||
|
@ -119,13 +119,13 @@ class Slots extends BaseCommand {
|
||||||
type: "got",
|
type: "got",
|
||||||
};
|
};
|
||||||
|
|
||||||
data.memberData.money += toAdd;
|
memberData.money += toAdd;
|
||||||
data.memberData.transactions.push(info);
|
memberData.transactions.push(info);
|
||||||
|
|
||||||
if (!data.userData.achievements.slots.achieved) {
|
if (!userData.achievements.slots.achieved) {
|
||||||
data.userData.achievements.slots.progress.now += 1;
|
userData.achievements.slots.progress.now += 1;
|
||||||
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
|
if (userData.achievements.slots.progress.now === userData.achievements.slots.progress.total) {
|
||||||
data.userData.achievements.slots.achieved = true;
|
userData.achievements.slots.achieved = true;
|
||||||
interaction.followUp({
|
interaction.followUp({
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
|
@ -136,13 +136,13 @@ class Slots extends BaseCommand {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
data.userData.markModified("achievements");
|
userData.markModified("achievements");
|
||||||
await data.userData.save();
|
await userData.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
data.memberData.markModified("money");
|
memberData.markModified("money");
|
||||||
data.memberData.markModified("transactions");
|
memberData.markModified("transactions");
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -170,13 +170,13 @@ class Slots extends BaseCommand {
|
||||||
type: "got",
|
type: "got",
|
||||||
};
|
};
|
||||||
|
|
||||||
data.memberData.money += toAdd;
|
memberData.money += toAdd;
|
||||||
data.memberData.transactions.push(info);
|
memberData.transactions.push(info);
|
||||||
|
|
||||||
if (!data.userData.achievements.slots.achieved) {
|
if (!userData.achievements.slots.achieved) {
|
||||||
data.userData.achievements.slots.progress.now += 1;
|
userData.achievements.slots.progress.now += 1;
|
||||||
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
|
if (userData.achievements.slots.progress.now === userData.achievements.slots.progress.total) {
|
||||||
data.userData.achievements.slots.achieved = true;
|
userData.achievements.slots.achieved = true;
|
||||||
interaction.followUp({
|
interaction.followUp({
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
|
@ -187,13 +187,13 @@ class Slots extends BaseCommand {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
data.userData.markModified("achievements");
|
userData.markModified("achievements");
|
||||||
await data.userData.save();
|
await userData.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
data.memberData.markModified("money");
|
memberData.markModified("money");
|
||||||
data.memberData.markModified("transactions");
|
memberData.markModified("transactions");
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -213,19 +213,19 @@ class Slots extends BaseCommand {
|
||||||
type: "send",
|
type: "send",
|
||||||
};
|
};
|
||||||
|
|
||||||
data.memberData.money -= amount;
|
memberData.money -= amount;
|
||||||
data.memberData.transactions.push(info);
|
memberData.transactions.push(info);
|
||||||
|
|
||||||
if (!data.userData.achievements.slots.achieved) {
|
if (!userData.achievements.slots.achieved) {
|
||||||
data.userData.achievements.slots.progress.now = 0;
|
userData.achievements.slots.progress.now = 0;
|
||||||
|
|
||||||
data.userData.markModified("achievements");
|
userData.markModified("achievements");
|
||||||
await data.userData.save();
|
await userData.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
data.memberData.markModified("money");
|
memberData.markModified("money");
|
||||||
data.memberData.markModified("transactions");
|
memberData.markModified("transactions");
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,14 +34,15 @@ class Transactions extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
if (interaction.options.getBoolean("clear")) {
|
const memberData = interaction.data.member;
|
||||||
data.memberData.transactions = [];
|
|
||||||
|
|
||||||
data.memberData.markModified("transactions");
|
if (interaction.options.getBoolean("clear")) {
|
||||||
await data.memberData.save();
|
memberData.transactions = [];
|
||||||
|
|
||||||
|
memberData.markModified("transactions");
|
||||||
|
await memberData.save();
|
||||||
|
|
||||||
return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true });
|
return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true });
|
||||||
}
|
}
|
||||||
|
@ -52,7 +53,7 @@ class Transactions extends BaseCommand {
|
||||||
iconURL: interaction.member.displayAvatarURL(),
|
iconURL: interaction.member.displayAvatarURL(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const transactions = data.memberData.transactions,
|
const transactions = memberData.transactions,
|
||||||
sortedTransactions = [[], []];
|
sortedTransactions = [[], []];
|
||||||
|
|
||||||
transactions.slice(-20).forEach(t => {
|
transactions.slice(-20).forEach(t => {
|
||||||
|
|
|
@ -25,10 +25,10 @@ class Work extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const isInCooldown = data.memberData.cooldowns?.work;
|
const { member: memberData, user: userData } = interaction.data,
|
||||||
|
isInCooldown = memberData.cooldowns?.work;
|
||||||
|
|
||||||
if (isInCooldown) {
|
if (isInCooldown) {
|
||||||
if (isInCooldown > Date.now())
|
if (isInCooldown > Date.now())
|
||||||
|
@ -37,15 +37,15 @@ class Work extends BaseCommand {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Date.now() > data.memberData.cooldowns.work + 24 * 60 * 60 * 1000) data.memberData.workStreak = 0;
|
if (Date.now() > memberData.cooldowns.work + 24 * 60 * 60 * 1000) memberData.workStreak = 0;
|
||||||
|
|
||||||
const toWait = Math.floor((Date.now() + 24 * 60 * 60 * 1000) / 1000); // 24 hours
|
const toWait = Math.floor((Date.now() + 24 * 60 * 60 * 1000) / 1000); // 24 hours
|
||||||
data.memberData.cooldowns.work = toWait;
|
memberData.cooldowns.work = toWait;
|
||||||
data.memberData.workStreak = (data.memberData.workStreak || 0) + 1;
|
memberData.workStreak = (memberData.workStreak || 0) + 1;
|
||||||
|
|
||||||
data.memberData.markModified("cooldowns");
|
memberData.markModified("cooldowns");
|
||||||
data.memberData.markModified("workStreak");
|
memberData.markModified("workStreak");
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
const embed = client.embed({
|
const embed = client.embed({
|
||||||
footer: {
|
footer: {
|
||||||
|
@ -57,7 +57,7 @@ class Work extends BaseCommand {
|
||||||
const award = [client.customEmojis.letters.a, client.customEmojis.letters.w, client.customEmojis.letters.a, client.customEmojis.letters.r, client.customEmojis.letters.d];
|
const award = [client.customEmojis.letters.a, client.customEmojis.letters.w, client.customEmojis.letters.a, client.customEmojis.letters.r, client.customEmojis.letters.d];
|
||||||
let won = 200;
|
let won = 200;
|
||||||
|
|
||||||
if (data.memberData.workStreak >= 5) {
|
if (memberData.workStreak >= 5) {
|
||||||
won += 200;
|
won += 200;
|
||||||
embed.fields = [
|
embed.fields = [
|
||||||
{
|
{
|
||||||
|
@ -71,10 +71,11 @@ class Work extends BaseCommand {
|
||||||
value: interaction.translate("economy/work:STREAK_CONTENT"),
|
value: interaction.translate("economy/work:STREAK_CONTENT"),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
data.memberData.workStreak = 0;
|
|
||||||
|
memberData.workStreak = 0;
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < award.length; i++) {
|
for (let i = 0; i < award.length; i++) {
|
||||||
if (data.memberData.workStreak > i) {
|
if (memberData.workStreak > i) {
|
||||||
const letter = parseEmoji(award[i]).name.split("_")[1];
|
const letter = parseEmoji(award[i]).name.split("_")[1];
|
||||||
award[i] = `:regional_indicator_${letter.toLowerCase()}:`;
|
award[i] = `:regional_indicator_${letter.toLowerCase()}:`;
|
||||||
}
|
}
|
||||||
|
@ -93,10 +94,10 @@ class Work extends BaseCommand {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
data.memberData.money += won;
|
memberData.money += won;
|
||||||
|
|
||||||
data.memberData.markModified("money");
|
memberData.markModified("money");
|
||||||
await data.memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
user: interaction.translate("economy/work:SALARY"),
|
user: interaction.translate("economy/work:SALARY"),
|
||||||
|
@ -104,26 +105,26 @@ class Work extends BaseCommand {
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
type: "got",
|
type: "got",
|
||||||
};
|
};
|
||||||
data.memberData.transactions.push(info);
|
memberData.transactions.push(info);
|
||||||
|
|
||||||
const messageOptions = {
|
const messageOptions = {
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!data.userData.achievements.work.achieved) {
|
if (!userData.achievements.work.achieved) {
|
||||||
data.userData.achievements.work.progress.now += 1;
|
userData.achievements.work.progress.now += 1;
|
||||||
if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) {
|
if (userData.achievements.work.progress.now === userData.achievements.work.progress.total) {
|
||||||
messageOptions.files = [
|
messageOptions.files = [
|
||||||
{
|
{
|
||||||
name: "unlocked.png",
|
name: "unlocked.png",
|
||||||
attachment: "./assets/img/achievements/achievement_unlocked1.png",
|
attachment: "./assets/img/achievements/achievement_unlocked1.png",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
data.userData.achievements.work.achieved = true;
|
userData.achievements.work.achieved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.userData.markModified("achievements");
|
userData.markModified("achievements");
|
||||||
await data.userData.save();
|
await userData.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
interaction.reply(messageOptions);
|
interaction.reply(messageOptions);
|
||||||
|
|
|
@ -35,7 +35,6 @@ class Eightball extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -26,7 +26,6 @@ class Cat extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -26,7 +26,6 @@ class Dog extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -46,7 +46,6 @@ class LMGTFY extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
|
@ -45,7 +45,6 @@ class Lovecalc extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const firstMember = interaction.options.getMember("first_member"),
|
const firstMember = interaction.options.getMember("first_member"),
|
||||||
|
|
|
@ -26,7 +26,6 @@ class Number extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
if (currentGames[interaction.guildId]) return interaction.error("fun/number:GAME_RUNNING");
|
if (currentGames[interaction.guildId]) return interaction.error("fun/number:GAME_RUNNING");
|
||||||
|
|
|
@ -36,7 +36,6 @@ class TicTacToe extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
tictactoe(interaction, {
|
tictactoe(interaction, {
|
||||||
|
|
|
@ -35,17 +35,17 @@ class Afk extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
const reason = interaction.options.getString("message");
|
const userData = interaction.data.user,
|
||||||
|
reason = interaction.options.getString("message");
|
||||||
|
|
||||||
data.userData.afk = reason;
|
userData.afk = reason;
|
||||||
|
|
||||||
data.userData.markModified("afk");
|
userData.markModified("afk");
|
||||||
await data.userData.save();
|
await userData.save();
|
||||||
|
|
||||||
interaction.success("general/afk:SUCCESS", {
|
interaction.success("general/afk:SUCCESS", {
|
||||||
reason,
|
reason,
|
||||||
|
|
|
@ -21,7 +21,6 @@ class AvatarContext extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").UserContextMenuCommandInteraction} interaction
|
* @param {import("discord.js").UserContextMenuCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const avatarURL = interaction.targetUser.displayAvatarURL({ size: 2048 });
|
const avatarURL = interaction.targetUser.displayAvatarURL({ size: 2048 });
|
||||||
|
|
|
@ -43,7 +43,6 @@ class Avatar extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const member = interaction.options.getMember("user") || interaction.member;
|
const member = interaction.options.getMember("user") || interaction.member;
|
||||||
|
|
|
@ -30,9 +30,11 @@ class Boosters extends BaseCommand {
|
||||||
if (!interaction.isButton()) return;
|
if (!interaction.isButton()) return;
|
||||||
|
|
||||||
if (interaction.customId.startsWith("boosters_")) {
|
if (interaction.customId.startsWith("boosters_")) {
|
||||||
const guildData = client.findOrCreateGuild(interaction.guildId),
|
interaction.data = [];
|
||||||
boosters = (await interaction.guild.members.fetch()).filter(m => m.premiumSince),
|
interaction.data.guild = await client.findOrCreateGuild(interaction.guildId);
|
||||||
embeds = generateBoostersEmbeds(client, interaction, boosters, guildData);
|
|
||||||
|
const boosters = (await interaction.guild.members.fetch()).filter(m => m.premiumSince),
|
||||||
|
embeds = generateBoostersEmbeds(client, interaction, boosters);
|
||||||
|
|
||||||
const row = new ActionRowBuilder().addComponents(
|
const row = new ActionRowBuilder().addComponents(
|
||||||
new ButtonBuilder().setCustomId("boosters_prev_page").setStyle(ButtonStyle.Primary).setEmoji("⬅️"),
|
new ButtonBuilder().setCustomId("boosters_prev_page").setStyle(ButtonStyle.Primary).setEmoji("⬅️"),
|
||||||
|
@ -115,7 +117,6 @@ class Boosters extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -35,7 +35,6 @@ class Emoji extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const rawEmoji = interaction.options.getString("emoji");
|
const rawEmoji = interaction.options.getString("emoji");
|
||||||
|
|
|
@ -42,6 +42,9 @@ class Help extends BaseCommand {
|
||||||
if (interaction.customId === "help_category_select") {
|
if (interaction.customId === "help_category_select") {
|
||||||
await interaction.deferUpdate();
|
await interaction.deferUpdate();
|
||||||
|
|
||||||
|
interaction.data = [];
|
||||||
|
interaction.data.guild = await client.findOrCreateGuild(interaction.guildId);
|
||||||
|
|
||||||
const arg = interaction?.values[0];
|
const arg = interaction?.values[0];
|
||||||
const categoryCommands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()]
|
const categoryCommands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()]
|
||||||
.filter(cmd => cmd.category === arg)
|
.filter(cmd => cmd.category === arg)
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Minecraft extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -25,7 +25,6 @@ class Ping extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const embed = client.embed({
|
const embed = client.embed({
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const { SlashCommandBuilder } = require("discord.js");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
const BaseCommand = require("../../base/BaseCommand"),
|
const BaseCommand = require("../../base/BaseCommand"),
|
||||||
ms = require("ms"),
|
ms = require("ms");
|
||||||
moment = require("moment");
|
|
||||||
|
|
||||||
class Remindme extends BaseCommand {
|
class Remindme extends BaseCommand {
|
||||||
/**
|
/**
|
||||||
|
@ -47,38 +46,39 @@ class Remindme extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
if (!data.userData.reminds) data.userData.reminds = [];
|
const userData = interaction.data.user;
|
||||||
|
|
||||||
|
if (!userData.reminds) userData.reminds = [];
|
||||||
|
|
||||||
const dateNow = Date.now();
|
const dateNow = Date.now();
|
||||||
|
|
||||||
const reminderData = {
|
const reminder = {
|
||||||
message: interaction.options.getString("message"),
|
message: interaction.options.getString("message"),
|
||||||
createdAt: dateNow,
|
createdAt: Math.floor(dateNow / 1000),
|
||||||
sendAt: dateNow + ms(interaction.options.getString("time")),
|
sendAt: Math.floor((dateNow + ms(interaction.options.getString("time"))) / 1000),
|
||||||
};
|
};
|
||||||
|
|
||||||
data.userData.reminds.push(reminderData);
|
userData.reminds.push(reminder);
|
||||||
|
|
||||||
data.userData.markModified("reminds");
|
userData.markModified("reminds");
|
||||||
await data.userData.save();
|
await userData.save();
|
||||||
|
|
||||||
client.databaseCache.usersReminds.set(interaction.user.id, data.userData);
|
client.databaseCache.usersReminds.set(interaction.user.id, userData);
|
||||||
|
|
||||||
const embed = client.embed({
|
const embed = client.embed({
|
||||||
author: interaction.translate("general/remindme:EMBED_SAVED"),
|
author: interaction.translate("general/remindme:EMBED_SAVED"),
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: interaction.translate("general/remindme:EMBED_TIME"),
|
name: interaction.translate("general/remindme:EMBED_TIME"),
|
||||||
value: moment(reminderData.sendAt).locale(interaction.getLocale()).format("Do MMMM YYYY, HH:mm:ss"),
|
value: `<t:${reminder.sendAt}:R>`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: interaction.translate("common:MESSAGE"),
|
name: interaction.translate("common:MESSAGE"),
|
||||||
value: reminderData.message,
|
value: reminder.message,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,10 +45,10 @@ class Report extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const repChannel = interaction.guild.channels.cache.get(data.guildData.plugins.reports);
|
const guildData = interaction.data.guild,
|
||||||
|
repChannel = interaction.guild.channels.cache.get(guildData.plugins.reports);
|
||||||
if (!repChannel) return interaction.error("general/report:MISSING_CHANNEL");
|
if (!repChannel) return interaction.error("general/report:MISSING_CHANNEL");
|
||||||
|
|
||||||
const member = interaction.options.getMember("user");
|
const member = interaction.options.getMember("user");
|
||||||
|
|
|
@ -25,10 +25,9 @@ class Serverinfo extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const guild = interaction.guild;
|
const { guild } = interaction;
|
||||||
|
|
||||||
await guild.members.fetch();
|
await guild.members.fetch();
|
||||||
const owner = await guild.fetchOwner();
|
const owner = await guild.fetchOwner();
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Shorturl extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const url = interaction.options.getString("url");
|
const url = interaction.options.getString("url");
|
||||||
|
|
|
@ -25,7 +25,6 @@ class Stats extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const hiddenGuildMembersCount = client.guilds.cache.get("568120814776614924").memberCount;
|
const hiddenGuildMembersCount = client.guilds.cache.get("568120814776614924").memberCount;
|
||||||
|
|
|
@ -35,10 +35,10 @@ class Suggest extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const channel = interaction.guild.channels.cache.get(data.guildData.plugins.suggestions);
|
const guildData = interaction.data.guild,
|
||||||
|
channel = interaction.guild.channels.cache.get(guildData.plugins.suggestions);
|
||||||
if (!channel) return interaction.error("general/suggest:MISSING_CHANNEL");
|
if (!channel) return interaction.error("general/suggest:MISSING_CHANNEL");
|
||||||
|
|
||||||
const suggestion = interaction.options.getString("message");
|
const suggestion = interaction.options.getString("message");
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Whois extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -55,12 +55,13 @@ class Checkjar extends BaseCommand {
|
||||||
jarTransactions.length = 10;
|
jarTransactions.length = 10;
|
||||||
|
|
||||||
jarTransactions.forEach(t => {
|
jarTransactions.forEach(t => {
|
||||||
|
// TODO
|
||||||
const time = moment.unix(t.time);
|
const time = moment.unix(t.time);
|
||||||
|
|
||||||
embed.data.fields.push([
|
embed.data.fields.push([
|
||||||
{
|
{
|
||||||
name: `${t.description}`,
|
name: `${t.description}`,
|
||||||
value: `Дата: ${time.locale("uk-UA").format("DD MMMM YYYY, HH:mm")}\nСумма: ${t.amount / Math.pow(10, 2)} грн`,
|
value: `Дата: <t:${time}:D>\nСумма: ${t.amount / Math.pow(10, 2)} грн`,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,7 +54,6 @@ class Clear extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Clearwarns extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const member = interaction.options.getMember("user");
|
const member = interaction.options.getMember("user");
|
||||||
|
|
|
@ -133,7 +133,6 @@ class Giveaway extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const command = interaction.options.getSubcommand();
|
const command = interaction.options.getSubcommand();
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Poll extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const question = interaction.options.getString("question");
|
const question = interaction.options.getString("question");
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Unban extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const id = interaction.options.getString("user_id"),
|
const id = interaction.options.getString("user_id"),
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Ban extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -22,9 +22,8 @@ class WarnContext extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").UserContextMenuCommandInteraction} interaction
|
* @param {import("discord.js").UserContextMenuCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
const member = interaction.targetMember,
|
const member = interaction.targetMember,
|
||||||
memberPosition = member.roles.highest.position,
|
memberPosition = member.roles.highest.position,
|
||||||
moderationPosition = interaction.member.roles.highest.position;
|
moderationPosition = interaction.member.roles.highest.position;
|
||||||
|
@ -180,8 +179,10 @@ class WarnContext extends BaseCommand {
|
||||||
memberData.markModified("sanctions");
|
memberData.markModified("sanctions");
|
||||||
await memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
if (data.guildData.plugins.modlogs) {
|
const guildData = interaction.data.guild;
|
||||||
const channel = interaction.guild.channels.cache.get(data.guildData.plugins.modlogs);
|
|
||||||
|
if (guildData.plugins.modlogs) {
|
||||||
|
const channel = interaction.guild.channels.cache.get(guildData.plugins.modlogs);
|
||||||
if (!channel) return;
|
if (!channel) return;
|
||||||
|
|
||||||
channel.send({
|
channel.send({
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Warns extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const member = interaction.options.getMember("user");
|
const member = interaction.options.getMember("user");
|
||||||
|
|
|
@ -25,7 +25,6 @@ class Back extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -38,7 +38,6 @@ class Clips extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -42,7 +42,6 @@ class Loop extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -31,6 +31,9 @@ class Nowplaying extends BaseCommand {
|
||||||
if (!interaction.isButton()) return;
|
if (!interaction.isButton()) return;
|
||||||
|
|
||||||
if (interaction.customId.startsWith("nowp_")) {
|
if (interaction.customId.startsWith("nowp_")) {
|
||||||
|
interaction.data = [];
|
||||||
|
interaction.data.guild = await client.findOrCreateGuild(interaction.guildId);
|
||||||
|
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
||||||
|
|
||||||
|
@ -119,19 +122,22 @@ class Nowplaying extends BaseCommand {
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO Fix error in collected if user doesnt send anything
|
|
||||||
const filter = m => m.author.id === interaction.user.id && m.content.startsWith("http"),
|
const filter = m => m.author.id === interaction.user.id && m.content.startsWith("http"),
|
||||||
collected = (await interaction.channel.awaitMessages({ filter, time: 10 * 1000, max: 1 })).first(),
|
collect = await interaction.channel.awaitMessages({ filter, time: 10 * 1000, max: 1 });
|
||||||
|
if (collect.size < 1) return;
|
||||||
|
|
||||||
|
|
||||||
|
const collected = collect.first(),
|
||||||
query = collected.content.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g)[0],
|
query = collected.content.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g)[0],
|
||||||
searchResult = await client.player.search(query, {
|
searchResult = await client.player.search(query, {
|
||||||
requestedBy: interaction.user,
|
requestedBy: interaction.user,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (collected.deletable) collected.delete();
|
||||||
|
|
||||||
if (!searchResult.hasTracks()) return interaction.error("music/play:NO_RESULT", { query: query }, { edit: true });
|
if (!searchResult.hasTracks()) return interaction.error("music/play:NO_RESULT", { query: query }, { edit: true });
|
||||||
else queue.addTrack(searchResult);
|
else queue.addTrack(searchResult);
|
||||||
|
|
||||||
if (collected.deletable) collected.delete();
|
|
||||||
|
|
||||||
await interaction.followUp({
|
await interaction.followUp({
|
||||||
content: interaction.translate("music/play:ADDED_QUEUE", {
|
content: interaction.translate("music/play:ADDED_QUEUE", {
|
||||||
songName: searchResult.hasPlaylist() ? searchResult.playlist.title : searchResult.tracks[0].title,
|
songName: searchResult.hasPlaylist() ? searchResult.playlist.title : searchResult.tracks[0].title,
|
||||||
|
@ -221,7 +227,7 @@ class Nowplaying extends BaseCommand {
|
||||||
components: [row1, row2],
|
components: [row1, row2],
|
||||||
});
|
});
|
||||||
} else clearInterval(i);
|
} else clearInterval(i);
|
||||||
}, 1 * 60 * 1000);
|
}, 60 * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +240,6 @@ class Nowplaying extends BaseCommand {
|
||||||
async function updateEmbed(interaction, queue) {
|
async function updateEmbed(interaction, queue) {
|
||||||
const progressBar = queue.node.createProgressBar(),
|
const progressBar = queue.node.createProgressBar(),
|
||||||
track = queue.currentTrack,
|
track = queue.currentTrack,
|
||||||
data = await interaction.client.guildsData.findOne({ id: interaction.guildId }),
|
|
||||||
mode = queue.repeatMode === QueueRepeatMode.AUTOPLAY ? "3" : queue.repeatMode === QueueRepeatMode.QUEUE ? "2" : queue.repeatMode === QueueRepeatMode.TRACK ? "1" : "0",
|
mode = queue.repeatMode === QueueRepeatMode.AUTOPLAY ? "3" : queue.repeatMode === QueueRepeatMode.QUEUE ? "2" : queue.repeatMode === QueueRepeatMode.TRACK ? "1" : "0",
|
||||||
translated = {
|
translated = {
|
||||||
"3": interaction.translate("music/loop:AUTOPLAY"),
|
"3": interaction.translate("music/loop:AUTOPLAY"),
|
||||||
|
@ -260,7 +265,7 @@ async function updateEmbed(interaction, queue) {
|
||||||
{ name: "\u200B", value: "\u200B", inline: true },
|
{ name: "\u200B", value: "\u200B", inline: true },
|
||||||
{
|
{
|
||||||
name: interaction.translate("common:VIEWS"),
|
name: interaction.translate("common:VIEWS"),
|
||||||
value: track.raw.live ? "Live" : new Intl.NumberFormat(interaction.client.languages.find(language => language.name === data.language).moment, { notation: "standard" }).format(track.raw.views),
|
value: track.raw.live ? "Live" : new Intl.NumberFormat(interaction.client.defaultLanguage.moment, { notation: "standard" }).format(track.raw.views),
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,6 @@ class PlayContext extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").MessageContextMenuCommandInteraction} interaction
|
* @param {import("discord.js").MessageContextMenuCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -37,7 +37,6 @@ class Play extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -30,6 +30,9 @@ class Queue extends BaseCommand {
|
||||||
if (!interaction.isButton()) return;
|
if (!interaction.isButton()) return;
|
||||||
|
|
||||||
if (interaction.customId.startsWith("queue_")) {
|
if (interaction.customId.startsWith("queue_")) {
|
||||||
|
interaction.data = [];
|
||||||
|
interaction.data.guld = await client.findOrCreateGuild(interaction.guildId);
|
||||||
|
|
||||||
const queue = client.player.nodes.get(interaction.guildId);
|
const queue = client.player.nodes.get(interaction.guildId);
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
||||||
|
|
||||||
|
@ -119,7 +122,6 @@ class Queue extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const queue = client.player.nodes.get(interaction.guildId);
|
const queue = client.player.nodes.get(interaction.guildId);
|
||||||
|
|
|
@ -34,7 +34,6 @@ class Seek extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const time = interaction.options.getInteger("time"),
|
const time = interaction.options.getInteger("time"),
|
||||||
|
|
|
@ -25,7 +25,6 @@ class Shuffle extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -25,7 +25,6 @@ class Skip extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -35,7 +35,6 @@ class Skipto extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -25,7 +25,6 @@ class Stop extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -36,7 +36,6 @@ class Volume extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
|
|
@ -33,6 +33,9 @@ class NSFW extends BaseCommand {
|
||||||
if (interaction.customId === "nsfw_select") {
|
if (interaction.customId === "nsfw_select") {
|
||||||
await interaction.deferUpdate();
|
await interaction.deferUpdate();
|
||||||
|
|
||||||
|
interaction.data = [];
|
||||||
|
interaction.data.guild = await client.findOrCreateGuild(interaction.guildId);
|
||||||
|
|
||||||
const tag = interaction?.values[0],
|
const tag = interaction?.values[0],
|
||||||
splitted = tag.split("_"),
|
splitted = tag.split("_"),
|
||||||
res = await fetch(`https://nsfw-api-p302.onrender.com/media/${splitted[0].charAt(0).toLowerCase()}/${splitted[1].toLowerCase()}`).then(async r => await r.buffer()),
|
res = await fetch(`https://nsfw-api-p302.onrender.com/media/${splitted[0].charAt(0).toLowerCase()}/${splitted[1].toLowerCase()}`).then(async r => await r.buffer()),
|
||||||
|
@ -55,12 +58,11 @@ class NSFW extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
if (interaction.guildId && !interaction.channel.nsfw) return interaction.error("misc:NSFW_COMMAND", null, { edit: true, ephemeral: true });
|
if (interaction.guild && !interaction.channel.nsfw) return interaction.error("misc:NSFW_COMMAND", null, { edit: true, ephemeral: true });
|
||||||
|
|
||||||
const tags = ["Hentai_Vanila", "Hentai_Yaoi", "Hentai_Yuri", "Hentai_BDSM", "Hentai_Trap", "Real_Ass", "Real_Boobs", "Real_Pussy"]
|
const tags = ["Hentai_Vanila", "Hentai_Yaoi", "Hentai_Yuri", "Hentai_BDSM", "Hentai_Trap", "Real_Ass", "Real_Boobs", "Real_Pussy"]
|
||||||
.map(tag =>
|
.map(tag =>
|
||||||
|
|
|
@ -117,7 +117,6 @@ class Debug extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Array} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const command = interaction.options.getSubcommand();
|
const command = interaction.options.getSubcommand();
|
||||||
|
|
|
@ -35,10 +35,8 @@ class Eval extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line no-unused-vars
|
async execute(client, interaction) {
|
||||||
async execute(client, interaction, data) {
|
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
const code = interaction.options.getString("code");
|
const code = interaction.options.getString("code");
|
||||||
|
|
|
@ -38,7 +38,6 @@ class Reload extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const command = interaction.options.getString("command"),
|
const command = interaction.options.getString("command"),
|
||||||
|
|
|
@ -53,7 +53,6 @@ class Say extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
|
@ -25,7 +25,6 @@ class Servers extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
|
@ -36,7 +36,6 @@ class AddUser extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -26,11 +26,12 @@ class CloseTicket extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
|
const guildData = interaction.data.guild;
|
||||||
|
|
||||||
if (!interaction.channel.name.includes("support")) return interaction.error("tickets/adduser:NOT_TICKET", null, { ephemeral: true, edit: true });
|
if (!interaction.channel.name.includes("support")) return interaction.error("tickets/adduser:NOT_TICKET", null, { ephemeral: true, edit: true });
|
||||||
|
|
||||||
const embed = client.embed({
|
const embed = client.embed({
|
||||||
|
@ -66,8 +67,8 @@ class CloseTicket extends BaseCommand {
|
||||||
|
|
||||||
collector.on("end", async (_, reason) => {
|
collector.on("end", async (_, reason) => {
|
||||||
if (reason !== "canceled") {
|
if (reason !== "canceled") {
|
||||||
const transcriptionLogs = data.guildData.plugins.tickets.transcriptionLogs,
|
const transcriptionLogs = guildData.plugins.tickets.transcriptionLogs,
|
||||||
ticketLogs = data.guildData.plugins.tickets.ticketLogs;
|
ticketLogs = guildData.plugins.tickets.ticketLogs;
|
||||||
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot);
|
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot);
|
||||||
const messages = Array.from(reversedMessages.values()).reverse();
|
const messages = Array.from(reversedMessages.values()).reverse();
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ class CloseTicket extends BaseCommand {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const ticketLogs = data.guildData.plugins.tickets.ticketLogs;
|
const ticketLogs = guildData.plugins.tickets.ticketLogs;
|
||||||
const logEmbed = client.embed({
|
const logEmbed = client.embed({
|
||||||
title: interaction.translate("tickets/closeticket:CLOSED_TITLE"),
|
title: interaction.translate("tickets/closeticket:CLOSED_TITLE"),
|
||||||
fields: [
|
fields: [
|
||||||
|
|
|
@ -30,13 +30,15 @@ class CreateTicketEmbed extends BaseCommand {
|
||||||
client.on("interactionCreate", async interaction => {
|
client.on("interactionCreate", async interaction => {
|
||||||
if (!interaction.isButton()) return;
|
if (!interaction.isButton()) return;
|
||||||
|
|
||||||
const guildData = await client.findOrCreateGuild(interaction.guildId);
|
|
||||||
|
|
||||||
const ticketsCategory = guildData.plugins.tickets.ticketsCategory,
|
|
||||||
ticketLogs = guildData.plugins.tickets.ticketLogs,
|
|
||||||
transcriptionLogs = guildData.plugins.tickets.transcriptionLogs;
|
|
||||||
|
|
||||||
if (interaction.isButton()) {
|
if (interaction.isButton()) {
|
||||||
|
interaction.data = [];
|
||||||
|
interaction.data.guild = await client.findOrCreateGuild(interaction.guildId);
|
||||||
|
|
||||||
|
const guildData = interaction.guild.data,
|
||||||
|
ticketsCategory = guildData.plugins.tickets.ticketsCategory,
|
||||||
|
ticketLogs = guildData.plugins.tickets.ticketLogs,
|
||||||
|
transcriptionLogs = guildData.plugins.tickets.transcriptionLogs;
|
||||||
|
|
||||||
const button = interaction.component;
|
const button = interaction.component;
|
||||||
|
|
||||||
if (button.customId === "support_ticket") {
|
if (button.customId === "support_ticket") {
|
||||||
|
@ -206,10 +208,11 @@ class CreateTicketEmbed extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction) {
|
||||||
if (!data.guildData.plugins.tickets.ticketsCategory) return interaction.error("tickets/createticketembed:NO_CATEGORY");
|
const guildData = interaction.data.guild;
|
||||||
|
|
||||||
|
if (!guildData.plugins.tickets.ticketsCategory) return interaction.error("tickets/createticketembed:NO_CATEGORY");
|
||||||
|
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ class RemoveUser extends BaseCommand {
|
||||||
*
|
*
|
||||||
* @param {import("../../base/Client")} client
|
* @param {import("../../base/Client")} client
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
* @param {Object} data
|
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
|
@ -16,27 +16,27 @@ class CommandHandler extends BaseEvent {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const command = client.commands.get(interaction.commandName);
|
const command = client.commands.get(interaction.commandName);
|
||||||
|
|
||||||
const data = [];
|
const data = [];
|
||||||
|
|
||||||
const userData = await client.findOrCreateUser(interaction.user.id);
|
data.user = await client.findOrCreateUser(interaction.user.id);
|
||||||
data.userData = userData;
|
|
||||||
|
|
||||||
if (interaction.inGuild()) {
|
if (interaction.inGuild()) {
|
||||||
const guildData = await client.findOrCreateGuild(interaction.guildId);
|
data.guild = await client.findOrCreateGuild(interaction.guildId);
|
||||||
const memberData = await client.findOrCreateMember({ id: interaction.member.id, guildId: interaction.guildId });
|
data.member = await client.findOrCreateMember({ id: interaction.member.id, guildId: interaction.guildId });
|
||||||
|
|
||||||
interaction.guild.data = data.guildData = guildData;
|
|
||||||
data.memberData = memberData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command?.dirname.includes("IAT") && interaction.guildId !== "1039187019957555252") return interaction.reply({ content: "IAT Only", ephemeral: true });
|
interaction.data = data;
|
||||||
if (interaction.isAutocomplete()) return await command.autocompleteRun(client, interaction);
|
|
||||||
if (interaction.isButton() && interaction.customId === "quote_delete" && interaction.message.deletable) return interaction.message.delete();
|
if (interaction.isButton() && interaction.customId === "quote_delete" && interaction.message.deletable) return interaction.message.delete();
|
||||||
|
if (interaction.isAutocomplete()) return await command.autocompleteRun(client, interaction);
|
||||||
|
|
||||||
if (interaction.type !== InteractionType.ApplicationCommand && !interaction.isCommand()) return;
|
if (interaction.type !== InteractionType.ApplicationCommand && !interaction.isCommand()) return;
|
||||||
|
|
||||||
|
if (command?.dirname.includes("IAT") && interaction.guildId !== "1039187019957555252") return interaction.reply({ content: "IAT Only", ephemeral: true });
|
||||||
if (command.ownerOnly && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { ephemeral: true });
|
if (command.ownerOnly && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { ephemeral: true });
|
||||||
|
|
||||||
if (!userData.achievements.firstCommand.achieved) {
|
if (!interaction.data.user.achievements.firstCommand.achieved) {
|
||||||
const args = {
|
const args = {
|
||||||
content: interaction.user.toString(),
|
content: interaction.user.toString(),
|
||||||
files: [
|
files: [
|
||||||
|
@ -47,20 +47,29 @@ class CommandHandler extends BaseEvent {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
userData.achievements.firstCommand.progress.now = 1;
|
interaction.data.user.achievements.firstCommand.progress.now = 1;
|
||||||
userData.achievements.firstCommand.achieved = true;
|
interaction.data.user.achievements.firstCommand.achieved = true;
|
||||||
|
|
||||||
userData.markModified("achievements");
|
interaction.data.user.markModified("achievements");
|
||||||
await userData.save();
|
await interaction.data.user.save();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
interaction.user.send(args);
|
interaction.user.send(args);
|
||||||
} catch (e) { /**/ }
|
} catch (e) { /**/ }
|
||||||
}
|
}
|
||||||
|
|
||||||
client.logger.cmd(`User ${interaction.user.getUsername()} used ${command.command.name} in ${interaction.guild ? interaction.guild.name : "DM"} with arguments: ${interaction.options.data.length > 0 ? interaction.options.data.map(arg => { return `${arg.name}: ${arg.value}`; }).join(", ") : "no args" }`);
|
client.logger.cmd(
|
||||||
|
`User ${interaction.user.getUsername()} used ${command.command.name} in ${interaction.guild ? interaction.guild.name : "DM"} with arguments: ${
|
||||||
|
interaction.options.data.length > 0
|
||||||
|
? interaction.options.data
|
||||||
|
.map(arg => {
|
||||||
|
return `${arg.name}: ${arg.value}`;
|
||||||
|
}).join(", ")
|
||||||
|
: "no args"
|
||||||
|
}`,
|
||||||
|
);
|
||||||
|
|
||||||
return command.execute(client, interaction, data);
|
return command.execute(client, interaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,25 +19,24 @@ class MessageCreate extends BaseEvent {
|
||||||
async execute(client, message) {
|
async execute(client, message) {
|
||||||
if (message.guild && message.guild.id === "568120814776614924") return;
|
if (message.guild && message.guild.id === "568120814776614924") return;
|
||||||
|
|
||||||
const data = {};
|
const data = [];
|
||||||
|
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) return message.replyT("misc:HELLO_SERVER", null, { mention: true });
|
if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) return message.replyT("misc:HELLO_SERVER", null, { mention: true });
|
||||||
|
|
||||||
const userData = await client.findOrCreateUser(message.author.id);
|
data.user = await client.findOrCreateUser(message.author.id);
|
||||||
data.userData = userData;
|
|
||||||
|
|
||||||
if (message.guild && !message.member) await message.guild.members.fetch(message.author.id);
|
|
||||||
if (message.guild) {
|
if (message.guild) {
|
||||||
const guildData = await client.findOrCreateGuild(message.guildId);
|
if (!message.member) await message.guild.members.fetch(message.author.id);
|
||||||
const memberData = await client.findOrCreateMember({ id: message.author.id, guildId: message.guildId });
|
|
||||||
|
|
||||||
message.guild.data = data.guildData = guildData;
|
data.guild = await client.findOrCreateGuild(message.guildId);
|
||||||
data.memberData = memberData;
|
data.member = await client.findOrCreateMember({ id: message.author.id, guildId: message.guildId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message.data = data;
|
||||||
|
|
||||||
if (message.guild) {
|
if (message.guild) {
|
||||||
await updateXp(client, message, data.memberData);
|
await updateXp(message);
|
||||||
|
|
||||||
if (message.content.match(/(https|http):\/\/(ptb\.|canary\.)?(discord.com)\/(channels)\/\d+\/\d+\/\d+/g)) {
|
if (message.content.match(/(https|http):\/\/(ptb\.|canary\.)?(discord.com)\/(channels)\/\d+\/\d+\/\d+/g)) {
|
||||||
const link = message.content.match(/(https|http):\/\/(ptb\.|canary\.)?(discord.com)\/(channels)\/\d+\/\d+\/\d+/g)[0],
|
const link = message.content.match(/(https|http):\/\/(ptb\.|canary\.)?(discord.com)\/(channels)\/\d+\/\d+\/\d+/g)[0],
|
||||||
|
@ -89,18 +88,18 @@ class MessageCreate extends BaseEvent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.guildData.plugins.automod.enabled && !data.guildData.plugins.automod.ignored.includes(message.channelId))
|
if (message.data.guild.plugins.automod.enabled && !message.data.guild.plugins.automod.ignored.includes(message.channelId))
|
||||||
if (/(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(message.content))
|
if (/(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(message.content))
|
||||||
if (!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ManageMessages)) {
|
if (!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ManageMessages)) {
|
||||||
await message.error("administration/automod:DELETED", null, { mention: true });
|
await message.error("administration/automod:DELETED", null, { mention: true });
|
||||||
message.delete();
|
message.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.userData.afk) {
|
if (message.data.user.afk) {
|
||||||
data.userData.afk = null;
|
message.data.user.afk = null;
|
||||||
|
|
||||||
data.userData.markModified("afk");
|
message.data.user.markModified("afk");
|
||||||
await data.userData.save();
|
await message.data.user.save();
|
||||||
|
|
||||||
message.replyT("general/afk:DELETED", {
|
message.replyT("general/afk:DELETED", {
|
||||||
user: message.author.username,
|
user: message.author.username,
|
||||||
|
@ -121,28 +120,28 @@ class MessageCreate extends BaseEvent {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../base/Client")} client
|
* @param {import("../base/Client")} client
|
||||||
* @param {import("discord.js").Message} msg
|
* @param {import("discord.js").Message} message
|
||||||
* @param {import("../base/Member")} memberData
|
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async function updateXp(client, msg, memberData) {
|
async function updateXp(message) {
|
||||||
const points = parseInt(memberData.exp),
|
const memberData = message.data.member,
|
||||||
|
points = parseInt(memberData.exp),
|
||||||
level = parseInt(memberData.level),
|
level = parseInt(memberData.level),
|
||||||
isInCooldown = xpCooldown[msg.author.id];
|
isInCooldown = xpCooldown[message.author.id];
|
||||||
|
|
||||||
if (isInCooldown) if (isInCooldown > Date.now()) return;
|
if (isInCooldown) if (isInCooldown > Date.now()) return;
|
||||||
|
|
||||||
const toWait = Date.now() + 60 * 1000; // 1 min
|
const toWait = Date.now() + 60 * 1000; // 1 min
|
||||||
xpCooldown[msg.author.id] = toWait;
|
xpCooldown[message.author.id] = toWait;
|
||||||
|
|
||||||
const won = client.functions.randomNum(1, 2);
|
const won = message.client.functions.randomNum(1, 2);
|
||||||
const newXp = parseInt(points + won, 10);
|
const newXp = parseInt(points + won, 10);
|
||||||
const neededXp = 5 * (level * level) + 80 * level + 100;
|
const neededXp = 5 * (level * level) + 80 * level + 100;
|
||||||
|
|
||||||
if (newXp > neededXp) {
|
if (newXp > neededXp) {
|
||||||
memberData.level = parseInt(level + 1, 10);
|
memberData.level = parseInt(level + 1, 10);
|
||||||
memberData.exp = 0;
|
memberData.exp = 0;
|
||||||
msg.replyT("misc:LEVEL_UP", {
|
message.replyT("misc:LEVEL_UP", {
|
||||||
level: memberData.level,
|
level: memberData.level,
|
||||||
}, { mention: false });
|
}, { mention: false });
|
||||||
} else memberData.exp = parseInt(newXp, 10);
|
} else memberData.exp = parseInt(newXp, 10);
|
||||||
|
|
|
@ -17,7 +17,7 @@ class messageDelete extends BaseEvent {
|
||||||
if (message.guild && message.guildId === "568120814776614924") return;
|
if (message.guild && message.guildId === "568120814776614924") return;
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
|
|
||||||
const guildData = await client.findOrCreateGuild(message.guildId);
|
const guildData = message.data.guild;
|
||||||
|
|
||||||
if (guildData.plugins?.monitoring?.messageDelete) {
|
if (guildData.plugins?.monitoring?.messageDelete) {
|
||||||
const embed = client.embed({
|
const embed = client.embed({
|
||||||
|
|
|
@ -20,7 +20,7 @@ class messageUpdate extends BaseEvent {
|
||||||
|
|
||||||
if (oldMessage.content === newMessage.content) return;
|
if (oldMessage.content === newMessage.content) return;
|
||||||
|
|
||||||
const guildData = await client.findOrCreateGuild(oldMessage.guildId);
|
const guildData = newMessage.data.guild;
|
||||||
|
|
||||||
if (guildData.plugins?.monitoring?.messageUpdate) {
|
if (guildData.plugins?.monitoring?.messageUpdate) {
|
||||||
const embed = client.embed({
|
const embed = client.embed({
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
const moment = require("moment");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../base/Client")} client
|
* @param {import("../base/Client")} client
|
||||||
|
@ -29,12 +27,12 @@ module.exports.init = function (client) {
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: client.translate("general/remindme:EMBED_CREATED"),
|
name: client.translate("general/remindme:EMBED_CREATED"),
|
||||||
value: moment(r.createdAt).locale(client.defaultLanguage).format("Do MMMM YYYY, HH:mm:ss"),
|
value: `<t:${r.createdAt}:f>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: client.translate("general/remindme:EMBED_TIME"),
|
name: client.translate("general/remindme:EMBED_TIME"),
|
||||||
value: moment(r.sendAt).locale(client.defaultLanguage).format("Do MMMM YYYY, HH:mm:ss"),
|
value: `<t:${r.sendAt}:f>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@ User.prototype.getUsername = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseInteraction.prototype.getLocale = function () {
|
BaseInteraction.prototype.getLocale = function () {
|
||||||
return this.guild ? this.guild.data.language : "en-US";
|
return this.guild ? this.data?.guild?.language : "en-US";
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseInteraction.prototype.translate = function (key, args) {
|
BaseInteraction.prototype.translate = function (key, args) {
|
||||||
|
@ -35,15 +35,19 @@ BaseInteraction.prototype.error = async function (key, args, options = {}) {
|
||||||
return await this.replyT(key, args, options);
|
return await this.replyT(key, args, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Message.prototype.getLocale = function () {
|
||||||
|
return this.guild ? this.data?.guild?.language : "en-US";
|
||||||
|
};
|
||||||
|
|
||||||
Message.prototype.translate = function (key, args) {
|
Message.prototype.translate = function (key, args) {
|
||||||
const language = this.client.translations.get(this.guild ? this.guild.data.language : "en-US");
|
const language = this.client.translations.get(this.getLocale());
|
||||||
if (!language) throw "Message: Invalid language set in data.";
|
if (!language) throw "Message: Invalid language set in data.";
|
||||||
|
|
||||||
return language(key, args);
|
return language(key, args);
|
||||||
};
|
};
|
||||||
|
|
||||||
Message.prototype.replyT = async function (key, args, options = {}) {
|
Message.prototype.replyT = async function (key, args, options = {}) {
|
||||||
const translated = this.translate(key, args, this.guild.data.language ?? "en-US");
|
const translated = this.translate(key, args, this.getLocale());
|
||||||
const string = options.prefixEmoji ? `${this.client.customEmojis[options.prefixEmoji]} | ${translated}` : translated;
|
const string = options.prefixEmoji ? `${this.client.customEmojis[options.prefixEmoji]} | ${translated}` : translated;
|
||||||
|
|
||||||
if (options.edit) return await this.edit({ content: string, allowedMentions: { repliedUser: options.mention ? true : false } });
|
if (options.edit) return await this.edit({ content: string, allowedMentions: { repliedUser: options.mention ? true : false } });
|
||||||
|
|
|
@ -83,7 +83,7 @@ module.exports = {
|
||||||
* @param {String} locale Language
|
* @param {String} locale Language
|
||||||
* @returns {String} Beautified Date
|
* @returns {String} Beautified Date
|
||||||
*/
|
*/
|
||||||
printDate(client, date, format = null, locale = client.defaultLanguage) {
|
printDate(client, date, format = null, locale = client.defaultLanguage.name) {
|
||||||
const languageData = client.languages.find(language => language.name === locale);
|
const languageData = client.languages.find(language => language.name === locale);
|
||||||
if (format === "" || format === null) format = languageData.defaultMomentFormat;
|
if (format === "" || format === null) format = languageData.defaultMomentFormat;
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ module.exports = {
|
||||||
* @param {String} locale Language
|
* @param {String} locale Language
|
||||||
* @returns {String} Time
|
* @returns {String} Time
|
||||||
*/
|
*/
|
||||||
convertTime(client, time, type = false, prefix = true, locale = client.defaultLanguage) {
|
convertTime(client, time, type = false, prefix = true, locale = client.defaultLanguage.name) {
|
||||||
const languageData = client.languages.find(language => language.name === locale);
|
const languageData = client.languages.find(language => language.name === locale);
|
||||||
const m = moment(time).locale(languageData.moment);
|
const m = moment(time).locale(languageData.moment);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jaba",
|
"name": "jaba",
|
||||||
"version": "4.4.2",
|
"version": "4.4.3",
|
||||||
"description": "My Discord Bot",
|
"description": "My Discord Bot",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in a new issue