mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 13:14:58 +05:00
Merge pull request #5 from JonnyBro/appcommands
This commit is contained in:
commit
5ffb71e0dc
616 changed files with 6552 additions and 10200 deletions
|
@ -1,5 +1,4 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Resolvers = require("../../helpers/resolvers");
|
||||
const Command = require("../../base/Command");
|
||||
|
||||
class Autorole extends Command {
|
||||
constructor(client) {
|
103
TO REWRITE/Administration/configuration.js
Normal file
103
TO REWRITE/Administration/configuration.js
Normal file
|
@ -0,0 +1,103 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
class Configuration extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "configuration",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["conf", "config"],
|
||||
memberPermissions: ["MANAGE_GUILD"],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const guildData = data.guild;
|
||||
|
||||
const embed = new Discord.EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.guild.name,
|
||||
iconURL: message.guild.iconURL()
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
});
|
||||
|
||||
embed.addFields([
|
||||
{ // Ignored channels
|
||||
name: message.translate("administration/configuration:IGNORED_CHANNELS_TITLE"),
|
||||
value: guildData.ignoredChannels.length > 0 ? guildData.ignoredChannels.map((ch) => `<#${ch}>`).join(", ") : message.translate("administration/configuration:NO_IGNORED_CHANNELS")
|
||||
},
|
||||
{ // Autorole plugin
|
||||
name: message.translate("administration/configuration:AUTOROLE_TITLE"),
|
||||
value: guildData.plugins.autorole.enabled ? message.translate("administration/configuration:AUTOROLE_CONTENT", {
|
||||
roleName: `<@&${guildData.plugins.autorole.role}>`
|
||||
}) : message.translate("administration/configuration:AUTOROLE_DISABLED")
|
||||
},
|
||||
{ // Welcome plugin
|
||||
name: message.translate("administration/configuration:WELCOME_TITLE"),
|
||||
value: guildData.plugins.welcome.enabled ? message.translate("administration/configuration:WELCOME_CONTENT", {
|
||||
channel: `<#${guildData.plugins.welcome.channel}>`,
|
||||
withImage: guildData.plugins.welcome.withImage ? message.translate("common:YES") : message.translate("common:NO")
|
||||
}) : message.translate("administration/configuration:WELCOME_DISABLED")
|
||||
},
|
||||
{ // Goodbye plugin
|
||||
name: message.translate("administration/configuration:GOODBYE_TITLE"),
|
||||
value: guildData.plugins.goodbye.enabled ? message.translate("administration/configuration:GOODBYE_CONTENT", {
|
||||
channel: `<#${guildData.plugins.goodbye.channel}>`,
|
||||
withImage: guildData.plugins.goodbye.withImage ? message.translate("common:YES") : message.translate("common:NO")
|
||||
}) : message.translate("administration/configuration:GOODBYE_DISABLED")
|
||||
},
|
||||
{ // Special channels
|
||||
name: message.translate("administration/configuration:SPECIAL_CHANNELS"),
|
||||
value: message.translate("administration/configuration:SUGGESTIONS", {
|
||||
channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : message.translate("common:NOT_DEFINED")
|
||||
}) + "\n" +
|
||||
message.translate("administration/configuration:REPORTS", {
|
||||
channel: guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : message.translate("common:NOT_DEFINED")
|
||||
}) + "\n" +
|
||||
message.translate("administration/configuration:MODLOGS", {
|
||||
channel: guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : message.translate("common:NOT_DEFINED")
|
||||
}) + "\n" +
|
||||
message.translate("administration/configuration:BIRTHDAYS", {
|
||||
channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : message.translate("common:NOT_DEFINED")
|
||||
})
|
||||
},
|
||||
{ // Auto sanctions
|
||||
name: message.translate("administration/configuration:AUTO_SANCTIONS"),
|
||||
value: (guildData.plugins.warnsSanctions.kick ? message.translate("administration/configuration:KICK_CONTENT", {
|
||||
count: guildData.plugins.warnsSanctions.kick
|
||||
}) : message.translate("administration/configuration:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? message.translate("administration/configuration:BAN_CONTENT", {
|
||||
count: guildData.plugins.warnsSanctions.ban
|
||||
}) : message.translate("administration/configuration:BAN_NOT_DEFINED"))
|
||||
},
|
||||
{ // Automod plugin
|
||||
name: message.translate("administration/configuration:AUTOMOD_TITLE"),
|
||||
value: guildData.plugins.automod.enabled ? message.translate("administration/configuration:AUTOMOD_CONTENT", {
|
||||
channels: guildData.plugins.automod.ignored.map((ch) => `<#${ch}>`)
|
||||
}) : message.translate("administration/configuration:AUTOMOD_DISABLED")
|
||||
},
|
||||
{ // Auto-delete mod commands
|
||||
name: message.translate("administration/configuration:AUTODELETEMOD"),
|
||||
value: guildData.autoDeleteModCommands ? message.translate("administration/configuration:AUTODELETEMOD_ENABLED") : message.translate("administration/configuration:AUTODELETEMOD_DISABLED")
|
||||
},
|
||||
{ // Dashboard link
|
||||
name: message.translate("administration/configuration:DASHBOARD_TITLE"),
|
||||
value: `[${message.translate("administration/configuration:DASHBOARD_CONTENT")}](${data.config.dashboard.baseURL})`
|
||||
}
|
||||
]);
|
||||
|
||||
message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Configuration;
|
|
@ -1,5 +1,4 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Resolvers = require("../../helpers/resolvers");
|
||||
const Command = require("../../base/Command");
|
||||
|
||||
class Goodbye extends Command {
|
||||
constructor(client) {
|
|
@ -1,5 +1,4 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Resolvers = require("../../helpers/resolvers");
|
||||
const Command = require("../../base/Command");
|
||||
|
||||
class Setbirthdays extends Command {
|
||||
constructor(client) {
|
|
@ -1,5 +1,4 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Resolvers = require("../../helpers/resolvers");
|
||||
const Command = require("../../base/Command");
|
||||
|
||||
class Setmodlogs extends Command {
|
||||
constructor(client) {
|
44
TO REWRITE/Administration/setnews.js
Normal file
44
TO REWRITE/Administration/setnews.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Setnews extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "setnews",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: [],
|
||||
memberPermissions: ["MANAGE_GUILD"],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const areNewsEnabled = Boolean(data.guild.plugins.news);
|
||||
const sentChannel = await Resolvers.resolveChannel({
|
||||
message,
|
||||
search: args.join(" "),
|
||||
channelType: "GUILD_TEXT"
|
||||
});
|
||||
|
||||
if (areNewsEnabled && !sentChannel) {
|
||||
data.guild.plugins.news = null;
|
||||
data.guild.markModified("plugins.news");
|
||||
await data.guild.save();
|
||||
return message.success("administration/setnews:DISABLED");
|
||||
} else {
|
||||
const channel = sentChannel || message.channel;
|
||||
data.guild.plugins.news = channel.id;
|
||||
data.guild.markModified("plugins.news");
|
||||
await data.guild.save();
|
||||
return message.success("administration/setnews:ENABLED", {
|
||||
channel: channel.toString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Setnews;
|
|
@ -1,5 +1,4 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Resolvers = require("../../helpers/resolvers");
|
||||
const Command = require("../../base/Command");
|
||||
|
||||
class Setreports extends Command {
|
||||
constructor(client) {
|
|
@ -1,5 +1,4 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Resolvers = require("../../helpers/resolvers");
|
||||
const Command = require("../../base/Command");
|
||||
|
||||
class Setsuggests extends Command {
|
||||
constructor(client) {
|
|
@ -1,5 +1,5 @@
|
|||
const Command = require("../../base/Command"),
|
||||
{ Util } = require("discord.js");
|
||||
{ parseEmoji } = require("discord.js");
|
||||
|
||||
class Stealemoji extends Command {
|
||||
constructor(client) {
|
||||
|
@ -21,7 +21,7 @@ class Stealemoji extends Command {
|
|||
if (!args.length) return message.error("administration/stealemoji:MISSING_EMOJI");
|
||||
|
||||
for (const rawEmoji of args) {
|
||||
const parsedEmoji = Util.parseEmoji(rawEmoji);
|
||||
const parsedEmoji = parseEmoji(rawEmoji);
|
||||
const extension = parsedEmoji.animated ? "gif" : "png";
|
||||
|
||||
message.guild.emojis
|
|
@ -1,5 +1,4 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Resolvers = require("../../helpers/resolvers");
|
||||
const Command = require("../../base/Command");
|
||||
|
||||
class Welcome extends Command {
|
||||
constructor(client) {
|
103
TO REWRITE/Economy/achievements.js
Normal file
103
TO REWRITE/Economy/achievements.js
Normal file
|
@ -0,0 +1,103 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
class Achievements extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "achievements",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["ac"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
let member = message.guild ? message.member : message.author;
|
||||
if (args[0]) member = await this.client.resolveMember(args[0], message.guild);
|
||||
if (message.guild && member.user.bot) return message.error("economy/profile:BOT_USER");
|
||||
|
||||
const userData = (member.id === message.author.id ? data.userData : await this.client.findOrCreateUser({
|
||||
id: member.id
|
||||
}));
|
||||
|
||||
const embed = new Discord.EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("economy/achievements:TITLE")
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
});
|
||||
|
||||
embed.addFields([
|
||||
{
|
||||
name: message.translate("economy/achievements:SEND_CMD"),
|
||||
value: message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.firstCommand.progress.now,
|
||||
total: userData.achievements.firstCommand.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total))
|
||||
})
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/achievements:CLAIM_SALARY"),
|
||||
value: message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.work.progress.now,
|
||||
total: userData.achievements.work.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total))
|
||||
})
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/achievements:MARRY"),
|
||||
value: message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.married.progress.now,
|
||||
total: userData.achievements.married.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total))
|
||||
})
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/achievements:SLOTS"),
|
||||
value: message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.slots.progress.now,
|
||||
total: userData.achievements.slots.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total))
|
||||
})
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/achievements:TIP"),
|
||||
value: message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.tip.progress.now,
|
||||
total: userData.achievements.tip.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total))
|
||||
})
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/achievements:REP"),
|
||||
value: message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.rep.progress.now,
|
||||
total: userData.achievements.rep.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total))
|
||||
})
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/achievements:INVITE"),
|
||||
value: message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.invite.progress.now,
|
||||
total: userData.achievements.invite.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total))
|
||||
})
|
||||
}
|
||||
]);
|
||||
|
||||
message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Achievements;
|
|
@ -42,7 +42,7 @@ class Birthdate extends Command {
|
|||
data.userData.save();
|
||||
|
||||
message.success("economy/birthdate:SUCCESS", {
|
||||
date: message.printDate(d)
|
||||
date: this.client.printDate(d)
|
||||
});
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ class Leaderboard extends Command {
|
|||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const isOnlyOnMobile = (message.member.presence.clientStatus ? JSON.stringify(Object.keys(message.member.presence.clientStatus)) === JSON.stringify(["mobile"]) : false);
|
||||
const isOnMobile = (message.member.presence.clientStatus ? JSON.stringify(Object.keys(message.member.presence.clientStatus)) === JSON.stringify(["mobile"]) : false);
|
||||
|
||||
const type = args[0];
|
||||
if (!type || !["credits", "level", "rep"].includes(type)) return message.error("economy/leaderboard:MISSING_TYPE");
|
||||
|
@ -45,14 +45,12 @@ class Leaderboard extends Command {
|
|||
money += `${data.money}\n`;
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new Discord.EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("economy/leaderboard:TABLE", {
|
||||
name: message.guild.name
|
||||
}),
|
||||
iconURL: message.guild.iconURL({
|
||||
dynamic: true
|
||||
})
|
||||
iconURL: message.guild.iconURL()
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
.addFields({
|
||||
|
@ -60,7 +58,7 @@ class Leaderboard extends Command {
|
|||
value: userNames,
|
||||
inline: true
|
||||
}, {
|
||||
name: message.translate("economy/leaderboard:CREDITS"),
|
||||
name: message.translate("common:CREDITS"),
|
||||
value: money,
|
||||
inline: true
|
||||
});
|
||||
|
@ -93,14 +91,12 @@ class Leaderboard extends Command {
|
|||
xp += `${data.xp} / ${5 * (data.level * data.level) + 80 * data.level + 100}\n`;
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new Discord.EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("economy/leaderboard:TABLE", {
|
||||
name: message.guild.name
|
||||
}),
|
||||
iconURL: message.guild.iconURL({
|
||||
dynamic: true
|
||||
})
|
||||
iconURL: message.guild.iconURL()
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
.addFields({
|
||||
|
@ -108,11 +104,11 @@ class Leaderboard extends Command {
|
|||
value: userNames,
|
||||
inline: true
|
||||
}, {
|
||||
name: message.translate("economy/leaderboard:LEVEL"),
|
||||
name: message.translate("common:LEVEL"),
|
||||
value: level,
|
||||
inline: true
|
||||
}, {
|
||||
name: message.translate("economy/leaderboard:XP"),
|
||||
name: message.translate("common:XP"),
|
||||
value: xp,
|
||||
inline: true
|
||||
});
|
||||
|
@ -142,14 +138,12 @@ class Leaderboard extends Command {
|
|||
rep += `${data.rep}\n`;
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new Discord.EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("economy/leaderboard:TABLE", {
|
||||
name: message.guild.name
|
||||
}),
|
||||
iconURL: message.guild.iconURL({
|
||||
dynamic: true
|
||||
})
|
||||
iconURL: message.guild.iconURL()
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
.addFields({
|
||||
|
@ -157,7 +151,7 @@ class Leaderboard extends Command {
|
|||
value: userNames,
|
||||
inline: true
|
||||
}, {
|
||||
name: message.translate("economy/leaderboard:REP"),
|
||||
name: message.translate("common:REP"),
|
||||
value: rep,
|
||||
inline: true
|
||||
});
|
||||
|
@ -167,7 +161,7 @@ class Leaderboard extends Command {
|
|||
});
|
||||
}
|
||||
|
||||
if (isOnlyOnMobile) message.sendT("economy/leaderboard:MOBILE");
|
||||
if (isOnMobile) message.sendT("economy/leaderboard:MOBILE");
|
||||
}
|
||||
}
|
||||
|
|
@ -48,20 +48,33 @@ class Money extends Command {
|
|||
globalMoney += data.bankSold;
|
||||
});
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new Discord.EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("economy/money:TITLE", {
|
||||
username: member.user.username
|
||||
}),
|
||||
iconURL: member.user.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
extension: "png",
|
||||
size: 512
|
||||
})
|
||||
})
|
||||
.addField(message.translate("economy/profile:CASH"), `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
|
||||
.addField(message.translate("economy/profile:BANK"), `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
|
||||
.addField(message.translate("economy/profile:GLOBAL"), `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
|
||||
.addFields([
|
||||
{
|
||||
name: message.translate("economy/profile:CASH"),
|
||||
value: `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:BANK"),
|
||||
value: `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:GLOBAL"),
|
||||
value: `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||
inline: true
|
||||
}
|
||||
])
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
|
@ -38,7 +38,6 @@ class Number extends Command {
|
|||
currentGames[message.guild.id] = true;
|
||||
|
||||
collector.on("collect", async msg => {
|
||||
if (this.client.functions.getPrefix(msg, data)) return;
|
||||
if (!participants.includes(msg.author.id)) participants.push(msg.author.id);
|
||||
if (msg.content === "STOP") return collector.stop("force");
|
||||
if (isNaN(msg.content)) return;
|
||||
|
@ -46,7 +45,7 @@ class Number extends Command {
|
|||
const parsedNumber = parseInt(msg.content, 10);
|
||||
|
||||
if (parsedNumber === number) {
|
||||
const time = this.client.functions.convertTime(message.guild, Date.now() - gameCreatedAt);
|
||||
const time = this.client.convertTime(message.guild, Date.now() - gameCreatedAt);
|
||||
message.sendT("economy/number:GAME_STATS", {
|
||||
winner: msg.author.toString(),
|
||||
number,
|
144
TO REWRITE/Economy/profile.js
Normal file
144
TO REWRITE/Economy/profile.js
Normal file
|
@ -0,0 +1,144 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
const asyncForEach = async (collection, callback) => {
|
||||
const allPromises = collection.map(async key => {
|
||||
await callback(key);
|
||||
});
|
||||
|
||||
return await Promise.all(allPromises);
|
||||
};
|
||||
|
||||
class Profile extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "profile",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["prof"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const arg = args[0] || message.author;
|
||||
let member = await this.client.resolveMember(arg, message.guild);
|
||||
if (!member) member = message.member;
|
||||
if (member.user.bot) return message.error("economy/profile:BOT_USER");
|
||||
|
||||
const memberData = (member.id === message.author.id ? data.memberData : await this.client.findOrCreateMember({
|
||||
id: member.id,
|
||||
guildID: message.guild.id
|
||||
}));
|
||||
const userData = (member.id === message.author.id ? data.userData : await this.client.findOrCreateUser({
|
||||
id: member.id
|
||||
}));
|
||||
if (userData.lover && !this.client.users.cache.get(userData.lover)) await this.client.users.fetch(userData.lover, true);
|
||||
|
||||
const commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(member.id));
|
||||
let globalMoney = 0;
|
||||
await asyncForEach(commonsGuilds, async (guild) => {
|
||||
const data = await this.client.findOrCreateMember({
|
||||
id: member.id,
|
||||
guildID: guild.id
|
||||
});
|
||||
globalMoney += data.money;
|
||||
globalMoney += data.bankSold;
|
||||
});
|
||||
|
||||
const profileEmbed = new Discord.EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("economy/profile:TITLE", {
|
||||
username: member.user.tag
|
||||
}),
|
||||
iconURL: member.user.displayAvatarURL({
|
||||
extension: "png",
|
||||
size: 512
|
||||
})
|
||||
})
|
||||
.setImage("attachment://achievements.png")
|
||||
.addFields([
|
||||
{
|
||||
name: this.client.customEmojis.link + " " + message.translate("economy/profile:LINK"),
|
||||
value: `[${message.translate("economy/profile:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/user/${member.user.id}/${message.guild.id})`
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:BIO"),
|
||||
value: userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO")
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:CASH"),
|
||||
value: `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:BANK"),
|
||||
value: `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:GLOBAL"),
|
||||
value: `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:REPUTATION"),
|
||||
value: `**${userData.rep}** ${message.getNoun(userData.rep, message.translate("misc:NOUNS:POINTS:1"), message.translate("misc:NOUNS:POINTS:2"), message.translate("misc:NOUNS:POINTS:5"))}`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:LEVEL"),
|
||||
value:`**${memberData.level}**`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:EXP"),
|
||||
value: `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:REGISTERED"),
|
||||
value: this.client.printDate(new Date(memberData.registeredAt)),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:BIRTHDATE"),
|
||||
value: (!userData.birthdate ? message.translate("economy/profile:NO_BIRTHDATE") : this.client.printDate(new Date(userData.birthdate))),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:LOVER"),
|
||||
value: (!userData.lover ? message.translate("economy/profile:NO_LOVER") : this.client.users.cache.get(userData.lover).tag),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/profile:ACHIEVEMENTS"),
|
||||
value: message.translate("economy/profile:ACHIEVEMENTS_CONTENT", {
|
||||
prefix: data.guild.prefix
|
||||
})
|
||||
}
|
||||
])
|
||||
.setColor(data.config.embed.color) // Sets the color of the embed
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
}) // Sets the footer of the embed
|
||||
.setTimestamp();
|
||||
|
||||
const buffer = await userData.getAchievements();
|
||||
|
||||
message.reply({
|
||||
embeds: [profileEmbed],
|
||||
files: [{
|
||||
name: "achievements.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Profile;
|
|
@ -26,7 +26,7 @@ class Rep extends Command {
|
|||
when the member will be able to execute the order again
|
||||
is greater than the current date, display an error message */
|
||||
if (isInCooldown > Date.now()) return message.error("economy/rep:COOLDOWN", {
|
||||
time: message.convertTime(isInCooldown, "to", true)
|
||||
time: this.client.convertTime(isInCooldown, "to", true)
|
||||
});
|
||||
}
|
||||
|
|
@ -18,13 +18,12 @@ class Transactions extends Command {
|
|||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new Discord.EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("economy/transactions:EMBED_TRANSACTIONS"),
|
||||
iconURL: message.author.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
extension: "png",
|
||||
size: 512
|
||||
})
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
|
@ -37,14 +36,26 @@ class Transactions extends Command {
|
|||
|
||||
transactions.slice(-20).forEach((t) => {
|
||||
const array = t.type === "got" ? sortedTransactions[0] : sortedTransactions[1];
|
||||
array.push(`${message.translate("economy/transactions:T_USER_" + t.type.toUpperCase())}: ${t.user}\n${message.translate("economy/transactions:T_AMOUNT")}: ${t.amount}\n${message.translate("economy/transactions:T_DATE")}: ${message.printDate(t.date, "Do MMMM YYYY, HH:mm")}\n`);
|
||||
array.push(`${message.translate("economy/transactions:T_USER_" + t.type.toUpperCase())}: ${t.user}\n${message.translate("economy/transactions:T_AMOUNT")}: ${t.amount}\n${message.translate("economy/transactions:T_DATE")}: ${this.client.printDate(t.date, "Do MMMM YYYY, HH:mm")}\n`);
|
||||
});
|
||||
|
||||
if (transactions.length < 1) {
|
||||
embed.setDescription(message.translate("economy/transactions:NO_TRANSACTIONS"));
|
||||
} else {
|
||||
if (sortedTransactions[0].length > 0) embed.addField(message.translate("economy/transactions:T_GOT"), sortedTransactions[0].join("\n"), true);
|
||||
if (sortedTransactions[1].length > 0) embed.addField(message.translate("economy/transactions:T_SEND"), sortedTransactions[1].join("\n"), true);
|
||||
if (sortedTransactions[0].length > 0) embed.addFields([
|
||||
{
|
||||
name: message.translate("economy/transactions:T_GOT"),
|
||||
value: sortedTransactions[0].join("\n"),
|
||||
inline: true
|
||||
}
|
||||
]);
|
||||
if (sortedTransactions[1].length > 0) embed.addFields([
|
||||
{
|
||||
name: message.translate("economy/transactions:T_SEND"),
|
||||
value: sortedTransactions[1].join("\n"),
|
||||
inline: true
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
message.reply({
|
|
@ -1,5 +1,5 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
{ parseEmoji, EmbedBuilder } = require("discord.js");
|
||||
|
||||
class Work extends Command {
|
||||
constructor(client) {
|
||||
|
@ -25,7 +25,7 @@ class Work extends Command {
|
|||
when the member will be able to execute the order again
|
||||
is greater than the current date, display an error message */
|
||||
if (isInCooldown > Date.now()) return message.error("economy/work:COOLDOWN", {
|
||||
time: message.convertTime(isInCooldown, "to", true)
|
||||
time: this.client.convertTime(isInCooldown, "to", true)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -39,13 +39,12 @@ class Work extends Command {
|
|||
data.memberData.workStreak = (data.memberData.workStreak || 0) + 1;
|
||||
await data.memberData.save();
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setFooter({
|
||||
text: message.translate("economy/work:AWARD"),
|
||||
iconURL: message.author.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
extension: "png",
|
||||
size: 512
|
||||
})
|
||||
})
|
||||
.setColor(data.config.embed.color);
|
||||
|
@ -61,22 +60,38 @@ class Work extends Command {
|
|||
|
||||
if (data.memberData.workStreak >= 5) {
|
||||
won += 200;
|
||||
embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", {
|
||||
won: `${won} ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
||||
}))
|
||||
.addField(message.translate("economy/work:STREAK"), message.translate("economy/work:STREAK_CONTENT"));
|
||||
embed.addFields([
|
||||
{
|
||||
name: message.translate("economy/work:SALARY"),
|
||||
value: message.translate("economy/work:SALARY_CONTENT", {
|
||||
won: `${won} ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
||||
})
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/work:STREAK"),
|
||||
value: message.translate("economy/work:STREAK_CONTENT")
|
||||
}
|
||||
]);
|
||||
data.memberData.workStreak = 0;
|
||||
} else {
|
||||
for (let i = 0; i < award.length; i++) {
|
||||
if (data.memberData.workStreak > i) {
|
||||
const letter = Discord.Util.parseEmoji(award[i]).name.split("_")[1];
|
||||
const letter = parseEmoji(award[i]).name.split("_")[1];
|
||||
award[i] = `:regional_indicator_${letter.toLowerCase()}:`;
|
||||
}
|
||||
}
|
||||
embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", {
|
||||
won: `**${won}** ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
||||
}))
|
||||
.addField(message.translate("economy/work:STREAK"), award.join(""));
|
||||
embed.addFields([
|
||||
{
|
||||
name: message.translate("economy/work:SALARY"),
|
||||
value: message.translate("economy/work:SALARY_CONTENT", {
|
||||
won: `**${won}** ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
||||
})
|
||||
},
|
||||
{
|
||||
name: message.translate("economy/work:STREAK"),
|
||||
value: award.join("")
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
const info = {
|
|
@ -30,7 +30,7 @@ class Poll extends Command {
|
|||
time: 240000
|
||||
});
|
||||
|
||||
collector.on("collect", async (tmsg) => {
|
||||
collector.on("collect", async tmsg => {
|
||||
if (tmsg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) {
|
||||
tmsg.delete();
|
||||
msg.delete();
|
||||
|
@ -85,15 +85,20 @@ class Poll extends Command {
|
|||
this.client.emojis.cache.find(e => e.name === error)
|
||||
];
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new Discord.EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("moderation/poll:TITLE")
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
.addField(question, message.translate("moderation/poll:REACT", {
|
||||
success: emojis[0].toString(),
|
||||
error: emojis[1].toString()
|
||||
}));
|
||||
.addFields([
|
||||
{
|
||||
name: question,
|
||||
value: message.translate("moderation/poll:REACT", {
|
||||
success: emojis[0].toString(),
|
||||
error: emojis[1].toString()
|
||||
})
|
||||
}
|
||||
]);
|
||||
|
||||
message.channel.send({
|
||||
content: mention,
|
File diff suppressed because one or more lines are too long
33
base/BaseCommand.js
Normal file
33
base/BaseCommand.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
const path = require("path");
|
||||
|
||||
class BaseCommand {
|
||||
constructor(options, client) {
|
||||
/**
|
||||
* @type {import("discord.js").SlashCommandBuilder | import("discord.js").ContextMenuCommandBuilder | import("discord.js").ApplicationCommandData}
|
||||
*/
|
||||
this.command = options.command;
|
||||
/**
|
||||
* @type {Array<String>}
|
||||
*/
|
||||
this.aliases = options.aliases || [];
|
||||
/**
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.guildOnly = options.guildOnly || true;
|
||||
/**
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.ownerOnly = options.ownerOnly || false;
|
||||
/**
|
||||
* @type __dirname
|
||||
*/
|
||||
this.dirname = options.dirname || false;
|
||||
/**
|
||||
* @type {String}
|
||||
*/
|
||||
this.category = (this.dirname ? this.dirname.split(path.sep)[parseInt(this.dirname.split(path.sep).length - 1, 10)] : "Other");
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BaseCommand;
|
14
base/BaseEvent.js
Normal file
14
base/BaseEvent.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
class BaseEvent {
|
||||
constructor(options) {
|
||||
/**
|
||||
* @type {String}
|
||||
*/
|
||||
this.name = options.name;
|
||||
/**
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.once = options.once;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BaseEvent;
|
|
@ -1,23 +0,0 @@
|
|||
const path = require("path");
|
||||
|
||||
module.exports = class Command {
|
||||
constructor(client, {
|
||||
name = null,
|
||||
dirname = false,
|
||||
enabled = true,
|
||||
guildOnly = false,
|
||||
aliases = new Array(),
|
||||
botPermissions = new Array(),
|
||||
memberPermissions = new Array(),
|
||||
nsfw = false,
|
||||
ownerOnly = false,
|
||||
cooldown = 3000
|
||||
})
|
||||
|
||||
{
|
||||
const category = (dirname ? dirname.split(path.sep)[parseInt(dirname.split(path.sep).length - 1, 10)] : "Other");
|
||||
this.client = client;
|
||||
this.conf = { enabled, guildOnly, memberPermissions, botPermissions, nsfw, ownerOnly, cooldown};
|
||||
this.help = { name, category, aliases };
|
||||
}
|
||||
};
|
|
@ -1,68 +1,45 @@
|
|||
const mongoose = require("mongoose"),
|
||||
Schema = mongoose.Schema,
|
||||
config = require("../config"),
|
||||
languages = require("../languages/language-meta.json");
|
||||
|
||||
module.exports = mongoose.model("Guild", new Schema({
|
||||
/* REQUIRED */
|
||||
id: { type: String }, // Discord ID of the guild
|
||||
id: { type: String },
|
||||
|
||||
/* MEMBERSDATA */
|
||||
membersData: { type: Object, default: {} }, // Members data of the guild
|
||||
membersData: { type: Object, default: {} },
|
||||
members: [{ type: Schema.Types.ObjectId, ref: "Member" }],
|
||||
|
||||
/* CONFIGURATION */
|
||||
language: { type: String, default: languages.find((l) => l.default).name }, // Language of the guild
|
||||
prefix: { type: String, default: config.prefix }, // Default or custom prefix of the guild
|
||||
plugins: { type: Object, default: { // Plugins data
|
||||
// Welcome messages
|
||||
language: { type: String, default: languages.find((l) => l.default).name },
|
||||
plugins: { type: Object, default: {
|
||||
welcome: {
|
||||
enabled: false, // Whether the welcome messages are enabled
|
||||
message: null, // The welcome message
|
||||
channel: null, // The channel to send the welcome messages
|
||||
withImage: null // Whether the welcome images are enabled
|
||||
enabled: false,
|
||||
message: null,
|
||||
channel: null,
|
||||
withImage: null
|
||||
},
|
||||
// Goodbye messages
|
||||
goodbye: {
|
||||
enabled: false, // Whether the goodbye messages are enabled
|
||||
message: null, // The goodbye message
|
||||
channel: null, // The channel to send the goodbye messages
|
||||
withImage: null // Whether the goodbye images are enabled
|
||||
enabled: false,
|
||||
message: null,
|
||||
channel: null,
|
||||
withImage: null
|
||||
},
|
||||
// Autorole
|
||||
autorole: {
|
||||
enabled: false, // Whether the autorole is enabled
|
||||
role: null // The role to add when a member join the server
|
||||
enabled: false,
|
||||
role: null
|
||||
},
|
||||
// Auto moderation
|
||||
automod: {
|
||||
enabled: false, // Whether the auto moderation is enabled
|
||||
ignored: [] // The channels in which the auto moderation is disabled
|
||||
enabled: false,
|
||||
ignored: []
|
||||
},
|
||||
// Auto sanctions
|
||||
warnsSanctions: {
|
||||
kick: false, // The number of warns required to kick the user
|
||||
ban: false // The number of warns required to ban the user
|
||||
kick: false,
|
||||
ban: false
|
||||
},
|
||||
// Tickets
|
||||
tickets: {
|
||||
enabled: false, // Whether the tickets system is enabled
|
||||
category: null // The category for the tickets system
|
||||
},
|
||||
suggestions: false, // the channel in which the suggestions will be sent
|
||||
modlogs: false, // the channel in which the moderation logs (mute, kick, ban, etc...) will be sent
|
||||
birthdays: false, // the channel in which birtdays announcements will be sent
|
||||
reports: false, // the channel in which the reports will be sent
|
||||
logs: false // the channel in which the logs (message deleted, etc...) will be sent
|
||||
}},
|
||||
slowmode: { type: Object, default: { // Servers slowmode
|
||||
users: [],
|
||||
channels: []
|
||||
news: false,
|
||||
suggestions: false,
|
||||
modlogs: false,
|
||||
birthdays: false,
|
||||
reports: false
|
||||
}},
|
||||
casesCount: { type: Number, default: 0 },
|
||||
ignoredChannels: { type: Array, default: [] }, // Channels ignored by the bot
|
||||
customCommands: { type: Array, default: [] }, // Custom commands of the guild
|
||||
commands: { type: Array, default: [] }, // Commands logs
|
||||
autoDeleteModCommands: { type: Boolean, default: false }, // Whether to auto delete moderation commands
|
||||
disabledCategories: { type: Array, default: [] } // Disabled categories
|
||||
autoDeleteModCommands: { type: Boolean, default: false },
|
||||
}));
|
365
base/JaBa.js
365
base/JaBa.js
|
@ -1,18 +1,20 @@
|
|||
const { MessageEmbed, Client, Collection } = require("discord.js"),
|
||||
const { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder } = require("discord.js"),
|
||||
{ GiveawaysManager } = require("discord-giveaways"),
|
||||
{ SoundCloudPlugin } = require("@distube/soundcloud"),
|
||||
{ SpotifyPlugin } = require("@distube/spotify"),
|
||||
{ YtDlpPlugin } = require("@distube/yt-dlp");
|
||||
{ Player } = require("discord-player"),
|
||||
{ REST } = require("@discordjs/rest"),
|
||||
{ Routes } = require("discord-api-types/v10");
|
||||
|
||||
const util = require("util"),
|
||||
const BaseEvent = require("./BaseEvent.js"),
|
||||
BaseCommand = require("./BaseCommand.js"),
|
||||
{ DiscordTogether } = require("../helpers/discordTogether"),
|
||||
AmeClient = require("amethyste-api"),
|
||||
path = require("path"),
|
||||
fetch = require("node-fetch"),
|
||||
DisTube = require("distube"),
|
||||
fs = require("fs").promises,
|
||||
mongoose = require("mongoose"),
|
||||
moment = require("moment");
|
||||
|
||||
moment.relativeTimeThreshold("s", 60);
|
||||
moment.relativeTimeThreshold("ss", 5);
|
||||
moment.relativeTimeThreshold("s", 60);
|
||||
moment.relativeTimeThreshold("m", 60);
|
||||
moment.relativeTimeThreshold("h", 60);
|
||||
moment.relativeTimeThreshold("d", 24);
|
||||
|
@ -22,97 +24,60 @@ moment.relativeTimeThreshold("M", 12);
|
|||
class JaBa extends Client {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
this.config = require("../config"); // Load the config file
|
||||
this.customEmojis = require("../emojis"); // load the bot's emojis
|
||||
this.languages = require("../languages/language-meta"); // Load the bot's languages
|
||||
this.commands = new Collection(); // Creates new commands collection
|
||||
this.aliases = new Collection(); // Creates new command aliases collection
|
||||
this.logger = require("../helpers/logger"); // Load the logger file
|
||||
this.wait = util.promisify(setTimeout); // client.wait(1000) - Wait 1 second
|
||||
this.functions = require("../helpers/functions"); // Load the functions file
|
||||
this.guildsData = require("../base/Guild"); // Guild mongoose model
|
||||
this.usersData = require("../base/User"); // User mongoose model
|
||||
this.membersData = require("../base/Member"); // Member mongoose model
|
||||
this.logs = require("../base/Log"); // Log mongoose model
|
||||
this.dashboard = require("../dashboard/app"); // Dashboard app
|
||||
this.queues = new Collection(); // This collection will be used for the music
|
||||
this.states = {}; // Used for the dashboard
|
||||
this.config = require("../config");
|
||||
this.customEmojis = require("../emojis");
|
||||
this.languages = require("../languages/language-meta");
|
||||
this.commands = new Collection();
|
||||
this.logger = require("../helpers/logger");
|
||||
this.wait = require("node:timers/promises").setTimeout;
|
||||
this.functions = require("../helpers/functions");
|
||||
this.guildsData = require("../base/Guild");
|
||||
this.usersData = require("../base/User");
|
||||
this.membersData = require("../base/Member");
|
||||
this.dashboard = require("../dashboard/app");
|
||||
this.states = {};
|
||||
this.knownGuilds = [];
|
||||
|
||||
this.databaseCache = {};
|
||||
this.databaseCache.users = new Collection();
|
||||
this.databaseCache.guilds = new Collection();
|
||||
this.databaseCache.members = new Collection();
|
||||
|
||||
this.databaseCache.usersReminds = new Collection(); // members with active reminds
|
||||
this.databaseCache.mutedUsers = new Collection(); // members who are currently muted
|
||||
|
||||
if (this.config.apiKeys.amethyste) this.AmeAPI = new AmeClient(this.config.apiKeys.amethyste);
|
||||
|
||||
this.icanhazdadjoke = async function() {
|
||||
const joke = await fetch("https://icanhazdadjoke.com/", {
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
}
|
||||
});
|
||||
this.discordTogether = new DiscordTogether(this);
|
||||
|
||||
return joke.json();
|
||||
};
|
||||
|
||||
this.player = new DisTube.default(this, {
|
||||
plugins: [
|
||||
new SpotifyPlugin({
|
||||
emitEventsAfterFetching: true
|
||||
}),
|
||||
new SoundCloudPlugin(),
|
||||
new YtDlpPlugin()
|
||||
],
|
||||
youtubeDL: false,
|
||||
emitNewSongOnly: true,
|
||||
leaveOnEmpty: true,
|
||||
leaveOnFinish: true,
|
||||
leaveOnStop: true,
|
||||
searchSongs: 10,
|
||||
searchCooldown: 30,
|
||||
emptyCooldown: 10,
|
||||
emitAddListWhenCreatingQueue: false,
|
||||
emitAddSongWhenCreatingQueue: false
|
||||
this.player = new Player(this, {
|
||||
autoRegisterExtractor: true,
|
||||
leaveOnEnd: true,
|
||||
leaveOnStop: true
|
||||
});
|
||||
|
||||
this.player
|
||||
.on("playSong", async (queue, song) => {
|
||||
const m = await queue.textChannel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: song.name }, queue.textChannel.guild.data.language) });
|
||||
if (song.duration > 1) {
|
||||
.on("trackStart", async (queue, track) => {
|
||||
const m = await queue.metadata.channel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language) });
|
||||
if (track.durationMS > 1) {
|
||||
setTimeout(() => {
|
||||
if (m.deletable) m.delete();
|
||||
}, song.duration * 1000);
|
||||
}, track.durationMS * 1000);
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
if (m.deletable) m.delete();
|
||||
}, 10 * 60 * 1000); // m * s * ms
|
||||
}
|
||||
})
|
||||
.on("addSong", (queue, song) => queue.textChannel.send({ content: this.translate("music/play:ADDED_QUEUE", { songName: song.name }, queue.textChannel.guild.data.language) }))
|
||||
.on("addList", (queue, playlist) => queue.textChannel.send({ content: this.translate("music/play:ADDED_QUEUE_COUNT", { songCount: `**${playlist.songs.length}** ${this.getNoun(playlist.songs.length, this.translate("misc:NOUNS:TRACKS:1"), this.translate("misc:NOUNS:TRACKS:1"), this.translate("misc:NOUNS:TRACKS:2"), this.translate("misc:NOUNS:TRACKS:5"))}` }, queue.textChannel.guild.data.language) }))
|
||||
.on("searchResult", (message, result) => {
|
||||
let i = 0;
|
||||
const embed = new MessageEmbed()
|
||||
.setDescription(result.map(song => `**${++i} -** ${song.name}`).join("\n"))
|
||||
.setFooter({ text: this.translate("music/play:RESULTS_FOOTER", null, message.guild.data.language) })
|
||||
.setColor(this.config.embed.color);
|
||||
message.reply({ embeds: [embed] });
|
||||
})
|
||||
.on("searchDone", () => {})
|
||||
.on("searchCancel", message => message.error("misc:TIMES_UP"))
|
||||
.on("searchInvalidAnswer", message => message.error("misc:INVALID_NUMBER_RANGE", { min: 1, max: 10 }))
|
||||
.on("searchNoResult", message => message.error("music/play:NO_RESULT"))
|
||||
.on("error", (textChannel, e) => {
|
||||
.on("queueEnd", queue => queue.metadata.channel.send(this.translate("music/play:QUEUE_ENDED", null, queue.metadata.channel.guild.data.language)))
|
||||
.on("channelEmpty", queue => queue.metadata.channel.send(this.translate("music/play:STOP_EMPTY", null, queue.metadata.channel.guild.data.language)))
|
||||
.on("connectionError", (queue, e) => {
|
||||
console.error(e);
|
||||
textChannel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e }, textChannel.guild.data.language) });
|
||||
queue.metadata.channel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e.message }, queue.metadata.channel.guild.data.language) });
|
||||
})
|
||||
.on("finish", queue => queue.textChannel.send(this.translate("music/play:QUEUE_ENDED", null, queue.textChannel.guild.data.language)))
|
||||
// .on("disconnect", queue => queue.textChannel.send(this.translate("music/play:STOP_DISCONNECTED", null, queue.textChannel.guild.data.language)))
|
||||
.on("empty", queue => queue.textChannel.send(this.translate("music/play:STOP_EMPTY", null, queue.textChannel.guild.data.language)));
|
||||
.on("error", (queue, e) => {
|
||||
console.error(e);
|
||||
queue.metadata.channel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e.message }, queue.metadata.channel.guild.data.language) });
|
||||
});
|
||||
|
||||
this.giveawaysManager = new GiveawaysManager(this, {
|
||||
storage: "./giveaways.json",
|
||||
|
@ -125,10 +90,157 @@ class JaBa extends Client {
|
|||
});
|
||||
}
|
||||
|
||||
async init() {
|
||||
this.login(this.config.token);
|
||||
|
||||
mongoose.connect(this.config.mongoDB, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true
|
||||
}).then(() => {
|
||||
this.logger.log("Connected to the Mongodb database.", "log");
|
||||
}).catch((err) => {
|
||||
this.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error");
|
||||
});
|
||||
|
||||
const autoUpdateDocs = require("../helpers/autoUpdateDocs");
|
||||
autoUpdateDocs.update(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} dir
|
||||
* @returns
|
||||
*/
|
||||
async loadCommands(dir) {
|
||||
const filePath = path.join(__dirname, dir);
|
||||
var folders = await fs.readdir(filePath); folders = folders.map(file => path.join(filePath, file)).filter(async (path) => { path = await fs.lstat(path); path.isDirectory(); });
|
||||
const rest = new REST().setToken(this.config.token);
|
||||
const commands = [];
|
||||
for (let index = 0; index < folders.length; index++) {
|
||||
const folder = folders[index];
|
||||
const files = await fs.readdir(folder);
|
||||
|
||||
for (let index = 0; index < files.length; index++) {
|
||||
const file = files[index];
|
||||
|
||||
if (file.endsWith(".js")) {
|
||||
const Command = require(path.join(folder, file));
|
||||
if (Command.prototype instanceof BaseCommand) {
|
||||
const command = new Command(this);
|
||||
this.commands.set(command.command.name, command);
|
||||
const aliases = [];
|
||||
if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0) {
|
||||
command.aliases.forEach((alias) => {
|
||||
const command_alias = (command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? { ...command.command.toJSON() } : { ...command.command };
|
||||
command_alias.name = alias;
|
||||
aliases.push(command_alias);
|
||||
this.commands.set(alias, command);
|
||||
});
|
||||
}
|
||||
|
||||
commands.push((command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? command.command.toJSON() : command.command, ...aliases);
|
||||
|
||||
if (command.onLoad || typeof command.onLoad === "function") await command.onLoad(this);
|
||||
this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (!this.config.production) {
|
||||
await rest.put(
|
||||
Routes.applicationGuildCommands(this.config.user, this.config.support.id), {
|
||||
body: commands
|
||||
}
|
||||
);
|
||||
} else {
|
||||
await rest.put(
|
||||
Routes.applicationCommands(this.config.user), {
|
||||
body: commands
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
this.logger.log("Successfully registered application commands.");
|
||||
} catch (err) {
|
||||
this.logger.log("Cannot load commands: " + err.message, "error");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} dir
|
||||
* @param {String} file
|
||||
*/
|
||||
async loadCommand(dir, file) {
|
||||
const Command = require(path.join(dir, `${file}.js`));
|
||||
if (Command.prototype instanceof BaseCommand) {
|
||||
const command = new Command(this);
|
||||
this.commands.set(command.command.name, command);
|
||||
const aliases = [];
|
||||
if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0) {
|
||||
command.aliases.forEach((alias) => {
|
||||
const command_alias = command.command instanceof SlashCommandBuilder ? { ...command.command.toJSON() } : { ...command.command };
|
||||
command_alias.name = alias;
|
||||
aliases.push(command_alias);
|
||||
this.commands.set(alias, command);
|
||||
});
|
||||
}
|
||||
|
||||
if (command.onLoad || typeof command.onLoad === "function") await command.onLoad(this);
|
||||
this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} dir
|
||||
* @param {String} name
|
||||
*/
|
||||
async unloadCommand(dir, name) {
|
||||
delete require.cache[require.resolve(`${dir}${path.sep}${name}.js`)];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} dir
|
||||
* @returns
|
||||
*/
|
||||
async loadEvents(dir) {
|
||||
const filePath = path.join(__dirname, dir);
|
||||
const files = await fs.readdir(filePath);
|
||||
for (let index = 0; index < files.length; index++) {
|
||||
const file = files[index];
|
||||
const stat = await fs.lstat(path.join(filePath, file));
|
||||
if (stat.isDirectory()) this.loadEvents(path.join(dir, file));
|
||||
if (file.endsWith(".js")) {
|
||||
const Event = require(path.join(filePath, file));
|
||||
if (Event.prototype instanceof BaseEvent) {
|
||||
const event = new Event();
|
||||
if (!event.name || !event.name.length) return console.error(`Cannot load "${file}" event file: Event name is not set!`);
|
||||
if (event.once) this.once(event.name, event.execute.bind(event, this));
|
||||
else this.on(event.name, event.execute.bind(event, this));
|
||||
this.logger.log(`Successfully loaded "${file}" event file. (Event: ${event.name})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get defaultLanguage() {
|
||||
return this.languages.find(language => language.default).name;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} key
|
||||
* @param {Array} args
|
||||
* @param {String} locale
|
||||
*/
|
||||
translate(key, args, locale) {
|
||||
if (!locale) locale = this.defaultLanguage;
|
||||
const language = this.translations.get(locale);
|
||||
|
@ -148,12 +260,12 @@ class JaBa extends Client {
|
|||
}
|
||||
|
||||
convertTime(time, type, noPrefix, locale) {
|
||||
if (!type) time = "to";
|
||||
if (!type) type = false;
|
||||
if (!locale) locale = this.defaultLanguage;
|
||||
const languageData = this.languages.find((language) => language.name === locale || language.aliases.includes(locale));
|
||||
const m = moment(time).locale(languageData.moment);
|
||||
|
||||
return (type === "to" ? m.toNow(noPrefix) : m.fromNow(noPrefix));
|
||||
return (type ? m.toNow(noPrefix) : m.fromNow(noPrefix));
|
||||
}
|
||||
|
||||
getNoun(number, one, two, five) {
|
||||
|
@ -167,40 +279,6 @@ class JaBa extends Client {
|
|||
return five;
|
||||
}
|
||||
|
||||
// This function is used to load a command and add it to the collection
|
||||
loadCommand(commandPath, commandName) {
|
||||
try {
|
||||
const props = new(require(`.${commandPath}${path.sep}${commandName}`))(this);
|
||||
this.logger.log(`Loading Command: ${props.help.name}. 👌`, "log");
|
||||
props.conf.location = commandPath;
|
||||
if (props.init) props.init(this);
|
||||
|
||||
this.commands.set(props.help.name, props);
|
||||
props.help.aliases.forEach((alias) => {
|
||||
this.aliases.set(alias, props.help.name);
|
||||
});
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return `Unable to load command ${commandName}: ${e}`;
|
||||
}
|
||||
}
|
||||
|
||||
// This function is used to unload a command (you need to load them again)
|
||||
async unloadCommand(commandPath, commandName) {
|
||||
let command;
|
||||
if (this.commands.has(commandName)) command = this.commands.get(commandName);
|
||||
else if (this.aliases.has(commandName)) command = this.commands.get(this.aliases.get(commandName));
|
||||
|
||||
if (!command) return `The command \`${commandName}\` doesn't seem to exist, nor is it an alias. Try again!`;
|
||||
if (command.shutdown) await command.shutdown(this);
|
||||
|
||||
delete require.cache[require.resolve(`.${commandPath}${path.sep}${commandName}.js`)];
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// This function is used to find a user data or create it
|
||||
async findOrCreateUser({ id: userID }, isLean) {
|
||||
if (this.databaseCache.users.get(userID)) return isLean ? this.databaseCache.users.get(userID).toJSON() : this.databaseCache.users.get(userID);
|
||||
else {
|
||||
|
@ -225,7 +303,6 @@ class JaBa extends Client {
|
|||
}
|
||||
}
|
||||
|
||||
// This function is used to find a member data or create it
|
||||
async findOrCreateMember({ id: memberID, guildID }, isLean) {
|
||||
if (this.databaseCache.members.get(`${memberID}${guildID}`)) return isLean ? this.databaseCache.members.get(`${memberID}${guildID}`).toJSON() : this.databaseCache.members.get(`${memberID}${guildID}`);
|
||||
else {
|
||||
|
@ -260,7 +337,6 @@ class JaBa extends Client {
|
|||
}
|
||||
}
|
||||
|
||||
// This function is used to find a guild data or create it
|
||||
async findOrCreateGuild({ id: guildID }, isLean) {
|
||||
if (this.databaseCache.guilds.get(guildID)) return isLean ? this.databaseCache.guilds.get(guildID).toJSON() : this.databaseCache.guilds.get(guildID);
|
||||
else {
|
||||
|
@ -284,71 +360,6 @@ class JaBa extends Client {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This function is used to resolve a user from a string
|
||||
async resolveUser(search) {
|
||||
let user = null;
|
||||
if (!search || typeof search !== "string") return;
|
||||
|
||||
// Try ID search
|
||||
if (search.match(/^<@!?(\d+)>$/)) {
|
||||
const id = search.match(/^<@!?(\d+)>$/)[1];
|
||||
user = this.users.fetch(id).catch(() => {});
|
||||
if (user) return user;
|
||||
}
|
||||
|
||||
// Try username search
|
||||
if (search.match(/^!?(\w+)#(\d+)$/)) {
|
||||
const username = search.match(/^!?(\w+)#(\d+)$/)[0];
|
||||
const discriminator = search.match(/^!?(\w+)#(\d+)$/)[1];
|
||||
user = this.users.find((u) => u.username === username && u.discriminator === discriminator);
|
||||
if (user) return user;
|
||||
}
|
||||
user = await this.users.fetch(search).catch(() => {});
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
async resolveMember(search, guild) {
|
||||
let member = null;
|
||||
if (!search || typeof search !== "string") return;
|
||||
|
||||
// Try ID search
|
||||
if (search.match(/^<@!?(\d+)>$/)) {
|
||||
const id = search.match(/^<@!?(\d+)>$/)[1];
|
||||
member = await guild.members.fetch(id).catch(() => {});
|
||||
if (member) return member;
|
||||
}
|
||||
|
||||
// Try username search
|
||||
if (search.match(/^!?(\w+)#(\d+)$/)) {
|
||||
guild = await guild.fetch();
|
||||
member = guild.members.cache.find((m) => m.user.tag === search);
|
||||
if (member) return member;
|
||||
}
|
||||
member = await guild.members.fetch(search).catch(() => {});
|
||||
|
||||
return member;
|
||||
}
|
||||
|
||||
async resolveRole(search, guild) {
|
||||
let role = null;
|
||||
if (!search || typeof search !== "string") return;
|
||||
|
||||
// Try ID search
|
||||
if (search.match(/^<@&!?(\d+)>$/)) {
|
||||
const id = search.match(/^<@&!?(\d+)>$/)[1];
|
||||
role = guild.roles.cache.get(id);
|
||||
if (role) return role;
|
||||
}
|
||||
|
||||
// Try name search
|
||||
role = guild.roles.cache.find((r) => search === r.name);
|
||||
if (role) return role;
|
||||
role = guild.roles.cache.get(search);
|
||||
|
||||
return role;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = JaBa;
|
15
base/Log.js
15
base/Log.js
|
@ -1,15 +0,0 @@
|
|||
const mongoose = require("mongoose");
|
||||
|
||||
module.exports = mongoose.model("Log", new mongoose.Schema({
|
||||
commandName: { type: String, default: "unknown" },
|
||||
date: { type: Number, default: Date.now() },
|
||||
author: { type: Object, default: {
|
||||
username: "Unknown",
|
||||
discrminator: "0000",
|
||||
id: null
|
||||
}},
|
||||
guild: { type: Object, default: {
|
||||
name: "Unknown",
|
||||
id: null
|
||||
}}
|
||||
}));
|
|
@ -1,30 +1,25 @@
|
|||
const mongoose = require("mongoose");
|
||||
|
||||
module.exports = mongoose.model("Member", new mongoose.Schema({
|
||||
/* REQUIRED */
|
||||
id: { type: String }, // Discord ID of the user
|
||||
guildID: { type: String }, // ID of the guild to which the member is connected
|
||||
id: { type: String },
|
||||
guildID: { type: String },
|
||||
|
||||
/* SERVER ECONOMY */
|
||||
money: { type: Number, default: 0 }, // Money of the user
|
||||
workStreak: { type: Number, default: 0 }, // work streak of the user
|
||||
bankSold: { type: Number, default: 0 }, // Bank sold of the user
|
||||
exp: { type: Number, default: 0 }, // Exp points of the user
|
||||
level: { type: Number, default: 0 }, // Level of the user
|
||||
transactions: { type: Array, default: [] }, // Transactions of the user
|
||||
money: { type: Number, default: 0 },
|
||||
workStreak: { type: Number, default: 0 },
|
||||
bankSold: { type: Number, default: 0 },
|
||||
exp: { type: Number, default: 0 },
|
||||
level: { type: Number, default: 0 },
|
||||
transactions: { type: Array, default: [] },
|
||||
|
||||
/* STATS */
|
||||
registeredAt: { type: Number, default: Date.now() }, // Registered date of the member
|
||||
registeredAt: { type: Number, default: Date.now() },
|
||||
|
||||
/* COOLDOWN */
|
||||
cooldowns: { type: Object, default: {
|
||||
work: 0,
|
||||
rob: 0
|
||||
}},
|
||||
|
||||
/* OTHER INFORMATIONS */
|
||||
sanctions: { type: Array, default: [] }, // Array of the member sanctions (mute, ban, kick, etc...)
|
||||
mute: { type: Object, default: { // The member mute infos
|
||||
sanctions: { type: Array, default: [] },
|
||||
mute: { type: Object, default: {
|
||||
muted: false,
|
||||
case: null,
|
||||
endDate: null
|
||||
|
|
33
base/User.js
33
base/User.js
|
@ -11,19 +11,15 @@ const genToken = () => {
|
|||
};
|
||||
|
||||
const userSchema = new mongoose.Schema({
|
||||
/* REQUIRED */
|
||||
id: { type: String }, // Discord ID of the user
|
||||
id: { type: String },
|
||||
|
||||
/* ECONOMY (GLOBAL) */
|
||||
rep: { type: Number, default: 0 }, // Reputation points of the user
|
||||
bio: { type: String }, // Biography of the user
|
||||
birthdate: { type: Number }, // Birthdate of the user (the timestamp)
|
||||
lover: { type: String }, // The person with whom the user is in a relationship
|
||||
rep: { type: Number, default: 0 },
|
||||
bio: { type: String },
|
||||
birthdate: { type: Number },
|
||||
lover: { type: String },
|
||||
|
||||
/* STATS */
|
||||
registeredAt: { type: Number, default: Date.now() }, // Registered date of the user
|
||||
registeredAt: { type: Number, default: Date.now() },
|
||||
|
||||
/* ACHIEVEMENTS */
|
||||
achievements: { type: Object, default: {
|
||||
married: {
|
||||
achieved: false,
|
||||
|
@ -76,23 +72,14 @@ const userSchema = new mongoose.Schema({
|
|||
}
|
||||
}},
|
||||
|
||||
/* COOLDOWN */
|
||||
cooldowns: { type: Object, default: {
|
||||
rep: 0
|
||||
}},
|
||||
|
||||
/* OTHER INFORMATIONS */
|
||||
afk: { type: String, default: null }, // The AFK reason (if any)
|
||||
reminds: { type: Array, default: [] }, // The reminds of the user
|
||||
playlists: { type: Array, default: [] }, // The playlists of the user
|
||||
logged: { type: Boolean, default: false }, // If the user is logged to the dashboard
|
||||
apiToken: { type: String, default: genToken() } // The API token of the user
|
||||
});
|
||||
|
||||
userSchema.method("genApiToken", async function() {
|
||||
this.apiToken = genToken();
|
||||
await this.save();
|
||||
return this.apiToken;
|
||||
afk: { type: String, default: null },
|
||||
reminds: { type: Array, default: [] },
|
||||
logged: { type: Boolean, default: false },
|
||||
apiToken: { type: String, default: genToken() }
|
||||
});
|
||||
|
||||
userSchema.method("getAchievements", async function() {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Addcommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "addcommand",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["addc"],
|
||||
memberPermissions: ["MANAGE_GUILD"],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
if (!args[0]) return message.error("administration/addcommand:MISSING_NAME");
|
||||
|
||||
const name = args[0].split("\n")[0];
|
||||
|
||||
if (this.client.commands.get(name) || this.client.aliases.get(name) || data.guild.customCommands.find((c) => c.name === name)) return message.error("administration/addcommand:COMMAND_ALREADY_EXISTS");
|
||||
|
||||
const answer = (args[0].split("\n")[1] || "") + args.slice(1).join(" ");
|
||||
if (!answer) return message.error("administration/addcommand:MISSING_ANSWER");
|
||||
|
||||
data.guild.customCommands.push({
|
||||
name: name.toLowerCase(),
|
||||
answer: answer
|
||||
});
|
||||
data.guild.save();
|
||||
|
||||
message.success("administration/addcommand:SUCCESS", {
|
||||
commandName: name
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Addcommand;
|
|
@ -1,145 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js"),
|
||||
backup = require("discord-backup");
|
||||
|
||||
backup.setStorageFolder(__dirname + "/../../backups");
|
||||
|
||||
class Backup extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "backup",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["ba"],
|
||||
memberPermissions: ["MANAGE_GUILD"],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ADMINISTRATOR"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 20000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const status = args[0];
|
||||
if (!status) return message.error("administration/backup:MISSING_STATUS");
|
||||
|
||||
if (status === "create") {
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
backup.create(message.guild).then((backup) => {
|
||||
m.delete();
|
||||
|
||||
message.success("administration/backup:SUCCESS_PUBLIC");
|
||||
message.author.send(message.translate("administration/backup:SUCCESS_PRIVATE", {
|
||||
backupID: backup.id
|
||||
})).catch(() => {
|
||||
backup.remove(backup.id);
|
||||
message.error("misc:CANNOT_DM");
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
return message.error("misc:ERR_OCCURRED");
|
||||
});
|
||||
} else if (status === "load") {
|
||||
const backupID = args[1];
|
||||
if (!backupID) return message.error("administration/backup:MISSING_BACKUP_ID");
|
||||
|
||||
backup.fetch(backupID).then(async () => {
|
||||
message.sendT("administration/backup:CONFIRMATION");
|
||||
|
||||
const filter = m => m.author.id === message.author.id;
|
||||
const collector = message.channel.createMessageCollector({
|
||||
filter,
|
||||
time: 20000
|
||||
});
|
||||
|
||||
collector.on("collect", async msg => {
|
||||
if (msg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
|
||||
message.author.send(message.translate("administration/backup:START_LOADING"));
|
||||
|
||||
backup.load(backupID, message.guild).then(() => {
|
||||
backup.remove(backupID);
|
||||
message.author.send(message.translate("administration/backup:LOAD_SUCCESS"));
|
||||
collector.stop();
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
return message.error("misc:ERR_OCCURRED");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
collector.on("end", (_, reason) => {
|
||||
if (reason === "time") return message.error("misc:TIMES_UP");
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
return message.error("administration/backup:NO_BACKUP_FOUND", {
|
||||
backupID
|
||||
});
|
||||
});
|
||||
} else if (status === "info") {
|
||||
const backupID = args[1];
|
||||
if (!backupID) return message.error("administration/backup:MISSING_BACKUP_ID");
|
||||
|
||||
backup.fetch(backupID).then(async (backupInfo) => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setAuthor({
|
||||
name: message.translate("administration/backup:TITLE_INFO")
|
||||
})
|
||||
.addField(message.translate("administration/backup:TITLE_ID"), backupInfo.id, true)
|
||||
.addField(message.translate("administration/backup:TITLE_SERVER_ID"), backupInfo.data.guildID.toString(), true)
|
||||
.addField(message.translate("administration/backup:TITLE_SIZE"), `${backupInfo.size} kb`, true)
|
||||
.addField(message.translate("administration/backup:TITLE_CREATED_AT"), message.printDate(new Date(backupInfo.data.createdTimestamp)), true)
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
});
|
||||
message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
return message.error("administration/backup:NO_BACKUP_FOUND", {
|
||||
backupID
|
||||
});
|
||||
});
|
||||
} else if (status === "remove") {
|
||||
const backupID = args[1];
|
||||
if (!backupID) return message.error("administration/backup:MISSING_BACKUP_ID");
|
||||
|
||||
backup.fetch(backupID).then(async () => {
|
||||
message.sendT("administration/backup:REMOVE_CONFIRMATION");
|
||||
|
||||
const filter = m => m.author.id === message.author.id;
|
||||
const collector = message.channel.createMessageCollector({
|
||||
filter,
|
||||
time: 20000
|
||||
});
|
||||
|
||||
collector.on("collect", async msg => {
|
||||
if (msg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
|
||||
backup.remove(backupID).then(async () => {
|
||||
message.success("administration/backup:SUCCESS_REMOVED");
|
||||
});
|
||||
collector.stop();
|
||||
}
|
||||
});
|
||||
|
||||
collector.on("end", (_, reason) => {
|
||||
if (reason === "time") return message.error("misc:TIMES_UP");
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
return message.error("administration/backup:NO_BACKUP_FOUND", {
|
||||
backupID
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return message.error("administration/backup:MISSING_STATUS");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Backup;
|
|
@ -1,98 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
class Configuration extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "configuration",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["conf", "config"],
|
||||
memberPermissions: ["MANAGE_GUILD"],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const guildData = data.guild;
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setAuthor({
|
||||
name: message.guild.name,
|
||||
iconURL: message.guild.iconURL({
|
||||
dynamic: true
|
||||
})
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
});
|
||||
|
||||
// Guild prefix
|
||||
embed.addField(message.translate("administration/configuration:PREFIX_TITLE"), guildData.prefix);
|
||||
|
||||
// Ignored channels
|
||||
embed.addField(message.translate("administration/configuration:IGNORED_CHANNELS_TITLE"), guildData.ignoredChannels.length > 0 ? guildData.ignoredChannels.map((ch) => `<#${ch}>`).join(", ") : message.translate("administration/configuration:NO_IGNORED_CHANNELS"));
|
||||
|
||||
// Autorole plugin
|
||||
embed.addField(message.translate("administration/configuration:AUTOROLE_TITLE"), guildData.plugins.autorole.enabled ? message.translate("administration/configuration:AUTOROLE_CONTENT", {
|
||||
roleName: `<@&${guildData.plugins.autorole.role}>`
|
||||
}) : message.translate("administration/configuration:AUTOROLE_DISABLED"));
|
||||
|
||||
// Welcome plugin
|
||||
embed.addField(message.translate("administration/configuration:WELCOME_TITLE"), guildData.plugins.welcome.enabled ? message.translate("administration/configuration:WELCOME_CONTENT", {
|
||||
channel: `<#${guildData.plugins.welcome.channel}>`,
|
||||
withImage: guildData.plugins.welcome.withImage ? message.translate("common:YES") : message.translate("common:NO")
|
||||
}) : message.translate("administration/configuration:WELCOME_DISABLED"));
|
||||
|
||||
// Goodbye plugin
|
||||
embed.addField(message.translate("administration/configuration:GOODBYE_TITLE"), guildData.plugins.goodbye.enabled ? message.translate("administration/configuration:GOODBYE_CONTENT", {
|
||||
channel: `<#${guildData.plugins.goodbye.channel}>`,
|
||||
withImage: guildData.plugins.goodbye.withImage ? message.translate("common:YES") : message.translate("common:NO")
|
||||
}) : message.translate("administration/configuration:GOODBYE_DISABLED"));
|
||||
|
||||
// Special channels
|
||||
embed.addField(message.translate("administration/configuration:SPECIAL_CHANNELS"),
|
||||
message.translate("administration/configuration:SUGGESTIONS", {
|
||||
channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : message.translate("common:NOT_DEFINED")
|
||||
}) + "\n" +
|
||||
message.translate("administration/configuration:REPORTS", {
|
||||
channel: guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : message.translate("common:NOT_DEFINED")
|
||||
}) + "\n" +
|
||||
message.translate("administration/configuration:MODLOGS", {
|
||||
channel: guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : message.translate("common:NOT_DEFINED")
|
||||
}) + "\n" +
|
||||
message.translate("administration/configuration:BIRTHDAYS", {
|
||||
channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : message.translate("common:NOT_DEFINED")
|
||||
})
|
||||
);
|
||||
|
||||
// Auto sanctions
|
||||
embed.addField(message.translate("administration/configuration:AUTO_SANCTIONS"), (guildData.plugins.warnsSanctions.kick ? message.translate("administration/configuration:KICK_CONTENT", {
|
||||
count: guildData.plugins.warnsSanctions.kick
|
||||
}) : message.translate("administration/configuration:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? message.translate("administration/configuration:BAN_CONTENT", {
|
||||
count: guildData.plugins.warnsSanctions.ban
|
||||
}) : message.translate("administration/configuration:BAN_NOT_DEFINED")));
|
||||
|
||||
// Automod plugin
|
||||
embed.addField(message.translate("administration/configuration:AUTOMOD_TITLE"), guildData.plugins.automod.enabled ? message.translate("administration/configuration:AUTOMOD_CONTENT", {
|
||||
channels: guildData.plugins.automod.ignored.map((ch) => `<#${ch}>`)
|
||||
}) : message.translate("administration/configuration:AUTOMOD_DISABLED"));
|
||||
|
||||
// Auto-delete mod commands
|
||||
embed.addField(message.translate("administration/configuration:AUTODELETEMOD"), guildData.autoDeleteModCommands ? message.translate("administration/configuration:AUTODELETEMOD_ENABLED") : message.translate("administration/configuration:AUTODELETEMOD_DISABLED"));
|
||||
|
||||
// Dashboard link
|
||||
embed.addField(message.translate("administration/configuration:DASHBOARD_TITLE"), `[${message.translate("administration/configuration:DASHBOARD_CONTENT")}](${data.config.dashboard.baseURL})`);
|
||||
|
||||
message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Configuration;
|
|
@ -1,33 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Delcommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "delcommand",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["delc"],
|
||||
memberPermissions: ["MANAGE_GUILD"],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const name = args[0];
|
||||
if (!name) return message.error("administration/delcommand:MISSING_NAME");
|
||||
if (!data.guild.customCommands.find((c) => c.name === name)) return message.error("administration/delcommand:UNKNOWN_COMMAND", { commandName: name });
|
||||
|
||||
data.guild.customCommands = data.guild.customCommands.filter((c) => c.name !== name);
|
||||
data.guild.save();
|
||||
|
||||
message.success("administration/delcommand:SUCCESS", {
|
||||
commandName: name
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Delcommand;
|
|
@ -1,41 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Ignore extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "ignore",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["ig"],
|
||||
memberPermissions: ["MANAGE_GUILD"],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const channel = message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first();
|
||||
if (!channel) return message.error("misc:INVALID_CHANNEL");
|
||||
|
||||
const ignored = data.guild.ignoredChannels.includes(channel.id);
|
||||
|
||||
if (ignored) {
|
||||
data.guild.ignoredChannels = data.guild.ignoredChannels.filter((ch) => ch !== channel.id);
|
||||
data.guild.save();
|
||||
return message.success("administration/ignore:ALLOWED", {
|
||||
channel: channel.toString()
|
||||
});
|
||||
} else if (!ignored) {
|
||||
data.guild.ignoredChannels.push(channel.id);
|
||||
data.guild.save();
|
||||
return message.success("administration/ignore:IGNORED", {
|
||||
channel: channel.toString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Ignore;
|
|
@ -1,33 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Setprefix extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "setprefix",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["setp"],
|
||||
memberPermissions: ["MANAGE_GUILD"],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const prefix = args[0];
|
||||
if (!prefix) return message.error("administration/setprefix:MISSING_PREFIX");
|
||||
if (prefix.length > 5) return message.error("administration/setprefix:TOO_LONG");
|
||||
|
||||
data.guild.prefix = prefix;
|
||||
data.guild.save();
|
||||
|
||||
return message.success("administration/setprefix:SUCCESS", {
|
||||
prefix
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Setprefix;
|
|
@ -1,54 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
ms = require("ms");
|
||||
|
||||
class Slowmode extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "slowmode",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["sl"],
|
||||
memberPermissions: ["MANAGE_GUILD"],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const channel = message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first();
|
||||
if (!channel) return message.error("misc:INVALID_CHANNEL");
|
||||
|
||||
const time = args[1];
|
||||
if (!time) {
|
||||
if (!data.guild.slowmode.channels.find((ch) => ch.id === channel.id)) return message.error("misc:INVALID_TIME");
|
||||
|
||||
data.guild.slowmode.channels = data.guild.slowmode.channels.filter((ch) => ch.id !== channel.id);
|
||||
data.guild.markModified("slowmode.channels");
|
||||
data.guild.save();
|
||||
message.success("administration/slowmode:DISABLED", {
|
||||
prefix: data.guild.prefix,
|
||||
channel: `#${channel.name}`
|
||||
});
|
||||
} else {
|
||||
if (isNaN(ms(time))) return message.error("misc:INVALID_TIME");
|
||||
if (data.guild.slowmode.channels.find((ch) => ch.id === channel.id)) data.guild.slowmode.channels = data.guild.slowmode.channels.filter((ch) => ch.id !== channel.id);
|
||||
|
||||
data.guild.slowmode.channels.push({
|
||||
id: channel.id,
|
||||
time: ms(time)
|
||||
});
|
||||
data.guild.markModified("slowmode.channels");
|
||||
data.guild.save();
|
||||
message.success("administration/slowmode:ENABLED", {
|
||||
prefix: data.guild.prefix,
|
||||
channel: `#${channel.name}`,
|
||||
time: this.client.functions.convertTime(message.guild, ms(time))
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Slowmode;
|
|
@ -1,80 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
class Achievements extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "achievements",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["ac"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
let member = message.guild ? message.member : message.author;
|
||||
if (args[0]) member = await this.client.resolveMember(args[0], message.guild);
|
||||
if (message.guild && member.user.bot) return message.error("economy/profile:BOT_USER");
|
||||
|
||||
const userData = (member.id === message.author.id ? data.userData : await this.client.findOrCreateUser({
|
||||
id: member.id
|
||||
}));
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setAuthor({
|
||||
name: message.translate("economy/achievements:TITLE")
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
});
|
||||
|
||||
embed.addField(message.translate("economy/achievements:SEND_CMD"), message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.firstCommand.progress.now,
|
||||
total: userData.achievements.firstCommand.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total))
|
||||
}));
|
||||
embed.addField(message.translate("economy/achievements:CLAIM_SALARY"), message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.work.progress.now,
|
||||
total: userData.achievements.work.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total))
|
||||
}));
|
||||
embed.addField(message.translate("economy/achievements:MARRY"), message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.married.progress.now,
|
||||
total: userData.achievements.married.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total))
|
||||
}));
|
||||
embed.addField(message.translate("economy/achievements:SLOTS"), message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.slots.progress.now,
|
||||
total: userData.achievements.slots.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total))
|
||||
}));
|
||||
embed.addField(message.translate("economy/achievements:TIP"), message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.tip.progress.now,
|
||||
total: userData.achievements.tip.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total))
|
||||
}));
|
||||
embed.addField(message.translate("economy/achievements:REP"), message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.rep.progress.now,
|
||||
total: userData.achievements.rep.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total))
|
||||
}));
|
||||
embed.addField(message.translate("economy/achievements:INVITE"), message.translate("economy/achievements:PROGRESS", {
|
||||
now: userData.achievements.invite.progress.now,
|
||||
total: userData.achievements.invite.progress.total,
|
||||
percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total))
|
||||
}));
|
||||
|
||||
message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Achievements;
|
|
@ -1,157 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
const currentGames = {};
|
||||
|
||||
class FindWords extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "findwords",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["findw"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
if (currentGames[message.guild.id]) return message.error("economy/number:GAME_RUNNING");
|
||||
|
||||
// Reads words file
|
||||
let lang = null;
|
||||
if (message.guild.data.language === "uk-UA") return lang = "ru-RU";
|
||||
else lang = message.guild.data.language;
|
||||
|
||||
const wordList = require(`../../assets/json/words/${lang}.json`);
|
||||
|
||||
// Init some utils variables
|
||||
const participants = [],
|
||||
winners = [],
|
||||
words = [],
|
||||
nbGames = this.client.functions.randomNum(3, 10);
|
||||
|
||||
// Store the date wich the game has started
|
||||
const createdAt = Date.now(); // 20929038303
|
||||
|
||||
for (let i = 0; i < nbGames; i++) {
|
||||
const result = Math.floor((Math.random() * wordList.length));
|
||||
words.push(wordList[result].substring(0, 3).toLowerCase());
|
||||
}
|
||||
|
||||
let i = 0; // Inits i variable to count games
|
||||
currentGames[message.guild.id] = true; // Update current game variable
|
||||
generateGame.call(this, words[i]); // Generate a new round
|
||||
|
||||
function generateGame(word) {
|
||||
word = word.toLowerCase();
|
||||
|
||||
// Launch timer
|
||||
const delay = (i === 0) ? 10000 : 0;
|
||||
if (i === 0) message.sendT("economy/findwords:GAME_STARTING");
|
||||
|
||||
setTimeout(() => {
|
||||
// Send announcment message
|
||||
message.sendT("economy/findwords:FIND_WORD", {
|
||||
word: word.toUpperCase()
|
||||
}, false, false, "warn");
|
||||
|
||||
// init a collector to receive the answers
|
||||
const filter = m => !m.author.bot;
|
||||
const collector = new Discord.MessageCollector(message.channel, {
|
||||
filter,
|
||||
time: 20000
|
||||
});
|
||||
|
||||
collector.on("collect", (msg) => {
|
||||
if (this.client.functions.getPrefix(msg, data)) return;
|
||||
if (!participants.includes(msg.author.id)) participants.push(msg.author.id);
|
||||
if (msg.content === "STOP") return collector.stop("force");
|
||||
if (msg.content.toLowerCase().indexOf(word) >= 0 && wordList.map((word) => word.toLowerCase()).indexOf(msg.content.toLowerCase()) >= 0) {
|
||||
collector.stop(msg.author.id); // Stop the collector
|
||||
} else msg.error("economy/findwords:INVALID_WORD", { member: msg.author.toString() });
|
||||
});
|
||||
|
||||
collector.on("end", async (collected, reason) => {
|
||||
if (reason === "time") message.error("economy/findwords:NO_WINNER");
|
||||
else if (reason === "force") return message.error("misc:FORCE_STOP", { user: message.author.toString() });
|
||||
else {
|
||||
message.success("economy/findwords:WORD_FOUND", {
|
||||
winner: `<@${reason}>`
|
||||
});
|
||||
winners.push(reason);
|
||||
}
|
||||
|
||||
if (i < nbGames - 1) {
|
||||
i++;
|
||||
generateGame.call(this, words[i]);
|
||||
} else {
|
||||
currentGames[message.guild.id] = false;
|
||||
if (winners.length < 1) return message.error("economy/findwords:NO_WINNER_ALL");
|
||||
|
||||
const winnerID = await getWinner(winners);
|
||||
const time = message.convertTime(createdAt, "from", true);
|
||||
const user = await this.client.users.fetch(winnerID);
|
||||
message.sendT("economy/findwords:GAME_STATS", {
|
||||
winner: user.username,
|
||||
duration: time,
|
||||
participantCount: participants.length,
|
||||
participants: participants.map((p) => `<@${p}>`).join(", ")
|
||||
});
|
||||
if (participants.length > 1 && data.guild.disabledCategories && !data.guild.disabledCategories.includes("Economy")) {
|
||||
const won = 150 * (participants.length * 0.5);
|
||||
|
||||
message.sendT("economy/findwords:CREDITS", {
|
||||
winner: user.username,
|
||||
credits: `**${won}** ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
|
||||
});
|
||||
|
||||
const memberData = await this.client.findOrCreateMember({
|
||||
id: user.id,
|
||||
guildID: message.guild.id
|
||||
});
|
||||
|
||||
const info = {
|
||||
user: message.translate("economy/transactions:WORDS"),
|
||||
amount: won,
|
||||
date: Date.now(),
|
||||
type: "got"
|
||||
};
|
||||
|
||||
data.memberData.transactions.push(info);
|
||||
|
||||
memberData.money += won;
|
||||
memberData.save();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, delay);
|
||||
}
|
||||
|
||||
async function getWinner(array) {
|
||||
return new Promise(function (resolve) {
|
||||
const counts = {};
|
||||
let compare = 0,
|
||||
mostFrequent;
|
||||
|
||||
for (let i = 0, len = array.length; i < len; i++) {
|
||||
const winner = array[i];
|
||||
if (!counts[winner]) counts[winner] = 1;
|
||||
else counts[winner] = counts[winner] + 1;
|
||||
|
||||
if (counts[winner] > compare) {
|
||||
compare = counts[winner];
|
||||
mostFrequent = array[i];
|
||||
}
|
||||
}
|
||||
resolve(mostFrequent);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = FindWords;
|
|
@ -1,98 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
const asyncForEach = async (collection, callback) => {
|
||||
const allPromises = collection.map(async key => {
|
||||
await callback(key);
|
||||
});
|
||||
|
||||
return await Promise.all(allPromises);
|
||||
};
|
||||
|
||||
class Profile extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "profile",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["prof"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const arg = args[0] || message.author;
|
||||
let member = await this.client.resolveMember(arg, message.guild);
|
||||
if (!member) member = message.member;
|
||||
if (member.user.bot) return message.error("economy/profile:BOT_USER");
|
||||
|
||||
const memberData = (member.id === message.author.id ? data.memberData : await this.client.findOrCreateMember({
|
||||
id: member.id,
|
||||
guildID: message.guild.id
|
||||
}));
|
||||
const userData = (member.id === message.author.id ? data.userData : await this.client.findOrCreateUser({
|
||||
id: member.id
|
||||
}));
|
||||
if (userData.lover && !this.client.users.cache.get(userData.lover)) await this.client.users.fetch(userData.lover, true);
|
||||
|
||||
const commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(member.id));
|
||||
let globalMoney = 0;
|
||||
await asyncForEach(commonsGuilds, async (guild) => {
|
||||
const data = await this.client.findOrCreateMember({
|
||||
id: member.id,
|
||||
guildID: guild.id
|
||||
});
|
||||
globalMoney += data.money;
|
||||
globalMoney += data.bankSold;
|
||||
});
|
||||
|
||||
const profileEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor({
|
||||
name: message.translate("economy/profile:TITLE", {
|
||||
username: member.user.tag
|
||||
}),
|
||||
iconURL: member.user.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
})
|
||||
})
|
||||
.setImage("attachment://achievements.png")
|
||||
.addField(this.client.customEmojis.link + " " + message.translate("economy/profile:LINK"), `[${message.translate("economy/profile:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/user/${member.user.id}/${message.guild.id})`)
|
||||
.addField(message.translate("economy/profile:BIO"), userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO"))
|
||||
.addField(message.translate("economy/profile:CASH"), `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
|
||||
.addField(message.translate("economy/profile:BANK"), `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
|
||||
.addField(message.translate("economy/profile:GLOBAL"), `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
|
||||
.addField(message.translate("economy/profile:REPUTATION"), `**${userData.rep}** ${message.getNoun(userData.rep, message.translate("misc:NOUNS:POINTS:1"), message.translate("misc:NOUNS:POINTS:2"), message.translate("misc:NOUNS:POINTS:5"))}`, true)
|
||||
.addField(message.translate("economy/profile:LEVEL"), `**${memberData.level}**`, true)
|
||||
.addField(message.translate("economy/profile:EXP"), `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`, true)
|
||||
.addField(message.translate("economy/profile:REGISTERED"), message.printDate(new Date(memberData.registeredAt)), true)
|
||||
.addField(message.translate("economy/profile:BIRTHDATE"), (!userData.birthdate ? message.translate("economy/profile:NO_BIRTHDATE") : message.printDate(new Date(userData.birthdate))), true)
|
||||
.addField(message.translate("economy/profile:LOVER"), (!userData.lover ? message.translate("economy/profile:NO_LOVER") : this.client.users.cache.get(userData.lover).tag), true)
|
||||
.addField(message.translate("economy/profile:ACHIEVEMENTS"), message.translate("economy/profile:ACHIEVEMENTS_CONTENT", {
|
||||
prefix: data.guild.prefix
|
||||
}))
|
||||
.setColor(data.config.embed.color) // Sets the color of the embed
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
}) // Sets the footer of the embed
|
||||
.setTimestamp();
|
||||
|
||||
const buffer = await userData.getAchievements();
|
||||
|
||||
message.reply({
|
||||
embeds: [profileEmbed],
|
||||
files: [{
|
||||
name: "achievements.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Profile;
|
|
@ -1,28 +1,50 @@
|
|||
const Command = require("../../base/Command");
|
||||
const { SlashCommandBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Eightball extends Command {
|
||||
class Eightball extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "8ball",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("8ball")
|
||||
.setDescription(client.translate("fun/8ball:DESCRIPTION"))
|
||||
.addStringOption(option =>
|
||||
option.setName("question")
|
||||
.setDescription(client.translate("fun/8ball:QUESTION"))
|
||||
.setRequired(true)),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["8b"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
await interaction.deferReply();
|
||||
const question = interaction.options.getString("question");
|
||||
|
||||
async run(message, args) {
|
||||
if (!args[0] || !message.content.endsWith("?")) return message.error("fun/8ball:ERR_QUESTION");
|
||||
if (!question.endsWith("?")) return interaction.replyT("fun/8ball:ERR_QUESTION", null, { ephemeral: true });
|
||||
|
||||
const answerN = this.client.functions.randomNum(1, 20);
|
||||
const answer = message.translate(`fun/8ball:RESPONSE_${answerN}`);
|
||||
const answerN = client.functions.randomNum(1, 20);
|
||||
const answer = interaction.translate(`fun/8ball:RESPONSE_${answerN}`);
|
||||
await client.wait(2000);
|
||||
|
||||
message.reply({
|
||||
interaction.editReply({
|
||||
content: answer
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
figlet = require("figlet"),
|
||||
util = require("util"),
|
||||
figletAsync = util.promisify(figlet);
|
||||
|
||||
class Ascii extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "ascii",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const text = args.join(" ");
|
||||
if (!text || text.length > 20) return message.error("fun/ascii:TEXT_MISSING");
|
||||
|
||||
const rendered = await figletAsync(text);
|
||||
|
||||
message.reply({
|
||||
content: "```" + rendered + "```"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Ascii;
|
|
@ -1,36 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Choice extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "choice",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["cho", "ra"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
// Gets the answers by spliting on "/"
|
||||
const answers = args.join(" ").split("/");
|
||||
if (answers.length < 2) return message.error("fun/choice:MISSING");
|
||||
if (answers.some(answer => !answer)) return message.error("fun/choice:EMPTY");
|
||||
|
||||
const m = await message.sendT("fun/choice:PROGRESS", null, false, false, "loading");
|
||||
|
||||
setTimeout(() => {
|
||||
const result = answers[parseInt(Math.floor(Math.random() * answers.length))];
|
||||
m.success("fun/choice:DONE", { result }, {
|
||||
edit: true
|
||||
});
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Choice;
|
|
@ -1,25 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Flip extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "flip",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["dice", "coin"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
const isHeads = Math.random() > 0.5;
|
||||
isHeads ? message.sendT("fun/flip:HEADS") : message.sendT("fun/flip:TAILS");
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Flip;
|
|
@ -1,30 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Lmg extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "lmg",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["lmgtfy"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const question = args.join(" ");
|
||||
if (!question) return message.error("fun/lmg:MISSING");
|
||||
const encodedQuestion = question.replace(/[' '_]/g, "+");
|
||||
await message.reply({
|
||||
content: `<https://letmegooglethat.com/?q=${encodedQuestion}>`
|
||||
});
|
||||
message.delete().catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Lmg;
|
47
commands/Fun/lmgtfy.js
Normal file
47
commands/Fun/lmgtfy.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
const { SlashCommandBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class LMGTFY extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("lmgtfy")
|
||||
.setDescription(client.translate("fun/lmgtfy:DESCRIPTION"))
|
||||
.addStringOption(option =>
|
||||
option.setName("question")
|
||||
.setDescription(client.translate("fun/8ball:QUESTION"))
|
||||
.setRequired(true)),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const question = interaction.options.getString("question").replace(/[' '_]/g, "+");
|
||||
|
||||
interaction.reply({
|
||||
content: `<https://letmegooglethat.com/?q=${question}>`,
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LMGTFY;
|
|
@ -1,31 +1,46 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js"),
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand"),
|
||||
md5 = require("md5");
|
||||
|
||||
class Lovecalc extends Command {
|
||||
class Lovecalc extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "lovecalc",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("lovecalc")
|
||||
.setDescription(client.translate("fun/lovecalc:DESCRIPTION"))
|
||||
.addUserOption(option =>
|
||||
option.setName("first_member")
|
||||
.setDescription(client.translate("common:USER"))
|
||||
.setRequired(true))
|
||||
.addUserOption(option =>
|
||||
option.setName("second_member")
|
||||
.setDescription(client.translate("common:USER"))),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["lc"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const firstMember = message.mentions.members.filter(m => m.id !== message.author.id).first();
|
||||
if (!firstMember) return message.error("fun/lovecalc:MISSING");
|
||||
const secondMember = message.mentions.members
|
||||
.filter(m => m.id !== firstMember.id)
|
||||
.filter(m => m.id !== message.author.id)
|
||||
.first() || message.member;
|
||||
if (!secondMember) return message.error("fun/lovecalc:MISSING");
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const firstMember = interaction.options.getMember("first_member");
|
||||
const secondMember = interaction.options.getMember("second_member") || interaction.member;
|
||||
|
||||
const members = [firstMember, secondMember].sort((a, b) => parseInt(a.id, 10) - parseInt(b.id, 10));
|
||||
const hash = md5(`${members[0].id}${members[1].user.username}${members[0].user.username}${members[1].id}`);
|
||||
|
@ -36,21 +51,21 @@ class Lovecalc extends Command {
|
|||
.join("");
|
||||
const percent = parseInt(string.substr(0, 2), 10);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: `❤️ ${message.translate("fun/lovecalc:DESCRIPTION")}`
|
||||
name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}`
|
||||
})
|
||||
.setDescription(message.translate("fun/lovecalc:CONTENT", {
|
||||
.setDescription(interaction.translate("fun/lovecalc:CONTENT", {
|
||||
percent,
|
||||
firstUsername: firstMember.user.username,
|
||||
secondUsername: secondMember.user.username
|
||||
firstMember: firstMember,
|
||||
secondMember: secondMember
|
||||
}))
|
||||
.setColor(data.config.embed.color)
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
});
|
||||
|
||||
message.reply({
|
||||
interaction.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,77 +1,81 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js"),
|
||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, ComponentType } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand"),
|
||||
fetch = require("node-fetch");
|
||||
|
||||
class Memes extends Command {
|
||||
class Memes extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "memes",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("memes")
|
||||
.setDescription(client.translate("fun/memes:DESCRIPTION")),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["mem"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const tags = ["memes", "dankmemes", "me_irl", "wholesomememes"].map(tag =>
|
||||
JSON.parse(JSON.stringify({
|
||||
label: tag,
|
||||
value: tag
|
||||
}))
|
||||
);
|
||||
|
||||
async run(message, args, data) {
|
||||
const tag = args[0];
|
||||
const subs = ["memes", "dankmemes", "me_irl", "wholesomememes"];
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new SelectMenuBuilder()
|
||||
.setCustomId("memes_select")
|
||||
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
||||
.addOptions(tags)
|
||||
);
|
||||
|
||||
if (tag === "list") {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
})
|
||||
.setTitle(message.translate("fun/memes:EMBED_TITLE"))
|
||||
.setDescription(subs.join("\n"))
|
||||
.setTimestamp();
|
||||
const msg = await interaction.reply({
|
||||
content: interaction.translate("common:AVAILABLE_CATEGORIES"),
|
||||
components: [row],
|
||||
fetchReply: true
|
||||
});
|
||||
|
||||
message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
} else if (!tag) {
|
||||
const m = await message.sendT("fun/memes:SEARCHING_RANDOM");
|
||||
|
||||
const res = await fetch("https://meme-api.herokuapp.com/gimme/").then(response => response.json());
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
})
|
||||
.setTitle(`${res.title}\n${message.translate("fun/memes:SUBREDDIT")}: ${res.subreddit}\n${message.translate("common:AUTHOR")}: ${res.author}\n${message.translate("fun/memes:UPS")}: ${res.ups}`)
|
||||
.setImage(res.url)
|
||||
.setTimestamp();
|
||||
|
||||
m.edit({
|
||||
content: null,
|
||||
embeds: [embed]
|
||||
});
|
||||
} else if (subs.includes(tag)) {
|
||||
const m = await message.sendT("fun/memes:SEARCHING", {
|
||||
tag
|
||||
});
|
||||
const collector = new InteractionCollector(client, {
|
||||
componentType: ComponentType.SelectMenu,
|
||||
message: msg,
|
||||
idle: 60 * 1000
|
||||
});
|
||||
|
||||
collector.on("collect", async msg => {
|
||||
const tag = msg?.values[0];
|
||||
const res = await fetch(`https://meme-api.herokuapp.com/gimme/${tag}`).then(response => response.json());
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setColor(data.config.embed.color)
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
})
|
||||
.setTitle(`${res.title}\n${message.translate("fun/memes:SUBREDDIT")}: ${res.subreddit}\n${message.translate("common:AUTHOR")}: ${res.author}\n${message.translate("fun/memes:UPS")}: ${res.ups}`)
|
||||
.setTitle(`${res.title}\n${interaction.translate("fun/memes:SUBREDDIT")}: ${res.subreddit}\n${interaction.translate("common:AUTHOR")}: ${res.author}\n${interaction.translate("fun/memes:UPS")}: ${res.ups}`)
|
||||
.setImage(res.url)
|
||||
.setTimestamp();
|
||||
|
||||
m.edit({
|
||||
content: null,
|
||||
await msg.update({
|
||||
embeds: [embed]
|
||||
});
|
||||
} else return message.error("fun/memes:NOT_FOUND");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,262 +1,88 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, PermissionsBitField, ComponentType } = require("discord.js"),
|
||||
{ defaultApplications } = require("../../helpers/discordTogether");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Activity extends Command {
|
||||
class Activity extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "activity",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("activity")
|
||||
.setDescription(client.translate("general/activity:DESCRIPTION")),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["act"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const voice = interaction.member.voice.channel;
|
||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
||||
|
||||
async run(message, args, data) {
|
||||
const voice = message.member.voice.channel;
|
||||
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
|
||||
const perms = voice.permissionsFor(client.user);
|
||||
if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT");
|
||||
|
||||
const perms = voice.permissionsFor(this.client.user);
|
||||
if (!perms.has(Discord.Permissions.FLAGS.CONNECT) || !perms.has(Discord.Permissions.FLAGS.SPEAK)) return message.error("music/play:VOICE_CHANNEL_CONNECT");
|
||||
const activities = defaultApplications.map(a => {
|
||||
return {
|
||||
label: `${a.name} ${a.premium_tier_level ? `(${interaction.translate("general/activity:BOOST_NEEDED")})` : ""}`,
|
||||
value: a.id
|
||||
};
|
||||
});
|
||||
|
||||
const activities = [
|
||||
"betrayal",
|
||||
`checkers (${message.translate("general/activity:NO_BOOST")})`,
|
||||
`chess (${message.translate("general/activity:NO_BOOST")})`,
|
||||
"sketchheads",
|
||||
`ocho (${message.translate("general/activity:NO_BOOST")})`,
|
||||
"fishing",
|
||||
"lettertile",
|
||||
`poker (${message.translate("general/activity:NO_BOOST")})`,
|
||||
`spellcast (${message.translate("general/activity:NO_BOOST")})`,
|
||||
"wordsnack",
|
||||
"puttparty",
|
||||
"youtube"
|
||||
];
|
||||
const activity = args[0];
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new SelectMenuBuilder()
|
||||
.setCustomId("activity_select")
|
||||
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
||||
.addOptions(activities)
|
||||
);
|
||||
|
||||
switch (activity) {
|
||||
case "betrayal":
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "betrayal").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Betrayal.io")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Betrayal.io", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
const msg = await interaction.reply({
|
||||
content: interaction.translate("general/activity:AVAILABLE_ACTIVITIES"),
|
||||
components: [row],
|
||||
fetchReply: true
|
||||
});
|
||||
|
||||
case "checkers":
|
||||
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
|
||||
const collector = new InteractionCollector(client, {
|
||||
componentType: ComponentType.SelectMenu,
|
||||
message: msg,
|
||||
idle: 60 * 1000
|
||||
});
|
||||
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "checkers").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Checkers In The Park")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Checkers In The Park", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
collector.on("collect", async msg => {
|
||||
const activity = msg?.values[0];
|
||||
|
||||
case "chess":
|
||||
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
|
||||
const invite = await client.discordTogether.createTogetherCode(voice.id, activity);
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(activity)
|
||||
.setColor(client.config.embed.color)
|
||||
.setDescription(`**[${interaction.translate("misc:CLICK_HERE", { activity: defaultApplications.find(a => a.id === activity).name, channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: client.config.embed.footer
|
||||
})
|
||||
.setTimestamp();
|
||||
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "chess").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Chess In The Park")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Chess In The Park", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "sketchheads":
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "sketchheads").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Sketch Heads")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Sketch Heads", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "ocho":
|
||||
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
|
||||
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "ocho").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Ocho")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Ocho", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "fishing":
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "fishing").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Fishington.io")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Fishington.io", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "lettertile":
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "lettertile").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Letter Tile")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Letter Tile", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "poker":
|
||||
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
|
||||
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "poker").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Poker Night")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Poker Night", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "spellcast":
|
||||
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
|
||||
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "spellcast").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Spell Cast")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Spell Cast", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "wordsnack":
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "wordsnack").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Words Snack")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Words Snack", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "puttparty":
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "puttparty").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Puttparty")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Puttparty", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
case "youtube":
|
||||
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "youtube").then(async invite => {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Youtube Together")
|
||||
.setColor(data.config.embed.color)
|
||||
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Youtube Together", channel: voice.name })}](${invite.code})**`)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
default: {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.translate("general/activity:TITLE"))
|
||||
.setDescription(activities.join("\n"))
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: message.translate("general/activity:FOOTER")
|
||||
})
|
||||
.setTimestamp();
|
||||
message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
}
|
||||
await msg.update({
|
||||
embeds: [embed],
|
||||
components: []
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
48
commands/General/afk.js
Normal file
48
commands/General/afk.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
const { SlashCommandBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Afk extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("afk")
|
||||
.setDescription(client.translate("general/afk:DESCRIPTION"))
|
||||
.addStringOption(option => option.setName("message")
|
||||
.setDescription(client.translate("common:MESSAGE"))
|
||||
.setRequired(true)),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction, data) {
|
||||
const reason = interaction.options.getString("message");
|
||||
|
||||
data.userData.afk = reason;
|
||||
data.userData.save();
|
||||
|
||||
interaction.success("general/afk:SUCCESS", {
|
||||
reason
|
||||
}, { ephemeral: true });
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Afk;
|
49
commands/General/avatar.js
Normal file
49
commands/General/avatar.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
const { SlashCommandBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Avatar extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("avatar")
|
||||
.setDescription(client.translate("general/avatar:DESCRIPTION"))
|
||||
.addUserOption(option => option.setName("user")
|
||||
.setDescription(client.translate("common:USER"))),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const user = interaction.options.getUser("user") || interaction.user;
|
||||
const avatarURL = user.displayAvatarURL({
|
||||
size: 512
|
||||
});
|
||||
|
||||
interaction.reply({
|
||||
files: [{
|
||||
attachment: avatarURL
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Avatar;
|
|
@ -1,46 +1,71 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class EmojiInfo extends Command {
|
||||
class Emoji extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "emoji",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("emoji")
|
||||
.setDescription(client.translate("general/emoji:DESCRIPTION"))
|
||||
.addStringOption(option => option.setName("emoji")
|
||||
.setDescription(client.translate("common:EMOJI"))
|
||||
.setRequired(true)),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["emi"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const rawEmoji = interaction.options.getString("emoji");
|
||||
const parsedEmoji = parseEmoji(rawEmoji);
|
||||
|
||||
async run(message, args, data) {
|
||||
const rawEmoji = args[0];
|
||||
if (!rawEmoji) return message.error("administration/stealemoji:MISSING_EMOJI");
|
||||
|
||||
const parsedEmoji = Discord.Util.parseEmoji(rawEmoji);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("general/emoji:TITLE", {
|
||||
name: interaction.translate("general/emoji:TITLE", {
|
||||
emoji: parsedEmoji.name
|
||||
})
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
})
|
||||
.addField(message.translate("general/emoji:NAME"), parsedEmoji.name)
|
||||
.addField(message.translate("general/emoji:ANIMATED"), parsedEmoji.animated ? message.translate("common:YES") : message.translate("common:NO"))
|
||||
.addField(message.translate("general/emoji:ID"), parsedEmoji.id ? parsedEmoji.id.toString() : message.translate("general/emoji:STANDART"));
|
||||
.addFields([
|
||||
{
|
||||
name: interaction.translate("general/emoji:NAME"),
|
||||
value: parsedEmoji.name
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/emoji:ANIMATED"),
|
||||
value: parsedEmoji.animated ? interaction.translate("common:YES") : interaction.translate("common:NO")
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/emoji:ID"),
|
||||
value: parsedEmoji.id?.toString() || interaction.translate("general/emoji:STANDART")
|
||||
}
|
||||
]);
|
||||
|
||||
message.reply({
|
||||
interaction.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EmojiInfo;
|
||||
module.exports = Emoji;
|
|
@ -1,117 +1,167 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, PermissionsBitField, ComponentType } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Help extends Command {
|
||||
class Help extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "help",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("help")
|
||||
.setDescription(client.translate("general/help:DESCRIPTION"))
|
||||
.addStringOption(option =>
|
||||
option.setName("command")
|
||||
.setDescription(client.translate("owner/reload:COMMAND"))),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["h", "commands"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
if (args[0]) {
|
||||
const isCustom = (message.guild && data.guild.customCommands ? data.guild.customCommands.find((c) => c.name === args[0]) : false);
|
||||
|
||||
const cmd = this.client.commands.get(args[0]) || this.client.commands.get(this.client.aliases.get(args[0]));
|
||||
if (!cmd && isCustom) {
|
||||
return message.error("general/help:CUSTOM", {
|
||||
cmd: args[0]
|
||||
});
|
||||
} else if (!cmd) {
|
||||
return message.error("general/help:NOT_FOUND", {
|
||||
search: args[0]
|
||||
});
|
||||
}
|
||||
|
||||
const description = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:DESCRIPTION`);
|
||||
const usage = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:USAGE`, {
|
||||
prefix: message.guild ? data.guild.prefix : ""
|
||||
});
|
||||
const examples = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:EXAMPLES`, {
|
||||
prefix: message.guild ? data.guild.prefix : ""
|
||||
});
|
||||
|
||||
const groupEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor({
|
||||
name: message.translate("general/help:CMD_TITLE", {
|
||||
cmd: cmd.help.name
|
||||
})
|
||||
})
|
||||
.addField(message.translate("general/help:FIELD_DESCRIPTION"), description)
|
||||
.addField(message.translate("general/help:FIELD_USAGE"), usage)
|
||||
.addField(message.translate("general/help:FIELD_EXAMPLES"), examples)
|
||||
.addField(message.translate("general/help:FIELD_ALIASES"), cmd.help.aliases.length > 0 ? cmd.help.aliases.map(a => "`" + a + "`").join("\n") : message.translate("general/help:NO_ALIAS"))
|
||||
.addField(message.translate("general/help:FIELD_PERMISSIONS"), cmd.conf.memberPermissions.length > 0 ? cmd.conf.memberPermissions.map((p) => `\`${p}\``).join("\n") : message.translate("general/help:NO_REQUIRED_PERMISSION"))
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
});
|
||||
|
||||
return message.reply({
|
||||
embeds: [groupEmbed]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()];
|
||||
const categories = [];
|
||||
const commands = this.client.commands;
|
||||
const command = interaction.options.getString("command");
|
||||
|
||||
commands.forEach((command) => {
|
||||
if (!categories.includes(command.help.category)) {
|
||||
if (command.help.category === "Owner" && message.author.id !== data.config.owner.id) return;
|
||||
categories.push(command.help.category);
|
||||
if (command) {
|
||||
const embed = generateCommandHelp(client, interaction, command);
|
||||
|
||||
return interaction.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
|
||||
commands.forEach(c => {
|
||||
if (!categories.includes(c.category)) {
|
||||
if (c.category === "Owner" && interaction.member.id !== client.config.owner.id) return;
|
||||
categories.push(c.category);
|
||||
}
|
||||
});
|
||||
|
||||
const emojis = this.client.customEmojis;
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setDescription(message.translate("general/help:INFO", {
|
||||
prefix: message.guild ? data.guild.prefix : ""
|
||||
}))
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
});
|
||||
categories.sort().forEach((cat) => {
|
||||
const tCommands = commands.filter((cmd) => cmd.help.category === cat);
|
||||
embed.addField(`${emojis.categories[cat.toLowerCase()]} ${cat} - (${tCommands.size})`, `${tCommands.map((cmd) => `\`${cmd.help.name}\``).join(", ")}`);
|
||||
const categoriesRows = categories.sort().map(c => {
|
||||
return {
|
||||
label: `${c} (${commands.filter(cmd => cmd.category === c).length})`,
|
||||
value: c
|
||||
};
|
||||
});
|
||||
|
||||
if (message.guild) {
|
||||
if (data.guild.customCommands.length > 0) embed.addField(`${emojis.categories.custom} ${message.guild.name} | ${message.translate("general/help:CUSTOM_COMMANDS")} - (${data.guild.customCommands.length})`, data.guild.customCommands.map((cmd) => `\`${cmd.name}\``).join(", "));
|
||||
}
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new SelectMenuBuilder()
|
||||
.setCustomId("help_category_select")
|
||||
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
||||
.addOptions(categoriesRows)
|
||||
);
|
||||
|
||||
embed.addField("\u200B", message.translate("misc:STATS_FOOTER", {
|
||||
dashboardLink: this.client.config.dashboard.baseURL,
|
||||
docsLink: `${this.client.config.dashboard.baseURL}/docs/`,
|
||||
inviteLink: this.client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR] }),
|
||||
donateLink: "https://qiwi.com/n/JONNYBRO/",
|
||||
owner: data.config.owner.id
|
||||
}));
|
||||
embed.setAuthor({
|
||||
name: message.translate("general/help:TITLE", {
|
||||
name: this.client.user.username
|
||||
}),
|
||||
iconURL: this.client.user.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
})
|
||||
const msg = await interaction.reply({
|
||||
content: interaction.translate("common:AVAILABLE_CATEGORIES"),
|
||||
components: [row],
|
||||
fetchReply: true
|
||||
});
|
||||
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
const collector = new InteractionCollector(client, {
|
||||
componentType: ComponentType.SelectMenu,
|
||||
message: msg,
|
||||
idle: 60 * 1000
|
||||
});
|
||||
|
||||
collector.on("collect", async msg => {
|
||||
const arg = msg?.values[0];
|
||||
|
||||
if (categories.find(c => c === arg)) {
|
||||
const categoryCommands = commands.filter(cmd => cmd.category === arg).map(c => {
|
||||
return {
|
||||
label: c.command.name,
|
||||
value: c.command.name
|
||||
};
|
||||
});
|
||||
|
||||
const commandsRow = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new SelectMenuBuilder()
|
||||
.setCustomId("help_commands_select")
|
||||
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
||||
.addOptions(categoryCommands)
|
||||
);
|
||||
|
||||
await msg.update({
|
||||
content: interaction.translate("general/help:COMMANDS_IN", {
|
||||
category: arg
|
||||
}),
|
||||
components: [commandsRow],
|
||||
fetchReply: true
|
||||
});
|
||||
} else {
|
||||
const embed = generateCommandHelp(client, interaction, arg);
|
||||
await msg.update({
|
||||
content: null,
|
||||
components: [],
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getPermName(bitfield = 0) {
|
||||
for (const key in PermissionsBitField.Flags)
|
||||
if (PermissionsBitField.Flags[key] === BigInt(bitfield)) return key;
|
||||
return null;
|
||||
}
|
||||
|
||||
function generateCommandHelp(client, interaction, command) {
|
||||
const cmd = client.commands.get(command);
|
||||
if (!cmd) return interaction.error("general/help:NOT_FOUND", { search: command });
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: interaction.translate("general/help:CMD_TITLE", {
|
||||
cmd: cmd.command.name
|
||||
})
|
||||
})
|
||||
.addFields([
|
||||
{
|
||||
name: interaction.translate("general/help:FIELD_DESCRIPTION"),
|
||||
value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`)
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/help:FIELD_USAGE"),
|
||||
value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:USAGE`)
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/help:FIELD_EXAMPLES"),
|
||||
value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:EXAMPLES`)
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/help:FIELD_ALIASES"),
|
||||
value: cmd.aliases.length > 0 ? cmd.aliases.map(a => `${a}`).join("\n") : interaction.translate("general/help:NO_ALIAS")
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/help:FIELD_PERMISSIONS"),
|
||||
value: cmd.command.default_member_permissions > 0 ? interaction.translate(`misc:PERMISSIONS:${getPermName(cmd.command.default_member_permissions)}`) : interaction.translate("general/help:NO_REQUIRED_PERMISSION")
|
||||
}
|
||||
])
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({
|
||||
text: client.config.embed.footer
|
||||
});
|
||||
|
||||
return embed;
|
||||
}
|
||||
|
||||
module.exports = Help;
|
|
@ -1,55 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
class Invite extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "invite",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["i"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const inviteLink = this.client.generateInvite({
|
||||
scopes: ["bot", "applications.commands"],
|
||||
permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR]
|
||||
});
|
||||
const donateLink = "https://qiwi.com/n/JONNYBRO/";
|
||||
|
||||
if (args[0] && args[0] === "copy") return message.reply({
|
||||
content: inviteLink
|
||||
});
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setAuthor({
|
||||
name: message.translate("general/invite:LINKS")
|
||||
})
|
||||
.setDescription(message.translate("general/invite:TIP", {
|
||||
prefix: data.guild.prefix || ""
|
||||
}))
|
||||
.addField(message.translate("general/invite:ADD"), message.translate("general/invite:CLICK", {
|
||||
link: inviteLink
|
||||
}))
|
||||
.addField(message.translate("general/invite:SUPPORT"), message.translate("general/invite:CLICK", {
|
||||
link: donateLink
|
||||
}) + `\n*для других способов пишите в ЛС <@${data.config.owner.id}> (указывайте ваш Discord тэг чтобы я мог выдать вам ачивку)*`)
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
});
|
||||
|
||||
message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Invite;
|
|
@ -1,72 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
class Invites extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "invites",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["invs"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_GUILD"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
let member = await this.client.resolveMember(args[0], message.guild);
|
||||
if (!member) member = message.member;
|
||||
|
||||
const invites = await message.guild.invites.fetch().catch(() => {});
|
||||
if (!invites) return message.error("misc:ERR_OCCURRED");
|
||||
|
||||
const memberInvites = invites.filter((i) => i.inviter && i.inviter.id === member.user.id);
|
||||
|
||||
if (memberInvites.size <= 0) {
|
||||
if (member === message.member) {
|
||||
return message.error("general/invites:NOBODY_AUTHOR");
|
||||
} else {
|
||||
return message.error("general/invites:NOBODY_MEMBER", {
|
||||
member: member.user.tag
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const content = memberInvites.map((i) => {
|
||||
return message.translate("general/invites:CODE", {
|
||||
uses: i.uses,
|
||||
code: i.code,
|
||||
channel: i.channel.toString()
|
||||
});
|
||||
}).join("\n");
|
||||
let index = 0;
|
||||
memberInvites.forEach((invite) => index += invite.uses);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
})
|
||||
.setAuthor({
|
||||
name: message.translate("general/invites:TRACKER")
|
||||
})
|
||||
.setDescription(message.translate("general/invites:TITLE", {
|
||||
member: member.user.tag,
|
||||
guild: message.guild.name
|
||||
}))
|
||||
.addField(message.translate("general/invites:FIELD_INVITED"), message.translate("general/invites:FIELD_MEMBERS", {
|
||||
total: index
|
||||
}))
|
||||
.addField(message.translate("general/invites:FIELD_CODES"), content);
|
||||
|
||||
message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Invites;
|
|
@ -1,82 +1,99 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js"),
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand"),
|
||||
gamedig = require("gamedig");
|
||||
|
||||
class Minecraft extends Command {
|
||||
class Minecraft extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "minecraft",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("minecraft")
|
||||
.setDescription(client.translate("general/minecraft:DESCRIPTION"))
|
||||
.addStringOption(option => option.setName("ip")
|
||||
.setDescription(client.translate("common:IP"))
|
||||
.setRequired(true)),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["mc"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
await interaction.deferReply();
|
||||
const ip = interaction.options.getString("ip");
|
||||
|
||||
async run(message, args, data) {
|
||||
const ip = args[0];
|
||||
if (!ip) return message.error("general/minecraft:MISSING_IP");
|
||||
|
||||
const favicon = `https://eu.mc-api.net/v3/server/favicon/${ip}`;
|
||||
let options = {
|
||||
const options = {
|
||||
type: "minecraft",
|
||||
host: ip
|
||||
};
|
||||
|
||||
if (ip.split(":").length > 1) {
|
||||
const ipp = ip.split(":");
|
||||
options = {
|
||||
type: "minecraft",
|
||||
host: ipp[0],
|
||||
port: ipp[1]
|
||||
};
|
||||
const splitIp = ip.split(":");
|
||||
options.host = splitIp[0];
|
||||
options.port = splitIp[1];
|
||||
}
|
||||
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
var res = await gamedig.query(options).catch(() => {});
|
||||
|
||||
let json = null;
|
||||
|
||||
await gamedig.query(options).then((res) => {
|
||||
json = res;
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
if (!json) {
|
||||
if (!res) {
|
||||
options.type = "minecraftpe";
|
||||
await gamedig.query(options).then((res) => {
|
||||
json = res;
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
res = await gamedig.query(options).catch(() => {});
|
||||
}
|
||||
|
||||
if (!json) return m.error("general/minecraft:FAILED", null, { edit: true });
|
||||
if (!res) return interaction.error("general/minecraft:FAILED", null, { edit: true });
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: json.name
|
||||
name: res.name
|
||||
})
|
||||
.addField(message.translate("general/minecraft:FIELD_STATUS"), message.translate("general/minecraft:ONLINE"))
|
||||
.addField(message.translate("general/minecraft:FIELD_CONNECTED"), `**${(json.raw.players ? json.raw.players.online : json.players.length)}** ${message.getNoun((json.raw.players ? json.raw.players.online : json.players.length), message.translate("misc:NOUNS:PLAYERS:1"), message.translate("misc:NOUNS:PLAYERS:2"), message.translate("misc:NOUNS:PLAYERS:5"))} / **${(json.raw.players ? json.raw.players.max : json.maxplayers)}** ${message.getNoun((json.raw.players ? json.raw.players.max : json.maxplayers), message.translate("misc:NOUNS:PLAYERS:1"), message.translate("misc:NOUNS:PLAYERS:2"), message.translate("misc:NOUNS:PLAYERS:5"))}`)
|
||||
.addField(message.translate("general/minecraft:FIELD_IP"), json.connect, true)
|
||||
.addField(message.translate("general/minecraft:FIELD_VERSION"), json.raw.vanilla.raw.version.name, true)
|
||||
.addField(message.translate("general/minecraft:FIELD_PING"), json.raw.vanilla.ping.toString())
|
||||
.setColor(data.config.embed.color)
|
||||
.setThumbnail(favicon)
|
||||
.addFields([
|
||||
{
|
||||
name: interaction.translate("general/minecraft:FIELD_STATUS"),
|
||||
value: interaction.translate("general/minecraft:ONLINE")
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/minecraft:FIELD_CONNECTED"),
|
||||
value: `**${(res.raw.players ? res.raw.players.online : res.players.length)}** ${client.getNoun((res.raw.players ? res.raw.players.online : res.players.length), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))} / **${(res.raw.players ? res.raw.players.max : res.maxplayers)}** ${client.getNoun((res.raw.players ? res.raw.players.max : res.maxplayers), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))}`
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/minecraft:FIELD_IP"),
|
||||
value: res.connect,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/minecraft:FIELD_VERSION"),
|
||||
value: res.raw.vanilla.raw.version.name,
|
||||
inline: true
|
||||
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/minecraft:FIELD_PING"),
|
||||
value: res.raw.vanilla.ping.toString()
|
||||
}
|
||||
])
|
||||
.setColor(client.config.embed.color)
|
||||
.setThumbnail(`https://eu.mc-api.net/v3/server/favicon/${ip}`)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
});
|
||||
|
||||
m.edit({
|
||||
content: null,
|
||||
interaction.editReply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
const permissions = Object.keys(Discord.Permissions.FLAGS);
|
||||
|
||||
class Permissions extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "permissions",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["perms"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
const member = message.mentions.members.first() || message.member;
|
||||
const mPermissions = message.channel.permissionsFor(member);
|
||||
const total = {
|
||||
denied: 0,
|
||||
allowed: 0
|
||||
};
|
||||
|
||||
let text = `**${message.translate("general/permissions:TITLE", { user: member.user.username, channel: message.channel.name })}**\n`;
|
||||
permissions.forEach((perm) => {
|
||||
if (perm === "REQUEST_TO_SPEAK") return;
|
||||
|
||||
if (!mPermissions.has(perm)) {
|
||||
text += `${message.translate(`misc:PERMISSIONS:${perm}`)} ❌\n`;
|
||||
total.denied++;
|
||||
} else {
|
||||
text += `${message.translate(`misc:PERMISSIONS:${perm}`)} ✅\n`;
|
||||
total.allowed++;
|
||||
}
|
||||
});
|
||||
text += `\n${total.allowed} ✅ | ${total.denied} ❌`;
|
||||
|
||||
message.reply({
|
||||
content: text
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Permissions;
|
|
@ -1,28 +1,38 @@
|
|||
const Command = require("../../base/Command");
|
||||
const { SlashCommandBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Ping extends Command {
|
||||
class Ping extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "ping",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("ping")
|
||||
.setDescription(client.translate("general/ping:DESCRIPTION")),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["pi"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
message.sendT("general/ping:CONTENT", {
|
||||
ping: "..."
|
||||
}).then((m) => {
|
||||
m.sendT("general/ping:CONTENT", {
|
||||
ping: Math.round(this.client.ws.ping)
|
||||
}, { edit: true });
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
interaction.replyT("general/ping:CONTENT", {
|
||||
ping: Math.round(client.ws.ping)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
class Quote extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "quote",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["qu"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
function embed(m) {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setAuthor({
|
||||
name: m.author.tag,
|
||||
iconURL: m.author.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
})
|
||||
})
|
||||
.setDescription(m.content)
|
||||
.setColor(m.member ? m.member.roles.highest ? m.member.roles.highest.color : data.config.embed.color : data.config.embed.color)
|
||||
.setFooter({
|
||||
text: m.guild.name + " | #" + m.channel.name
|
||||
})
|
||||
.setTimestamp(m.createdTimestamp);
|
||||
if (m.attachments.size > 0) embed.setImage(m.attachments.first().url);
|
||||
return embed;
|
||||
}
|
||||
|
||||
const msgID = args[0];
|
||||
if (isNaN(msgID)) {
|
||||
message.error("general/quote:MISSING_ID").then(() => {
|
||||
if (message.deletable) message.delete();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let channel = args[1];
|
||||
if (args[1]) {
|
||||
channel = this.client.channels.cache.get(args[1]);
|
||||
if (!channel) {
|
||||
message.error("general/quote:NO_MESSAGE_ID").then(() => {
|
||||
if (message.deletable) message.delete();
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!channel) {
|
||||
message.channel.messages.fetch(msgID).catch(() => {
|
||||
message.error("general/quote:NO_MESSAGE_ID").then(() => {
|
||||
if (message.deletable) message.delete();
|
||||
});
|
||||
return;
|
||||
}).then((msg) => {
|
||||
if (message.deletable) message.delete();
|
||||
message.reply({
|
||||
embeds: [embed(msg)]
|
||||
});
|
||||
});
|
||||
} else {
|
||||
channel.messages.fetch(msgID).then((msg) => {
|
||||
if (message.deletable) message.delete();
|
||||
message.reply({
|
||||
embeds: [embed(msg)]
|
||||
});
|
||||
}).catch(() => {
|
||||
message.error("general/quote:NO_MESSAGE_ID").then(() => {
|
||||
if (message.deletable) message.delete();
|
||||
});
|
||||
return;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Quote;
|
|
@ -1,44 +1,60 @@
|
|||
const Command = require("../../base/Command"),
|
||||
const { SlashCommandBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand"),
|
||||
ms = require("ms");
|
||||
|
||||
class Remindme extends Command {
|
||||
class Remindme extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "remindme",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("remindme")
|
||||
.setDescription(client.translate("general/remindme:DESCRIPTION"))
|
||||
.addStringOption(option => option.setName("time")
|
||||
.setDescription(client.translate("owner/remindme:TIME"))
|
||||
.setRequired(true))
|
||||
.addStringOption(option => option.setName("message")
|
||||
.setDescription(client.translate("common:MESSAGE"))
|
||||
.setRequired(true)),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["reminder", "remind", "rem"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const time = args[0];
|
||||
if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME");
|
||||
|
||||
const msg = args.slice(1).join(" ");
|
||||
if (!msg) return message.error("general/remindme:MISSING_MESSAGE");
|
||||
|
||||
const rData = {
|
||||
message: msg,
|
||||
createdAt: Date.now(),
|
||||
sendAt: Date.now() + ms(time)
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction, data) {
|
||||
const time = interaction.options.getString("time");
|
||||
const message = interaction.options.getString("message");
|
||||
const dateNow = Date.now();
|
||||
if (!data.userData.reminds) data.userData.reminds = [];
|
||||
|
||||
const rData = {
|
||||
message: message,
|
||||
createdAt: dateNow,
|
||||
sendAt: dateNow + ms(time)
|
||||
};
|
||||
|
||||
data.userData.reminds.push(rData);
|
||||
data.userData.markModified("reminds");
|
||||
data.userData.save();
|
||||
this.client.databaseCache.usersReminds.set(message.author.id, data.userData);
|
||||
client.databaseCache.usersReminds.set(message.author.id, data.userData);
|
||||
|
||||
message.success("general/remindme:SAVED");
|
||||
interaction.success("general/remindme:SAVED");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,57 +1,87 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Report extends Command {
|
||||
class Report extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "report",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("report")
|
||||
.setDescription(client.translate("general/report:DESCRIPTION"))
|
||||
.addUserOption(option => option.setName("user")
|
||||
.setDescription(client.translate("common:USER"))
|
||||
.setRequired(true))
|
||||
.addStringOption(option => option.setName("message")
|
||||
.setDescription(client.translate("common:MESSAGE"))
|
||||
.setRequired(true)),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["repo"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
if (interaction.user.id === "285109105717280768") return interaction.reply({ content: "Пошёл нахуй фахон" });
|
||||
const repChannel = interaction.guild.channels.cache.get(interaction.guild.data.plugins.reports);
|
||||
if (!repChannel) return interaction.error("general/report:MISSING_CHANNEL");
|
||||
const member = interaction.options.getMember("user");
|
||||
if (member.id === interaction.user.id) return interaction.error("general/report:INVALID_USER");
|
||||
const rep = interaction.options.getString("message");
|
||||
|
||||
async run(message, args, data) {
|
||||
if (message.author.id === "285109105717280768") return message.reply({ content: "Пошёл нахуй фахон" });
|
||||
|
||||
const repChannel = message.guild.channels.cache.get(data.guild.plugins.reports);
|
||||
if (!repChannel) return message.error("general/report:MISSING_CHANNEL");
|
||||
|
||||
const member = await this.client.resolveMember(args[0], message.guild);
|
||||
if (!member) return message.error("general/report:MISSING_USER");
|
||||
if (member.id === message.author.id) return message.error("general/report:INVALID_USER");
|
||||
|
||||
const rep = args.slice(1).join(" ");
|
||||
if (!rep) return message.error("general/report:MISSING_REASON");
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("general/report:TITLE", {
|
||||
name: interaction.translate("general/report:TITLE", {
|
||||
user: member.user.tag
|
||||
}),
|
||||
iconURL: message.author.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
iconURL: interaction.user.displayAvatarURL({
|
||||
extension: "png",
|
||||
size: 512
|
||||
})
|
||||
})
|
||||
.addField(message.translate("common:AUTHOR"), message.author.tag, true)
|
||||
.addField(message.translate("common:DATE"), message.printDate(new Date(Date.now())), true)
|
||||
.addField(message.translate("common:REASON"), rep, true)
|
||||
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true)
|
||||
.setColor(data.config.embed.color)
|
||||
.addFields([
|
||||
{
|
||||
name: interaction.translate("common:DATE"),
|
||||
value: client.printDate(new Date(Date.now()))
|
||||
},
|
||||
{
|
||||
name: interaction.translate("common:AUTHOR"),
|
||||
value: interaction.user.toString(),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: interaction.translate("common:USER"),
|
||||
value: member.user.toString(),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: interaction.translate("common:REASON"),
|
||||
value: rep,
|
||||
inline: true
|
||||
}
|
||||
])
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
});
|
||||
|
||||
const success = Discord.Util.parseEmoji(this.client.customEmojis.success).id;
|
||||
const error = Discord.Util.parseEmoji(this.client.customEmojis.error).id;
|
||||
const success = parseEmoji(client.customEmojis.cool).id;
|
||||
const error = parseEmoji(client.customEmojis.notcool).id;
|
||||
|
||||
repChannel.send({
|
||||
embeds: [embed]
|
||||
|
@ -60,7 +90,7 @@ class Report extends Command {
|
|||
await m.react(error);
|
||||
});
|
||||
|
||||
message.success("general/report:SUCCESS", {
|
||||
interaction.success("general/report:SUCCESS", {
|
||||
channel: repChannel.toString()
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,68 +1,103 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Serverinfo extends Command {
|
||||
class Serverinfo extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "serverinfo",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("serverinfo")
|
||||
.setDescription(client.translate("general/serverinfo:DESCRIPTION")),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["si"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
let guild = message.guild;
|
||||
|
||||
if (args[0]) {
|
||||
let found = this.client.guilds.cache.get(args[0]);
|
||||
if (!found) {
|
||||
found = this.client.guilds.cache.find(g => g.name.includes(args.join(" ")) || g.id === args[0]);
|
||||
if (found) guild = found;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const guild = interaction.guild;
|
||||
|
||||
await guild.members.fetch();
|
||||
const owner = await guild.fetchOwner();
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: guild.name,
|
||||
iconURL: guild.iconURL({
|
||||
dynamic: true
|
||||
})
|
||||
iconURL: guild.iconURL()
|
||||
})
|
||||
.setThumbnail(guild.iconURL({
|
||||
dynamic: true
|
||||
}))
|
||||
.addField(this.client.customEmojis.link + " " + message.translate("general/serverinfo:LINK"), `[${message.translate("general/serverinfo:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/stats/${guild.id})`)
|
||||
.addField(this.client.customEmojis.title + message.translate("common:NAME"), guild.name, true)
|
||||
.addField(this.client.customEmojis.calendar + message.translate("common:CREATION"), message.printDate(guild.createdAt), true)
|
||||
.addField(this.client.customEmojis.users + message.translate("common:MEMBERS"),
|
||||
`${guild.members.cache.filter(m => !m.user.bot).size} ${message.getNoun(guild.members.cache.filter(m => !m.user.bot).size, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}` +
|
||||
"\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${message.getNoun(guild.members.cache.filter(m => m.user.bot).size, message.translate("misc:NOUNS:BOTS:1"), message.translate("misc:NOUNS:BOTS:2"), message.translate("misc:NOUNS:BOTS:5"))}`, true
|
||||
)
|
||||
.addField(this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), guild.afkChannel ? guild.afkChannel.toString() : message.translate("general/serverinfo:NO_AFK_CHANNEL"), true)
|
||||
.addField(this.client.customEmojis.id + message.translate("common:ID"), guild.id, true)
|
||||
.addField(this.client.customEmojis.crown + message.translate("common:OWNER"), owner.toString(), true)
|
||||
.addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount.toString() || "0", true)
|
||||
.addField(this.client.customEmojis.channels + message.translate("common:CHANNELS"),
|
||||
`${guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size, message.translate("misc:NOUNS:TEXT:1"), message.translate("misc:NOUNS:TEXT:2"), message.translate("misc:NOUNS:TEXT:5"))}` +
|
||||
"\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size, message.translate("misc:NOUNS:VOICE:1"), message.translate("misc:NOUNS:VOICE:2"), message.translate("misc:NOUNS:VOICE:5"))}` +
|
||||
"\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size, message.translate("misc:NOUNS:CATEGORY:1"), message.translate("misc:NOUNS:CATEGORY:2"), message.translate("misc:NOUNS:CATEGORY:5"))}`, true
|
||||
)
|
||||
.setColor(data.config.embed.color)
|
||||
.setThumbnail(guild.iconURL())
|
||||
.addFields([
|
||||
{
|
||||
name: client.customEmojis.link + " " + interaction.translate("general/serverinfo:LINK"),
|
||||
value: `[${interaction.translate("general/serverinfo:LINK_TEXT")}](${client.config.dashboard.baseURL}/stats/${guild.id})`
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.title + interaction.translate("common:NAME"),
|
||||
value: guild.name,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.calendar + interaction.translate("common:CREATION"),
|
||||
value: client.printDate(guild.createdAt),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.users + interaction.translate("common:MEMBERS"),
|
||||
value: `${guild.members.cache.filter(m => !m.user.bot).size} ${client.getNoun(guild.members.cache.filter(m => !m.user.bot).size, interaction.translate("misc:NOUNS:MEMBERS:1"), interaction.translate("misc:NOUNS:MEMBERS:2"), interaction.translate("misc:NOUNS:MEMBERS:5"))}` +
|
||||
"\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${client.getNoun(guild.members.cache.filter(m => m.user.bot).size, interaction.translate("misc:NOUNS:BOTS:1"), interaction.translate("misc:NOUNS:BOTS:2"), interaction.translate("misc:NOUNS:BOTS:5"))}`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.afk + interaction.translate("general/serverinfo:AFK_CHANNEL"),
|
||||
value: guild.afkChannel?.toString() || interaction.translate("common:MISSING"),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.id + interaction.translate("common:ID"),
|
||||
value: guild.id,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.crown + interaction.translate("common:OWNER"),
|
||||
value: owner.toString(),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.boost + interaction.translate("general/serverinfo:BOOSTS"),
|
||||
value: guild.premiumSubscriptionCount?.toString() || "0",
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.channels + interaction.translate("common:CHANNELS"),
|
||||
value: `${guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size} ${client.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size, interaction.translate("misc:NOUNS:TEXT:1"), interaction.translate("misc:NOUNS:TEXT:2"), interaction.translate("misc:NOUNS:TEXT:5"))}` +
|
||||
"\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size} ${client.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size, interaction.translate("misc:NOUNS:VOICE:1"), interaction.translate("misc:NOUNS:VOICE:2"), interaction.translate("misc:NOUNS:VOICE:5"))}` +
|
||||
"\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size} ${client.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size, interaction.translate("misc:NOUNS:CATEGORY:1"), interaction.translate("misc:NOUNS:CATEGORY:2"), interaction.translate("misc:NOUNS:CATEGORY:5"))}`,
|
||||
inline: true
|
||||
}
|
||||
])
|
||||
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
});
|
||||
|
||||
message.reply({
|
||||
interaction.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Setafk extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "setafk",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["afk"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
const reason = args.join(" ");
|
||||
if (!reason || reason.length > 250) return message.error("general/setafk:MISSING_REASON");
|
||||
|
||||
if (reason === "delete") {
|
||||
if (data.userData.afk) {
|
||||
data.userData.afk = null;
|
||||
data.userData.save();
|
||||
|
||||
return message.sendT("general/setafk:DELETED", {
|
||||
username: message.author.username
|
||||
});
|
||||
}
|
||||
} else {
|
||||
data.userData.afk = reason;
|
||||
data.userData.save();
|
||||
|
||||
const m = await message.success("general/setafk:SUCCESS", {
|
||||
reason,
|
||||
prefix: message.guild ? data.guild.prefix : ""
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (m.deletable) m.delete();
|
||||
if (message.deletable) message.delete();
|
||||
}, 10 * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Setafk;
|
|
@ -1,42 +1,48 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js"),
|
||||
const { SlashCommandBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand"),
|
||||
fetch = require("node-fetch");
|
||||
|
||||
class ShortURL extends Command {
|
||||
class Shorturl extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "shorturl",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("shorturl")
|
||||
.setDescription(client.translate("general/shorturl:DESCRIPTION"))
|
||||
.addStringOption(option => option.setName("url")
|
||||
.setDescription(client.translate("general/shorturl:URL"))
|
||||
.setRequired(true)),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["minimize"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const url = interaction.options.getString("url");
|
||||
const res = await fetch(`https://is.gd/create.php?format=simple&url=${encodeURI(url)}`).then(res => res.text());
|
||||
|
||||
async run(message, args, data) {
|
||||
const url = args[0];
|
||||
if (!url) return message.error("general/shorturl:MISSING_URL");
|
||||
|
||||
const res = await fetch(`https://is.gd/create.php?format=simple&url=${encodeURI(url)}`);
|
||||
const body = await res.text();
|
||||
|
||||
if (body === "Error: Please enter a valid URL to shorten") return message.error("general/shorturl:MISSING_URL");
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
})
|
||||
.setDescription(body);
|
||||
message.reply({
|
||||
embeds: [embed]
|
||||
interaction.reply({
|
||||
content: `<${res}>`,
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ShortURL;
|
||||
module.exports = Shorturl;
|
|
@ -1,39 +1,61 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Staff extends Command {
|
||||
class Staff extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "staff",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("staff")
|
||||
.setDescription(client.translate("general/staff:DESCRIPTION")),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["staf"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
await message.guild.members.fetch();
|
||||
const administrators = message.guild.members.cache.filter((m) => m.permissions.has(Discord.Permissions.FLAGS.ADMINISTRATOR) && !m.user.bot);
|
||||
const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.permissions.has(Discord.Permissions.FLAGS.MANAGE_MESSAGES) && !m.user.bot);
|
||||
const embed = new Discord.MessageEmbed()
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
await interaction.guild.members.fetch();
|
||||
const administrators = interaction.guild.members.cache.filter((m) => m.permissions.has(PermissionsBitField.Flags.Administrator) && !m.user.bot);
|
||||
const moderators = interaction.guild.members.cache.filter((m) => !administrators.has(m.id) && m.permissions.has(PermissionsBitField.Flags.ManageMessages) && !m.user.bot);
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("general/staff:TITLE", {
|
||||
guild: message.guild.name
|
||||
name: interaction.translate("general/staff:TITLE", {
|
||||
guild: interaction.guild.name
|
||||
})
|
||||
})
|
||||
.addField(message.translate("general/staff:ADMINS"), (administrators.size > 0 ? administrators.map((a) => `${a.presence ? this.client.customEmojis.status[a.presence.status] : this.client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : message.translate("general/staff:NO_ADMINS")))
|
||||
.addField(message.translate("general/staff:MODS"), (moderators.size > 0 ? moderators.map((m) => `${m.presence ? this.client.customEmojis.status[m.presence.status] : this.client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : message.translate("general/staff:NO_MODS")))
|
||||
.setColor(data.config.embed.color)
|
||||
.addFields([
|
||||
{
|
||||
name: interaction.translate("general/staff:ADMINS"),
|
||||
value: (administrators.size > 0 ? administrators.map((a) => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : interaction.translate("general/staff:NO_ADMINS"))
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/staff:MODS"),
|
||||
value: (moderators.size > 0 ? moderators.map((m) => `${m.presence ? client.customEmojis.status[m.presence.status] : client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : interaction.translate("general/staff:NO_MODS"))
|
||||
}
|
||||
])
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
});
|
||||
message.reply({
|
||||
|
||||
interaction.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,60 +1,101 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
|
||||
class Stats extends Command {
|
||||
const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField, version } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Stats extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "stats",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("stats")
|
||||
.setDescription(client.translate("general/stats:DESCRIPTION")),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["stat"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const hiddenGuild = await client.guilds.fetch("568120814776614924");
|
||||
const users = client.users.cache.size - hiddenGuild.memberCount;
|
||||
const servers = client.guilds.cache.size - 1;
|
||||
|
||||
async run(message, args, data) {
|
||||
const hiddenGuild = await this.client.guilds.fetch("568120814776614924");
|
||||
const users = this.client.users.cache.size - hiddenGuild.memberCount;
|
||||
const servers = this.client.guilds.cache.size - 1;
|
||||
|
||||
const statsEmbed = new Discord.MessageEmbed()
|
||||
.setColor(data.config.embed.color)
|
||||
const statsEmbed = new EmbedBuilder()
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
})
|
||||
.setAuthor({
|
||||
name: message.translate("common:STATS")
|
||||
name: interaction.translate("common:STATS")
|
||||
})
|
||||
.setDescription(message.translate("general/stats:MADE"))
|
||||
.addField(this.client.customEmojis.stats + " " + message.translate("general/stats:COUNTS_TITLE"), message.translate("general/stats:COUNTS_CONTENT", {
|
||||
servers: servers,
|
||||
users: users
|
||||
}), true)
|
||||
.addField(this.client.customEmojis.version + " " + message.translate("general/stats:VERSIONS_TITLE"), `\`Discord.js : v${Discord.version}\`\n\`Nodejs : v${process.versions.node}\``, true)
|
||||
.addField(this.client.customEmojis.ram + " " + message.translate("general/stats:RAM_TITLE"), `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB\``, true)
|
||||
.addField(this.client.customEmojis.status.online + " " + message.translate("general/stats:ONLINE_TITLE"), message.translate("general/stats:ONLINE_CONTENT", {
|
||||
time: message.convertTime(Date.now() + this.client.uptime, "from", true)
|
||||
}))
|
||||
.addField(this.client.customEmojis.voice + " " + message.translate("general/stats:MUSIC_TITLE"), message.translate("general/stats:MUSIC_CONTENT", {
|
||||
count: `${this.client.player.voices.collection.size} ${message.getNoun(this.client.player.voices.collection.size, message.translate("misc:NOUNS:SERVERS:1"), message.translate("misc:NOUNS:SERVERS:2"), message.translate("misc:NOUNS:SERVERS:5"))}`
|
||||
}))
|
||||
.addField(message.translate("general/stats:CREDITS_TITLE"), message.translate("general/stats:CREDITS_CONTENT", {
|
||||
donators: ["**`Добрый Спецназ#8801`** - Тестер, генератор идей"].join("\n"),
|
||||
translators: ["**`Jonny_Bro#4226`** - :flag_ru:", "**`[ДАННЫЕ УДАЛЕНЫ]#4507`** - :flag_ua:"].join("\n")
|
||||
}))
|
||||
.addField(this.client.customEmojis.link + " " + message.translate("general/stats:LINKS_TITLE"), message.translate("misc:STATS_FOOTER", {
|
||||
dashboardLink: this.client.config.dashboard.baseURL,
|
||||
docsLink: `${this.client.config.dashboard.baseURL}/docs/`,
|
||||
inviteLink: this.client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR] }),
|
||||
donateLink: "https://qiwi.com/n/JONNYBRO/",
|
||||
owner: data.config.owner.id
|
||||
}));
|
||||
message.reply({
|
||||
.setDescription(interaction.translate("general/stats:MADE"))
|
||||
.addFields([
|
||||
{
|
||||
name: client.customEmojis.stats + " " + interaction.translate("general/stats:COUNTS_TITLE"),
|
||||
value: interaction.translate("general/stats:COUNTS_CONTENT", {
|
||||
servers: servers,
|
||||
users: users
|
||||
}),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.version + " " + interaction.translate("general/stats:VERSIONS_TITLE"),
|
||||
value: `\`Discord.js: v${version}\`\n\`Nodejs: v${process.versions.node}\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.ram + " " + interaction.translate("general/stats:RAM_TITLE"),
|
||||
value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB\``,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"),
|
||||
value: interaction.translate("general/stats:ONLINE_CONTENT", {
|
||||
time: client.convertTime(Date.now() + client.uptime, true, true)
|
||||
})
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.voice + " " + interaction.translate("general/stats:MUSIC_TITLE"),
|
||||
value: interaction.translate("general/stats:MUSIC_CONTENT", {
|
||||
count: `${client.player.queues.size} ${client.getNoun(client.player.queues.size, interaction.translate("misc:NOUNS:SERVERS:1"), interaction.translate("misc:NOUNS:SERVERS:2"), interaction.translate("misc:NOUNS:SERVERS:5"))}`
|
||||
})
|
||||
},
|
||||
{
|
||||
name: interaction.translate("general/stats:CREDITS_TITLE"),
|
||||
value: interaction.translate("general/stats:CREDITS_CONTENT", {
|
||||
donators: ["**`Добрый Спецназ#8801`** - Тестер, генератор идей"].join("\n"),
|
||||
translators: ["**`[ДАННЫЕ УДАЛЕНЫ]#4507`** - :flag_ua: (НЕ ОБНОВЛЕН!)"].join("\n")
|
||||
})
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.link + " " + interaction.translate("general/stats:LINKS_TITLE"),
|
||||
value: interaction.translate("misc:STATS_FOOTER", {
|
||||
dashboardLink: client.config.dashboard.baseURL,
|
||||
docsLink: `${client.config.dashboard.baseURL}/docs/`,
|
||||
inviteLink: client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] }),
|
||||
donateLink: "https://qiwi.com/n/JONNYBRO/",
|
||||
owner: client.config.owner.id
|
||||
})
|
||||
}
|
||||
]);
|
||||
|
||||
interaction.reply({
|
||||
embeds: [statsEmbed]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,52 +1,76 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js");
|
||||
const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Suggest extends Command {
|
||||
class Suggest extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "suggest",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("suggest")
|
||||
.setDescription(client.translate("general/suggest:DESCRIPTION"))
|
||||
.addStringOption(option => option.setName("message")
|
||||
.setDescription(client.translate("common:MESSAGE"))
|
||||
.setRequired(true)),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: ["sugg"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 2000
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
if (interaction.user.id === "285109105717280768") return interaction.reply({ content: "Пошёл нахуй фахон" });
|
||||
const suggChannel = interaction.guild.channels.cache.get(interaction.guild.data.plugins.suggestions);
|
||||
if (!suggChannel) return interaction.error("general/suggest:MISSING_CHANNEL");
|
||||
const suggestion = interaction.options.getString("message");
|
||||
|
||||
async run(message, args, data) {
|
||||
if (message.author.id === "285109105717280768") return message.reply({ content: "Пошёл нахуй фахон" });
|
||||
|
||||
const suggChannel = message.guild.channels.cache.get(data.guild.plugins.suggestions);
|
||||
if (!suggChannel) return message.error("general/suggest:MISSING_CHANNEL");
|
||||
|
||||
const sugg = args.join(" ");
|
||||
if (!sugg) return message.error("general/suggest:MISSING_CONTENT");
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: message.translate("general/suggest:TITLE", {
|
||||
user: message.author.username
|
||||
name: interaction.translate("general/suggest:TITLE", {
|
||||
user: interaction.user.tag
|
||||
}),
|
||||
iconURL: message.author.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
iconURL: interaction.member.displayAvatarURL({
|
||||
size: 512
|
||||
})
|
||||
})
|
||||
.addField(message.translate("common:AUTHOR"), `\`${message.author.username}#${message.author.discriminator}\``, true)
|
||||
.addField(message.translate("common:DATE"), message.printDate(new Date(Date.now())), true)
|
||||
.addField(message.translate("common:CONTENT"), sugg)
|
||||
.setColor(data.config.embed.color)
|
||||
.addFields([
|
||||
{
|
||||
name: interaction.translate("common:DATE"),
|
||||
value: client.printDate(new Date(Date.now()))
|
||||
},
|
||||
{
|
||||
name: interaction.translate("common:AUTHOR"),
|
||||
value: interaction.user.toString(),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: interaction.translate("common:CONTENT"),
|
||||
value: suggestion,
|
||||
inline: true
|
||||
}
|
||||
])
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
});
|
||||
|
||||
const success = Discord.Util.parseEmoji(this.client.customEmojis.cool).id;
|
||||
const error = Discord.Util.parseEmoji(this.client.customEmojis.notcool).id;
|
||||
const success = parseEmoji(client.customEmojis.cool).id;
|
||||
const error = parseEmoji(client.customEmojis.notcool).id;
|
||||
|
||||
suggChannel.send({
|
||||
embeds: [embed]
|
||||
|
@ -55,7 +79,7 @@ class Suggest extends Command {
|
|||
await m.react(error);
|
||||
});
|
||||
|
||||
message.success("general/suggest:SUCCESS", {
|
||||
interaction.success("general/suggest:SUCCESS", {
|
||||
channel: suggChannel.toString()
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js"),
|
||||
translate = require("@k3rn31p4nic/google-translate-api");
|
||||
|
||||
const langs = ["afrikaans", "albanian", "amharic", "arabic", "armenian", "azerbaijani", "bangla", "basque", "belarusian", "bengali", "bosnian", "bulgarian", "burmese", "catalan", "cebuano", "chichewa", "corsican", "croatian", "czech", "danish", "dutch", "english", "esperanto", "estonian", "filipino", "finnish", "french", "frisian", "galician", "georgian", "german", "greek", "gujarati", "haitian creole", "hausa", "hawaiian", "hebrew", "hindi", "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian", "japanese", "javanese", "kannada", "kazakh", "khmer", "korean", "kurdish (kurmanji)", "kyrgyz", "lao", "latin", "latvian", "lithuanian", "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese", "maori", "marathi", "mongolian", "myanmar (burmese)", "nepali", "norwegian", "nyanja", "pashto", "persian", "polish", "portugese", "punjabi", "romanian", "russian", "samoan", "scottish gaelic", "serbian", "sesotho", "shona", "sindhi", "sinhala", "slovak", "slovenian", "somali", "spanish", "sundanese", "swahili", "swedish", "tajik", "tamil", "telugu", "thai", "turkish", "ukrainian", "urdu", "uzbek", "vietnamese", "welsh", "xhosa", "yiddish", "yoruba", "zulu"];
|
||||
|
||||
class Translate extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "translate",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["tran"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
if (args[0] === "langs-list") {
|
||||
const langsList = "```css\n" + (langs.map((lang, i) => `${i + 1} - ${lang}`).join("\n")) + "```";
|
||||
message.author.send(langsList).then(() => {
|
||||
message.success("general/translate:LIST_SENT");
|
||||
}).catch(() => {
|
||||
message.error("misc:CANNOT_DM");
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const pWait = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
|
||||
if (!args[0]) return pWait.error("general/translate:MISSING_LANGUAGE", { prefix: data.guild.prefix }, { edit: true });
|
||||
if (!args[1]) return pWait.error("general/translate:MISSING_CONTENT", null, { edit: true });
|
||||
|
||||
// Gets different args
|
||||
const language = args[0].toLowerCase();
|
||||
const toTranslate = args.slice(1).join(" ");
|
||||
|
||||
if (!langs.includes(language)) return pWait.error("general/translate:INVALID_LANGUAGE", { prefix: data.guild.prefix, search: language }, { edit: true });
|
||||
|
||||
const translated = await translate(toTranslate, { to: language });
|
||||
|
||||
const resEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor({
|
||||
name: "Переводчик",
|
||||
iconURL: this.client.user.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
})
|
||||
})
|
||||
.addField(translated.from.language.iso, "```" + toTranslate + "```")
|
||||
.addField(language, "```" + translated.text + "```")
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
});
|
||||
|
||||
return pWait.edit({
|
||||
content: null,
|
||||
embeds: [resEmbed]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Translate;
|
|
@ -1,92 +1,117 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js"),
|
||||
fetch = require("node-fetch");
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
class Userinfo extends Command {
|
||||
class Userinfo extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "userinfo",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("userinfo")
|
||||
.setDescription(client.translate("general/userinfo:DESCRIPTION"))
|
||||
.addUserOption(option => option.setName("user")
|
||||
.setDescription(client.translate("common:USER"))),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["ui"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
let displayPresence = true;
|
||||
|
||||
const isID = !isNaN(args[0]);
|
||||
|
||||
let user;
|
||||
if (!args[0]) user = message.author;
|
||||
if (message.mentions.users.first()) user = message.mentions.users.first();
|
||||
|
||||
if (isID && !user) {
|
||||
user = this.client.users.cache.get(args[0]);
|
||||
if (!user) {
|
||||
user = await this.client.users.fetch(args[0], true).catch(() => {});
|
||||
displayPresence = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!user) return message.error("general/userinfo:INVALID_USER");
|
||||
|
||||
let member = null;
|
||||
if (message.guild) member = await message.guild.members.fetch(user).catch(() => {});
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
const member = interaction.options.getMember("user") || interaction.member;
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: `${user.tag} (${user.id})`,
|
||||
iconURL: user.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
name: `${member.user.tag} (${member.id})`,
|
||||
iconURL: member.displayAvatarURL({
|
||||
size: 512
|
||||
})
|
||||
})
|
||||
.setThumbnail(user.displayAvatarURL({
|
||||
dynamic: true
|
||||
.setThumbnail(member.displayAvatarURL({
|
||||
size: 512
|
||||
}))
|
||||
.addField(":man: " + message.translate("common:USERNAME"), user.username, true)
|
||||
.addField(this.client.customEmojis.discriminator + " " + message.translate("common:DISCRIMINATOR"), user.discriminator, true)
|
||||
.addField(this.client.customEmojis.bot + " " + message.translate("common:ROBOT"), (user.bot ? message.translate("common:YES") : message.translate("common:NO")), true)
|
||||
.addField(this.client.customEmojis.calendar + " " + message.translate("common:CREATION"), message.printDate(user.createdAt), true)
|
||||
.addField(this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"), user.displayAvatarURL({
|
||||
size: 512,
|
||||
dynamic: true,
|
||||
format: "png"
|
||||
}))
|
||||
.setColor(data.config.embed.color)
|
||||
.addFields([
|
||||
{
|
||||
name: ":man: " + interaction.translate("common:USERNAME"),
|
||||
value: member.user.tag,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.pencil + " " + interaction.translate("common:NICKNAME"),
|
||||
value: member.nickname || interaction.translate("general/userinfo:NO_NICKNAME"),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.status[member.presence.status] + " " + interaction.translate("common:STATUS"),
|
||||
value: interaction.translate(`common:STATUS_${member.presence.status.toUpperCase()}`),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.bot + " " + interaction.translate("common:ROBOT"),
|
||||
value: member.user.bot ? interaction.translate("common:YES") : interaction.translate("common:NO"),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.calendar + " " + interaction.translate("common:CREATION"),
|
||||
value: client.printDate(member.user.createdAt),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOIN"),
|
||||
value: client.printDate(member.joinedAt),
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.color + " " + interaction.translate("common:COLOR"),
|
||||
value: member.displayHexColor,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"),
|
||||
value: (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 10).join(", ") + " " + interaction.translate("general/userinfo:MORE_ROLES", {
|
||||
count: member.roles.cache.size - 10
|
||||
}) : (member.roles.cache.size < 1) ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", ")),
|
||||
inline: true
|
||||
}
|
||||
])
|
||||
.setColor(client.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
});
|
||||
|
||||
if (displayPresence) {
|
||||
if (member.presence.activities[0].name === "Custom Status") {
|
||||
embed.addField(this.client.customEmojis.games + " " + message.translate("common:GAME"), (member.presence.activities[0] ? `Пользовательский статус\n${member.presence.activities[0].state || message.translate("common:NOT_DEFINED")}` : message.translate("general/userinfo:NO_GAME")), true);
|
||||
embed.addField(this.client.customEmojis.status[member.presence.status] + " " + message.translate("common:STATUS"), message.translate("common:STATUS_" + (member.presence.status.toUpperCase())), true);
|
||||
} else {
|
||||
embed.addField(this.client.customEmojis.games + " " + message.translate("common:GAME"), (member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : message.translate("general/userinfo:NO_GAME")), true);
|
||||
embed.addField(this.client.customEmojis.status[member.presence.status] + " " + message.translate("common:STATUS"), message.translate("common:STATUS_" + (member.presence.status.toUpperCase())), true);
|
||||
}
|
||||
if (member.presence.activities[0].name === "Custom Status") {
|
||||
embed.addFields([
|
||||
{
|
||||
name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"),
|
||||
value: member.presence.activities[0] ? `${interaction.translate("general/userinfo:CUSTOM")}\n${member.presence.activities[0].state || interaction.translate("common:NOT_DEFINED")}` : interaction.translate("general/userinfo:NO_ACTIVITY"),
|
||||
inline: true
|
||||
}
|
||||
]);
|
||||
} else {
|
||||
embed.addFields([
|
||||
{
|
||||
name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"),
|
||||
value: member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : interaction.translate("general/userinfo:NO_GAME"),
|
||||
inline: true
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
if (member) {
|
||||
// embed.addField(this.client.customEmojis.up + " " + message.translate("general/userinfo:ROLE"), (member.roles.highest ? member.roles.highest : message.translate("general/userinfo:NO_ROLE")), true)
|
||||
embed.addField(this.client.customEmojis.calendar2 + " " + message.translate("common:JOIN"), message.printDate(member.joinedAt), true);
|
||||
embed.addField(this.client.customEmojis.color + " " + message.translate("common:COLOR"), member.displayHexColor, true);
|
||||
embed.addField(this.client.customEmojis.pencil + " " + message.translate("common:NICKNAME"), (member.nickname ? member.nickname : message.translate("general/userinfo:NO_NICKNAME")), true);
|
||||
embed.addField(this.client.customEmojis.roles + " " + message.translate("common:ROLES"), (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 9).join(", ") + " " + message.translate("general/userinfo:MORE_ROLES", {
|
||||
count: member.roles.cache.size - 10
|
||||
}) : (member.roles.cache.size < 1) ? message.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", ")));
|
||||
}
|
||||
|
||||
message.reply({
|
||||
interaction.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,70 +1,70 @@
|
|||
const Command = require("../../base/Command"),
|
||||
Discord = require("discord.js"),
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||
const BaseCommand = require("../../base/BaseCommand"),
|
||||
fetch = require("node-fetch");
|
||||
|
||||
class Whois extends Command {
|
||||
class Whois extends BaseCommand {
|
||||
/**
|
||||
*
|
||||
* @param {import("../base/JaBa")} client
|
||||
*/
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "whois",
|
||||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.setName("whois")
|
||||
.setDescription(client.translate("general/whois:DESCRIPTION"))
|
||||
.addStringOption(option => option.setName("ip")
|
||||
.setDescription(client.translate("common:IP"))
|
||||
.setRequired(true)),
|
||||
aliases: [],
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["ip"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
guildOnly: true,
|
||||
ownerOnly: false
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args, data) {
|
||||
if (!args[0]) return message.error("general/whois:NO_IP");
|
||||
|
||||
const whois = await fetch(`http://ip-api.com/json/${args[0]}?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,zip,timezone,currency,isp,org,as,mobile,proxy,hosting,query`).then(response => response.json());
|
||||
|
||||
if (whois.status === "fail") {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setDescription(whois.message)
|
||||
.setTitle(message.translate("general/whois:ERROR", {
|
||||
ip: args[0]
|
||||
}))
|
||||
.setColor(data.config.embed.color)
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
})
|
||||
.setTimestamp();
|
||||
return message.reply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.translate("general/whois:INFO_ABOUT", {
|
||||
ip: args[0]
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
*/
|
||||
async onLoad() {
|
||||
//...
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../../base/JaBa")} client
|
||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||
* @param {Array} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
await interaction.deferReply();
|
||||
const ip = interaction.options.getString("ip");
|
||||
const whois = await fetch(`http://ip-api.com/json/${ip}?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,zip,timezone,currency,isp,org,as,mobile,proxy,hosting,query`).then(response => response.json());
|
||||
if (whois.status === "fail") return interaction.reply({ content: interaction.translate("general/whois:ERROR", { ip }) });
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(interaction.translate("general/whois:INFO_ABOUT", {
|
||||
ip
|
||||
}))
|
||||
.setFooter({
|
||||
text: data.config.embed.footer
|
||||
text: client.config.embed.footer
|
||||
})
|
||||
.setColor(data.config.embed.color)
|
||||
.setColor(client.config.embed.color)
|
||||
.addFields(
|
||||
{ name: "IP", value: whois.query, inline: true },
|
||||
{ name: message.translate("general/whois:COUNTRY"), value: `${whois.country || "Неизвестно"} (${whois.countryCode || "Неизвестно"})`, inline: true },
|
||||
{ name: message.translate("general/whois:REGION"), value: `${whois.regionName || "Неизвестно"} (${whois.region || "Неизвестно"})`, inline: true },
|
||||
{ name: message.translate("general/whois:CITY"), value: `${whois.city || "Неизвестно"}`, inline: true },
|
||||
{ name: message.translate("general/whois:ZIP"), value: `${whois.zip || "Неизвестно"}`, inline: true },
|
||||
{ name: message.translate("general/whois:TIMEZONE"), value: `${whois.timezone || "Неизвестно"}`, inline: true },
|
||||
{ name: message.translate("general/whois:CONTINENT"), value: `${whois.continent || "Неизвестно"} (${whois.continentCode || "Неизвестно"})`, inline: true },
|
||||
{ name: message.translate("general/whois:CURRENCY"), value: `${whois.currency || "Неизвестно"}`, inline: true },
|
||||
{ name: message.translate("general/whois:ISP"), value: `${whois.isp || "Неизвестно"}`, inline: true }
|
||||
{ name: interaction.translate("common:IP"), value: whois.query, inline: true },
|
||||
{ name: interaction.translate("general/whois:COUNTRY"), value: `${whois.country || interaction.translate("common:UNKNOWN")} (${whois.countryCode || interaction.translate("common:UNKNOWN")})`, inline: true },
|
||||
{ name: interaction.translate("general/whois:REGION"), value: `${whois.regionName || interaction.translate("common:UNKNOWN")} (${whois.region || interaction.translate("common:UNKNOWN")})`, inline: true },
|
||||
{ name: interaction.translate("general/whois:CITY"), value: `${whois.city || interaction.translate("common:UNKNOWN")}`, inline: true },
|
||||
{ name: interaction.translate("general/whois:ZIP"), value: `${whois.zip || interaction.translate("common:UNKNOWN")}`, inline: true },
|
||||
{ name: interaction.translate("general/whois:TIMEZONE"), value: `${whois.timezone || interaction.translate("common:UNKNOWN")}`, inline: true },
|
||||
{ name: interaction.translate("general/whois:CONTINENT"), value: `${whois.continent || interaction.translate("common:UNKNOWN")} (${whois.continentCode || interaction.translate("common:UNKNOWN")})`, inline: true },
|
||||
{ name: interaction.translate("general/whois:CURRENCY"), value: `${whois.currency || interaction.translate("common:UNKNOWN")}`, inline: true },
|
||||
{ name: interaction.translate("general/whois:ISP"), value: `${whois.isp || interaction.translate("common:UNKNOWN")}`, inline: true }
|
||||
)
|
||||
.setTimestamp();
|
||||
|
||||
if (whois.proxy == true) embed.addFields({ name: message.translate("general/whois:INFO"), value: message.translate("general/whois:PROXY") });
|
||||
else if (whois.mobile == true) embed.addFields({ name: message.translate("general/whois:INFO"), value: message.translate("general/whois:MOBILE") });
|
||||
else if (whois.hosting == true) embed.addFields({ name: message.translate("general/whois:INFO"), value: message.translate("general/whois:HOSTING") });
|
||||
if (whois.proxy) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:PROXY") });
|
||||
else if (whois.mobile) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:MOBILE") });
|
||||
else if (whois.hosting) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:HOSTING") });
|
||||
|
||||
message.reply({
|
||||
interaction.editReply({
|
||||
embeds: [embed]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Approved extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "approved",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const user = await this.client.resolveUser(args[0]) || message.author;
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
const buffer = await this.client.AmeAPI.generate("approved", {
|
||||
url: user.displayAvatarURL({
|
||||
format: "png",
|
||||
size: 512
|
||||
})
|
||||
});
|
||||
m.delete();
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "approved.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Approved;
|
|
@ -1,37 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Avatar extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "avatar",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
let user = await this.client.resolveUser(args[0]);
|
||||
if (!user) user = message.author;
|
||||
const avatarURL = user.displayAvatarURL({
|
||||
dynamic: true,
|
||||
size: 512
|
||||
});
|
||||
|
||||
if (args[0] === "link") return message.reply({ content: `<${avatarURL}>` });
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
attachment: avatarURL
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Avatar;
|
|
@ -1,48 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class BatSlap extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "batslap",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const users = [
|
||||
await this.client.resolveUser(args[0]) || message.author,
|
||||
await this.client.resolveUser(args[1]) || message.author
|
||||
];
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
const buffer = await this.client.AmeAPI.generate("batslap", {
|
||||
avatar: users[0].displayAvatarURL({
|
||||
format: "png",
|
||||
size: 512
|
||||
}),
|
||||
url: users[1].displayAvatarURL({
|
||||
format: "png",
|
||||
size: 512
|
||||
})
|
||||
});
|
||||
m.delete();
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "batslap.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BatSlap;
|
|
@ -1,41 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Beautiful extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "beautiful",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const user = await this.client.resolveUser(args[0]) || message.author;
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
const buffer = await this.client.AmeAPI.generate("beautiful", {
|
||||
url: user.displayAvatarURL({
|
||||
format: "png",
|
||||
size: 512
|
||||
})
|
||||
});
|
||||
m.delete();
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "beautiful.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Beautiful;
|
|
@ -1,52 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
canvacord = require("canvacord");
|
||||
|
||||
class Bed extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "bed",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const users = [
|
||||
await this.client.resolveUser(args[0]) || message.author,
|
||||
await this.client.resolveUser(args[1]) || message.author
|
||||
];
|
||||
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
try {
|
||||
const buffer = await canvacord.Canvas.bed(users[0].displayAvatarURL({
|
||||
format: "png"
|
||||
}), users[1].displayAvatarURL({
|
||||
format: "png"
|
||||
}));
|
||||
m.delete();
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "bed.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
m.error("misc:ERR_OCCURRED", null, {
|
||||
edit: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Bed;
|
|
@ -1,41 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Brazzers extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "brazzers",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const user = await this.client.resolveUser(args[0]) || message.author;
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
const buffer = await this.client.AmeAPI.generate("brazzers", {
|
||||
url: user.displayAvatarURL({
|
||||
format: "png",
|
||||
size: 512
|
||||
})
|
||||
});
|
||||
m.delete();
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "brazzers.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Brazzers;
|
|
@ -1,41 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Burn extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "burn",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const user = await this.client.resolveUser(args[0]) || message.author;
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
const buffer = await this.client.AmeAPI.generate("burn", {
|
||||
url: user.displayAvatarURL({
|
||||
format: "png",
|
||||
size: 512
|
||||
})
|
||||
});
|
||||
m.delete();
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "burn.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Burn;
|
|
@ -1,45 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
fetch = require("node-fetch");
|
||||
|
||||
class Captcha extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "captcha",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const user = await this.client.resolveUser(args[0]) || message.author;
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
try {
|
||||
const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=captcha&username=${user.username}&url=${user.displayAvatarURL({ format: "png", size: 512 })}`));
|
||||
const json = await res.json();
|
||||
m.delete();
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "captcha.png",
|
||||
attachment: json.message
|
||||
}]
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
m.error("misc:ERR_OCCURRED", null, {
|
||||
edit: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Captcha;
|
|
@ -1,41 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Challenger extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "challenger",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: ["cha"],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const user = await this.client.resolveUser(args[0]) || message.author;
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
const buffer = await this.client.AmeAPI.generate("challenger", {
|
||||
url: user.displayAvatarURL({
|
||||
format: "png",
|
||||
size: 512
|
||||
})
|
||||
});
|
||||
m.delete();
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "challenger.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Challenger;
|
|
@ -1,47 +0,0 @@
|
|||
const Command = require("../../base/Command"),
|
||||
fetch = require("node-fetch");
|
||||
|
||||
class Clyde extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "clyde",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const text = args.join(" ");
|
||||
|
||||
if (!text) return message.error("images/clyde:MISSING_TEXT");
|
||||
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
try {
|
||||
const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=clyde&text=${text}`));
|
||||
const json = await res.json();
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "clyde.png",
|
||||
attachment: json.message
|
||||
}]
|
||||
});
|
||||
m.delete();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
m.error("misc:ERR_OCCURRED", null, {
|
||||
edit: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Clyde;
|
|
@ -1,41 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Crush extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "crush",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const user = await this.client.resolveUser(args[0]) || message.author;
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
const buffer = await this.client.AmeAPI.generate("crush", {
|
||||
url: user.displayAvatarURL({
|
||||
format: "png",
|
||||
size: 512
|
||||
})
|
||||
});
|
||||
m.delete();
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "crush.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Crush;
|
|
@ -1,41 +0,0 @@
|
|||
const Command = require("../../base/Command");
|
||||
|
||||
class Dictator extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "dictator",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: false,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 3000
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
const user = await this.client.resolveUser(args[0]) || message.author;
|
||||
const m = await message.sendT("misc:PLEASE_WAIT", null, {
|
||||
prefixEmoji: "loading"
|
||||
});
|
||||
const buffer = await this.client.AmeAPI.generate("dictator", {
|
||||
url: user.displayAvatarURL({
|
||||
format: "png",
|
||||
size: 512
|
||||
})
|
||||
});
|
||||
m.delete();
|
||||
|
||||
message.reply({
|
||||
files: [{
|
||||
name: "dictator.png",
|
||||
attachment: buffer
|
||||
}]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Dictator;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue