А почему оно не применилось?

This commit is contained in:
JonnyBro 2022-01-05 00:24:57 +05:00
parent b12aadc755
commit ea7b883509
132 changed files with 975 additions and 872 deletions

View file

@ -63,26 +63,26 @@ class JaBa extends Client {
this.player
.on("playSong", async (queue, song) => {
const m = await queue.textChannel.send(this.translate("music/play:NOW_PLAYING", { songName: song.name }))
const m = await queue.textChannel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: song.name }) })
if (!song.isLive) {
setTimeout(() => {
if (!m.deleted) m.delete();
if (m.deletable) m.delete();
}, song.duration * 1000);
} else {
setTimeout(() => {
if (!m.deleted) m.delete();
if (m.deletable) m.delete();
}, 600 * 1000);
}
})
.on("addSong", (queue, song) => queue.textChannel.send(this.translate("music/play:ADDED_QUEUE", { songName: song.name })))
.on("addList", (queue, playlist) => queue.textChannel.send(this.translate("music/play:ADDED_QUEUE_COUNT", { songCount: playlist.songs.length })))
.on("addSong", (queue, song) => queue.textChannel.send({ content: this.translate("music/play:ADDED_QUEUE", { songName: song.name }) }))
.on("addList", (queue, playlist) => queue.textChannel.send({ content: this.translate("music/play:ADDED_QUEUE_COUNT", { songCount: playlist.songs.length }) }))
.on("searchResult", (message, result) => {
let i = 0
const embed = new MessageEmbed()
.setDescription(Util.escapeSpoiler(result.map(song => `**${++i} -** ${song.name}`).join("\n")))
.setFooter(this.translate("music/play:RESULTS_FOOTER"))
.setFooter({ text: this.translate("music/play:RESULTS_FOOTER") })
.setColor(this.config.embed.color);
message.channel.send(embed);
message.channel.send({ embeds: [embed] });
})
.on("searchDone", () => {})
.on("searchCancel", message => message.error("misc:TIMES_UP"))
@ -90,13 +90,11 @@ class JaBa extends Client {
.on("searchNoResult", message => message.error("music/play:NO_RESULT"))
.on("error", (textChannel, e) => {
console.error(e);
textChannel.send(this.translate("music/play:ERR_OCCURRED", {
error: e
}));
textChannel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e }) });
})
.on("finish", queue => queue.textChannel.send(this.translate("music/play:QUEUE_ENDED")))
.on("empty", queue => queue.textChannel.send(this.translate("music/play:STOP_EMPTY")));
// .on("disconnect", queue => queue.textChannel.send(this.translate("music/play:STOP_DISCONNECTED")))
.on("empty", queue => queue.textChannel.send(this.translate("music/play:STOP_EMPTY")));
this.giveawaysManager = new GiveawaysManager(this, {
storage: "./giveaways.json",

View file

@ -97,6 +97,7 @@ userSchema.method("genApiToken", async function() {
userSchema.method("getAchievements", async function() {
const canvas = Canvas.createCanvas(1800, 250),
ctx = canvas.getContext("2d");
const images = [
await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.work.achieved ? "_colored" : ""}1.png`),
await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.firstCommand.achieved ? "_colored" : ""}2.png`),

View file

@ -26,8 +26,12 @@ class Addemoji extends Command {
message.guild.emojis
.create(URL, name)
.then(emoji => message.success("administration/addemoji:SUCCESS", { emojiName: `<:${emoji.name}:${emoji.id}>` }))
.catch(() => message.error("administration/addemoji:ERROR", { emojiName: name }));
.then(emoji => message.success("administration/addemoji:SUCCESS", {
emojiName: `<:${emoji.name}:${emoji.id}>`
}))
.catch(() => message.error("administration/addemoji:ERROR", {
emojiName: name
}));
}
};

View file

@ -31,7 +31,7 @@ class Automod extends Command {
prefix: data.guild.prefix
});
} else if (status === "off") {
if (message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first()) {
if (message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first()) {
const channel = message.mentions.channels.first();
data.guild.plugins.automod.ignored.push(channel);
data.guild.markModified("plugins.automod");

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"),
Discord = require("discord.js"),
backup = require("discord-backup"),
Sentry = require("@sentry/node");
backup = require("discord-backup");
backup.setStorageFolder(__dirname + "../../../backups");
@ -39,7 +38,7 @@ class Backup extends Command {
message.error("misc:CANNOT_DM");
});
}).catch((err) => {
Sentry.captureException(err);
console.error(err);
return message.error("misc:ERR_OCCURRED");
});
} else if (status === "load") {

View file

@ -21,9 +21,14 @@ class Configuration extends Command {
const guildData = data.guild;
const embed = new Discord.MessageEmbed()
.setAuthor(message.guild.name, message.guild.iconURL())
.setColor(this.client.config.embed.color)
.setFooter(this.client.config.embed.footer);
.setAuthor({
name: message.guild.name,
iconURL: message.guild.iconURL()
})
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
// Guild prefix
embed.addField(message.translate("administration/configuration:PREFIX_TITLE"), guildData.prefix);
@ -82,7 +87,9 @@ class Configuration extends Command {
// Dashboard link
embed.addField(message.translate("administration/configuration:DASHBOARD_TITLE"), `[${message.translate("administration/configuration:DASHBOARD_CONTENT")}](${this.client.config.dashboard.baseURL})`);
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -49,7 +49,9 @@ class Goodbye extends Command {
author: message.author.toString()
});
const collector = message.channel.createMessageCollector(m => m.author.id === message.author.id, {
const filter = m => m.author.id === message.author.id;
const collector = message.channel.createMessageCollector({
filter,
time: 120000 // 2 minutes
});

View file

@ -17,7 +17,7 @@ class Ignore extends Command {
}
async run(message, args, data) {
const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first();
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);

View file

@ -1,74 +0,0 @@
const Command = require("../../base/Command.js"),
Discord = require("discord.js"),
Canvas = require("discord-canvas");
class Setfortniteshop extends Command {
constructor(client) {
super(client, {
name: "setfortniteshop",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["setfnshop"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
if (!data.config.apiKeys.fortniteFNBR || data.config.apiKeys.fortniteFNBR.length === "") return message.error("misc:COMMAND_DISABLED");
if (data.guild.plugins.fortniteshop && !message.mentions.channels.first() || message.mentions.channels.first() && data.guild.plugins.fortniteshop === message.mentions.channels.first().id) {
data.guild.plugins.fortniteshop = false;
data.guild.markModified("plugins.fortniteshop");
data.guild.save();
return message.success("administration/setfortniteshop:DISABLED");
};
const channel = message.mentions.channels.first() || message.channel;
data.guild.plugins.fortniteshop = channel.id;
data.guild.markModified("plugins.fortniteshop");
data.guild.save();
message.success("administration/setfortniteshop:ENABLED", {
channel: channel.toString()
});
const momentName = this.client.languages.find((language) => language.name === data.guild.language || language.aliases.includes(data.guild.language)).moment;
const shop = new Canvas.FortniteShop();
const image = await shop
.setToken(data.config.apiKeys.fortniteFNBR)
.setText("header", message.translate("general/fortniteshop:HEADER"))
.setText("daily", message.translate("general/fortniteshop:DAILY"))
.setText("featured", message.translate("general/fortniteshop:FEATURED"))
.setText("date", message.translate("general/fortniteshop:DATE", {
skipInterpolation: true
}).replace("{{date}}", "{date}"))
.setText("footer", message.translate("general/fortniteshop:FOOTER"))
.lang(momentName)
.toAttachment();
const attachment = new Discord.MessageAttachment(image, "shop.png");
const embed = new Discord.MessageEmbed()
.setAuthor(this.client.translate("general/fortniteshop:DATE", {
date: this.client.printDate(new Date(Date.now()), null, message.guild.data.language)
}, message.guild.data.language), this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.attachFiles(attachment)
.setImage("attachment://shop.png")
.setColor(this.client.config.embed.color)
.setFooter(this.client.config.embed.footer);
const msg = await channel.send(embed);
await msg.react("😍");
await msg.react("😐");
await msg.react("😭");
}
};
module.exports = Setfortniteshop;

View file

@ -18,7 +18,7 @@ class Slowmode extends Command {
}
async run(message, args, data) {
const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first();
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];

View file

@ -48,7 +48,10 @@ class Welcome extends Command {
message.sendT("administration/welcome:FORM_1", {
author: message.author.toString()
});
const collector = message.channel.createMessageCollector(m => m.author.id === message.author.id, {
const filter = m => m.author.id === message.author.id;
const collector = message.channel.createMessageCollector({
filter,
time: 120000 // 2 minutes
});
@ -85,7 +88,7 @@ class Welcome extends Command {
if (!welcome.channel) {
const channel = await Resolvers.resolveChannel({
message: msg,
channelType: "text"
channelType: "GUILD_TEXT"
});
if (!channel) return message.error("misc:INVALID_CHANNEL");

View file

@ -28,9 +28,13 @@ class Achievements extends Command {
}));
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("economy/achievements:TITLE"))
.setAuthor({
name: message.translate("economy/achievements:TITLE")
})
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
.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,
@ -68,7 +72,9 @@ class Achievements extends Command {
percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total))
}));
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -28,9 +28,7 @@ class Deposit extends Command {
amount = parseInt(amount, 10);
};
if (data.memberData.money < amount) return message.error("economy/deposit:NOT_ENOUGH_CREDIT", {
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
});
if (data.memberData.money < amount) return message.error("economy/deposit:NOT_ENOUGH_CREDIT", { money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` });
data.memberData.money = data.memberData.money - amount;
data.memberData.bankSold = data.memberData.bankSold + amount;

View file

@ -18,7 +18,7 @@ class Leaderboard extends Command {
}
async run(message, args) {
const isOnlyOnMobile = (message.author.presence.clientStatus ? JSON.stringify(Object.keys(message.author.presence.clientStatus)) === JSON.stringify(["mobile"]) : false);
const isOnlyOnMobile = (message.member.presence.clientStatus ? JSON.stringify(Object.keys(message.member.presence.clientStatus)) === JSON.stringify(["mobile"]) : false);
const type = args[0];
if (!type || (type !== "credits" && type !== "level" && type !== "rep")) return message.error("economy/leaderboard:MISSING_TYPE");
@ -37,7 +37,9 @@ class Leaderboard extends Command {
table.setHeading("#", message.translate("common:USER"), message.translate("common:CREDITS"));
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
const newTable = await fetchUsers(membersLeaderboard, table, this.client);
message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``);
message.channel.send({
content: `\`\`\`\n${newTable.toString()}\`\`\``
});
} else if (type === "level") {
const members = await this.client.membersData.find({
guildID: message.guild.id
@ -52,9 +54,15 @@ class Leaderboard extends Command {
table.setHeading("#", message.translate("common:USER"), message.translate("common:LEVEL"));
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
const newTable = await fetchUsers(membersLeaderboard, table, this.client);
message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``);
message.channel.send({
content: `\`\`\`\n${newTable.toString()}\`\`\``
});
} else if (type === "rep") {
const users = await this.client.usersData.find().lean(),
const users = await this.client.usersData.find({
rep: {
$gt: 0
}
}).lean(),
usersLeaderboard = users.map((u) => {
return {
id: u.id,
@ -65,7 +73,9 @@ class Leaderboard extends Command {
table.setHeading("#", message.translate("common:USER"), message.translate("common:POINTS"));
if (usersLeaderboard.length > 20) usersLeaderboard.length = 20;
const newTable = await fetchUsers(usersLeaderboard, table, this.client);
message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``);
message.channel.send({
content: `\`\`\`\n${newTable.toString()}\`\`\``
});
};
if (isOnlyOnMobile) message.sendT("economy/leaderboard:MOBILE");

View file

@ -78,7 +78,9 @@ class Marry extends Command {
to: member.user.toString()
});
const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === member.id, {
const filter = m => m.author.id === member.id;
const collector = new Discord.MessageCollector(message.channel, {
filter,
time: 120000
});
@ -96,7 +98,7 @@ class Marry extends Command {
// Delete pending request
delete pendings[message.author.id];
if (reason === "time") {
return message.error("misc:TIMES_UP", {
return message.error("economy/marry:TIMEOUT", {
username: member.user.toString()
});
};

View file

@ -37,7 +37,7 @@ class Credits extends Command {
const commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(user.id));
let globalMoney = 0;
await asyncForEach(commonsGuilds.array(), async (guild) => {
await asyncForEach(commonsGuilds, async (guild) => {
const memberData = await this.client.findOrCreateMember({
id: user.id,
guildID: guild.id
@ -47,19 +47,26 @@ class Credits extends Command {
});
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("economy/money:TITLE", {
.setAuthor({
name: message.translate("economy/money:TITLE", {
username: member.user.username
}), member.user.displayAvatarURL({
}),
iconURL: member.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
})
})
.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)
.setColor(this.client.config.embed.color)
.setFooter(this.client.config.embed.footer);
message.channel.send(embed);
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -26,13 +26,9 @@ class Pay extends Command {
if (!sentAmount || isNaN(sentAmount) || parseInt(sentAmount, 10) <= 0) return message.error("economy/pay:INVALID_AMOUNT", { username: member.user.tag });
const amount = Math.ceil(parseInt(sentAmount, 10));
<<<<<<< HEAD
if (amount > data.memberData.money) return message.error("economy/pay:ENOUGH_MONEY", { amount: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDITS:1"), message.translate("misc:NOUNS:CREDITS:2"), message.translate("misc:NOUNS:CREDITS:5"))}` });
=======
if (amount > data.memberData.money) return message.error("economy/pay:ENOUGH_MONEY", {
amount: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDITS:1"), message.translate("misc:NOUNS:CREDITS:2"), message.translate("misc:NOUNS:CREDITS:5"))}`
});
>>>>>>> discordjs-13
const memberData = await this.client.findOrCreateMember({
id: member.id,

View file

@ -42,7 +42,7 @@ class Profile extends Command {
const commonsGuilds = client.guilds.cache.filter((g) => g.members.cache.get(member.id));
let globalMoney = 0;
await asyncForEach(commonsGuilds.array(), async (guild) => {
await asyncForEach(commonsGuilds, async (guild) => {
const memberData = await client.findOrCreateMember({
id: member.id,
guildID: guild.id
@ -52,17 +52,16 @@ class Profile extends Command {
});
const profileEmbed = new Discord.MessageEmbed()
.setAuthor(message.translate("economy/profile:TITLE", {
.setAuthor({
name: message.translate("economy/profile:TITLE", {
username: member.user.tag
}), member.user.displayAvatarURL({
}),
iconURL: member.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.attachFiles([{
attachment: await userData.getAchievements(),
name: "achievements.png"
}])
})
})
.setImage("attachment://achievements.png")
.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)
@ -78,12 +77,11 @@ class Profile extends Command {
prefix: data.guild.prefix
}))
.setColor(data.config.embed.color) // Sets the color of the embed
.setFooter(data.config.embed.footer) // Sets the footer of the embed
.setFooter({
text: data.config.embed.footer
}) // Sets the footer of the embed
.setTimestamp();
<<<<<<< HEAD
message.channel.send(profileEmbed); // Send the embed in the current channel
=======
const buffer = await userData.getAchievements();
message.channel.send({
@ -93,7 +91,6 @@ class Profile extends Command {
attachment: buffer
}]
}); // Send the embed in the current channel
>>>>>>> discordjs-13
}
};

View file

@ -19,9 +19,7 @@ class Rob extends Command {
async run(message, args, data) {
const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.error("economy/rob:MISSING_MEMBER");
if (member.id === message.author.id) return message.error("economy/rob:YOURSELF");
if (member.user.bot) return message.error("economy/rob:BOT_USER");
const memberData = await this.client.findOrCreateMember({
id: member.id,
@ -40,7 +38,10 @@ class Rob extends Command {
if (amountToRob > memberData.money) return message.error("economy/rob:NOT_ENOUGH_MEMBER", { username: member.user.username });
const potentiallyLose = Math.floor(amountToRob * 1.5);
if (potentiallyLose > data.memberData.money) return message.error("economy/rob:NOT_ENOUGH_AUTHOR", { moneyMin: `${potentiallyLose} ${message.getNoun(potentiallyLose, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, moneyCurrent: `${data.memberData.money} ${message.getNoun(data.memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` });
if (potentiallyLose > data.memberData.money) return message.error("economy/rob:NOT_ENOUGH_AUTHOR", {
moneyMin: `${potentiallyLose} ${message.getNoun(potentiallyLose, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
moneyCurrent: `${data.memberData.money} ${message.getNoun(data.memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
});
const itsAWon = Math.floor(this.client.functions.randomNum(0, 100) < 25);
@ -55,7 +56,7 @@ class Rob extends Command {
username: member.user.username
});
data.memberData.money += amountToRob;
memberData.money -= amountToRob;
memberData.money -= amountToRob, 10;
memberData.save();
data.memberData.save();
} else {

View file

@ -33,9 +33,7 @@ class Slots extends Command {
// Gets the amount provided
let amount = args[0];
if (!amount || isNaN(amount) || amount < 1) amount = 50;
if (amount > data.memberData.money) return message.error("economy/slots:NOT_ENOUGH", {
money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
});
if (amount > data.memberData.money) return message.error("economy/slots:NOT_ENOUGH", { money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` });
amount = Math.round(amount);
@ -77,11 +75,13 @@ class Slots extends Command {
msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |";
tmsg.edit(msg);
const credits = getCredits(amount, true);
message.channel.send("**!! ДЖЕКПОТ !!**\n" + message.translate("economy/slots:VICTORY", {
message.channel.send({
content: "**!! ДЖЕКПОТ !!**\n" + message.translate("economy/slots:VICTORY", {
money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
won: `${credits} ${message.getNoun(credits, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
username: message.author.username
}));
})
});
const toAdd = credits - amount;
data.memberData.money = data.memberData.money + toAdd;
if (!data.userData.achievements.slots.achieved) {
@ -106,11 +106,13 @@ class Slots extends Command {
msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |";
tmsg.edit(msg);
const credits = getCredits(amount, false);
message.channel.send(message.translate("economy/slots:VICTORY", {
message.channel.send({
content: message.translate("economy/slots:VICTORY", {
money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
won: `${credits} ${message.getNoun(credits, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
username: message.author.username
}));
})
});
const toAdd = credits - amount;
data.memberData.money = data.memberData.money + toAdd;
if (!data.userData.achievements.slots.achieved) {
@ -132,10 +134,12 @@ class Slots extends Command {
};
msg += "| : : : **" + (message.translate("common:DEFEAT").toUpperCase()) + "** : : : |";
message.channel.send(message.translate("economy/slots:DEFEAT", {
message.channel.send({
content: message.translate("economy/slots:DEFEAT", {
money: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
username: message.author.username
}));
})
});
data.memberData.money = data.memberData.money - amount;
if (!data.userData.achievements.slots.achieved) {
data.userData.achievements.slots.progress.now = 0;

View file

@ -28,9 +28,7 @@ class Withdraw extends Command {
amount = parseInt(amount, 10);
};
if (data.memberData.bankSold < amount) return message.error("economy/withdraw:NOT_ENOUGH", {
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
});
if (data.memberData.bankSold < amount) return message.error("economy/withdraw:NOT_ENOUGH", { money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` });
data.memberData.money = data.memberData.money + amount;
data.memberData.bankSold = data.memberData.bankSold - amount;

View file

@ -40,11 +40,14 @@ class Work extends Command {
await data.memberData.save();
const embed = new Discord.MessageEmbed()
.setFooter(message.translate("economy/work:AWARD"), message.author.displayAvatarURL({
.setFooter({
text: message.translate("economy/work:AWARD"),
iconURL: message.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
})
})
.setColor(data.config.embed.color);
const award = [
@ -80,11 +83,7 @@ class Work extends Command {
data.memberData.save();
const messageOptions = {
<<<<<<< HEAD
embed
=======
embeds: [embed]
>>>>>>> discordjs-13
};
if (!data.userData.achievements.work.achieved) {
data.userData.achievements.work.progress.now += 1;

View file

@ -22,7 +22,9 @@ class Eightball extends Command {
const answerN = this.client.functions.randomNum(1, 19);
const answer = message.translate(`fun/8ball:RESPONSE_${answerN + 1}`);
message.channel.send(answer);
message.channel.send({
content: answer
});
}
};

View file

@ -25,7 +25,9 @@ class Ascii extends Command {
const rendered = await figletAsync(text);
message.channel.send("```" + rendered + "```");
message.channel.send({
content: "```" + rendered + "```"
});
}
};

View file

@ -29,7 +29,9 @@ class Choice extends Command {
edit: true
});
const result = answers[parseInt(Math.floor(Math.random() * answers.length))];
message.channel.send("```" + result + "```");
message.channel.send({
content: "```" + result + "```"
});
}, 1500);
}
};

View file

@ -61,7 +61,9 @@ class FindWords extends Command {
}, false, false, "warn");
// init a collector to receive the answers
const collector = new Discord.MessageCollector(message.channel, (m) => !m.author.bot, {
const filter = m => !m.author.bot;
const collector = new Discord.MessageCollector(message.channel, {
filter,
time: 20000
});

View file

@ -25,10 +25,14 @@ class Fml extends Command {
const embed = new Discord.MessageEmbed()
.setDescription(fml.content)
.setFooter(message.translate("fun/fml:FOOTER"))
.setColor(this.client.config.embed.color);
.setFooter({
text: message.translate("fun/fml:FOOTER")
})
.setColor(data.config.embed.color);
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -25,10 +25,14 @@ class Joke extends Command {
const embed = new Discord.MessageEmbed()
.setDescription(joke.toDiscordSpoils())
.setFooter(message.translate("fun/joke:FOOTER"))
.setColor(this.client.config.embed.color);
.setFooter({
text: message.translate("fun/joke:FOOTER")
})
.setColor(data.config.embed.color);
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -20,7 +20,9 @@ class Lmg extends Command {
const question = args.join(" ");
if (!question) return message.error("fun/lmg:MISSING");
const encodedQuestion = question.replace(/[' '_]/g, "+");
await message.channel.send(`https://google.gik-team.com/?q=${encodedQuestion}`);
await message.channel.send({
content: `https://google.gik-team.com/?q=${encodedQuestion}`
});
message.delete().catch(() => {});
}
};

View file

@ -18,7 +18,7 @@ class Lovecalc extends Command {
});
}
async run(message) {
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
@ -37,16 +37,22 @@ class Lovecalc extends Command {
const percent = parseInt(string.substr(0, 2), 10);
const embed = new Discord.MessageEmbed()
.setAuthor(`❤️ ${message.translate("fun/lovecalc:DESCRIPTION")}`)
.setAuthor({
name: `❤️ ${message.translate("fun/lovecalc:DESCRIPTION")}`
})
.setDescription(message.translate("fun/lovecalc:CONTENT", {
percent,
firstUsername: firstMember.user.username,
secondUsername: secondMember.user.username
}))
.setColor(this.client.config.embed.color)
.setFooter(this.client.config.embed.footer);
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -30,7 +30,9 @@ class Number extends Command {
// Store the date wich the game has started
const gameCreatedAt = Date.now();
const collector = new Discord.MessageCollector(message.channel, m => !m.author.bot, {
const filter = m => !m.author.bot;
const collector = new Discord.MessageCollector(message.channel, {
filter,
time: 480000 // 8 minutes
});
currentGames[message.guild.id] = true;

View file

@ -22,153 +22,201 @@ class Activity extends Command {
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
const perms = voice.permissionsFor(this.client.user);
if (!perms.has("CONNECT") || !perms.has("SPEAK")) return message.error("music/play:VOICE_CHANNEL_CONNECT");
if (!perms.has(Discord.Permissions.FLAGS.CONNECT) || !perms.has(Discord.Permissions.FLAGS.SPEAK)) return message.error("music/play:VOICE_CHANNEL_CONNECT");
const activities = ["awkword", "betrayal", "checkers", "chess", "doodlecrew", "fishing", "lettertile", "poker", "spellcast", "wordsnack", "puttparty", "youtube"];
const activity = args[0];
switch (activity) {
case "awkword":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "awkword").then(async invite => {
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "awkword").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Awkword")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Awkword", channel: voice.name })}](${invite.code})**`)
.setFooter(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "betrayal":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "betrayal").then(async invite => {
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(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "checkers":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "checkers").then(async invite => {
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(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "chess":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "chess").then(async invite => {
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(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "doodlecrew":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "doodlecrew").then(async invite => {
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "doodlecrew").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Doodle Crew")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Doodle Crew", channel: voice.name })}](${invite.code})**`)
.setFooter(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "fishing":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "fishing").then(async invite => {
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(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "lettertile":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "lettertile").then(async invite => {
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(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "poker":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "poker").then(async invite => {
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(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "spellcast":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "spellcast").then(async invite => {
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(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "wordsnack":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "wordsnack").then(async invite => {
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(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "puttparty":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "puttparty").then(async invite => {
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(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
case "youtube":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "youtube").then(async invite => {
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(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
});
break;
@ -177,9 +225,13 @@ class Activity extends Command {
.setTitle(message.translate("general/activity:TITLE"))
.setDescription(activities.join("\n"))
.setColor(data.config.embed.color)
.setFooter(message.translate("general/activity:FOOTER"))
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp()
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
break;
};
}

View file

@ -1,77 +0,0 @@
const Command = require("../../base/Command.js"),
Canvas = require("discord-canvas"),
Discord = require("discord.js");
class Fortnite extends Command {
constructor(client) {
super(client, {
name: "fortnite",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["fn"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
if (!data.config.apiKeys.fortniteTRN || data.config.apiKeys.fortniteTRN.length === "") return message.success("misc:COMMAND_DISABLED");
const stats = new Canvas.FortniteStats();
const platform = args[0].toLowerCase();
if (!platform || (platform !== "pc" && platform !== "xbl" && platform !== "psn")) return message.error("general/fortnite:MISSING_PLATFORM");
const user = args.slice(1).join(" ");
if (!user) return message.error("general/fortnite:MISSING_USERNAME");
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const statsImage = await stats
.setToken(data.config.apiKeys.fortniteTRN)
.setUser(user)
.setPlatform(platform)
.setText("averageKills", message.translate("general/fortnite:AVERAGE_KILLS"))
.setText("averageKill", message.translate("general/fortnite:AVERAGE_KILL"))
.setText("wPercent", message.translate("general/fortnite:W_PERCENT"))
.setText("winPercent", message.translate("general/fortnite:WIN_PERCENT"))
.setText("kD", message.translate("general/fortnite:KD"))
.setText("wins", message.translate("general/fortnite:WINS"))
.setText("win", message.translate("general/fortnite:WIN"))
.setText("kills", message.translate("general/fortnite:KILLS"))
.setText("kill", message.translate("general/fortnite:KILL"))
.setText("matches", message.translate("general/fortnite:MATCHES"))
.setText("match", message.translate("general/fortnite:MATCH"))
.setText("footer", message.translate("general/fortnite:FOOTER"))
.toAttachment();
if (!statsImage) {
m.delete();
return message.error("general/fortnite:NOT_FOUND", {
platform,
search: user
});
};
// Send embed
const attachment = new Discord.MessageAttachment(statsImage.toBuffer(), "fortnite-stats-image.png"),
embed = new Discord.MessageEmbed()
.setDescription(message.translate("general/fortnite:TITLE", {
username: `[${stats.data.username}](${stats.data.url.replace(new RegExp(" ", "g"), "%20")})`
}))
.attachFiles(attachment)
.setImage("attachment://fortnite-stats-image.png")
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
message.channel.send(embed);
m.delete();
}
};
module.exports = Fortnite;

View file

@ -1,61 +0,0 @@
const Command = require("../../base/Command.js"),
Discord = require("discord.js"),
Canvas = require("discord-canvas");
class Fortniteshop extends Command {
constructor(client) {
super(client, {
name: "fortniteshop",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["fns"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
if (!data.config.apiKeys.fortniteFNBR || data.config.apiKeys.fortniteFNBR.length === "") return message.error("misc:COMMAND_DISABLED");
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const momentName = this.client.languages.find((language) => language.name === data.guild.language || language.aliases.includes(data.guild.language)).moment;
const shop = new Canvas.FortniteShop();
const image = await shop
.setToken(data.config.apiKeys.fortniteFNBR)
.setText("header", message.translate("general/fortniteshop:HEADER"))
.setText("daily", message.translate("general/fortniteshop:DAILY"))
.setText("featured", message.translate("general/fortniteshop:FEATURED"))
.setText("date", message.translate("general/fortniteshop:DATE", {
skipInterpolation: true
}).replace("{{date}}", "{date}"))
.setText("footer", message.translate("general/fortniteshop:FOOTER"))
.lang(momentName)
.toAttachment();
const attachment = new Discord.MessageAttachment(image, "shop.png");
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/fortniteshop:HEADER", {
date: message.printDate(new Date(Date.now()))
}), this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.attachFiles(attachment)
.setImage("attachment://shop.png")
.setColor(this.client.config.embed.color)
.setFooter(this.client.config.embed.footer);
await message.channel.send(embed);
await m.delete();
return;
}
};
module.exports = Fortniteshop;

View file

@ -23,11 +23,14 @@ class Github extends Command {
const json = await res.json();
const embed = new Discord.MessageEmbed()
.setAuthor(this.client.user.tag, this.client.user.displayAvatarURL({
.setAuthor({
name: this.client.user.tag,
iconURL: this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
})
})
.setDescription(`[${message.translate("general/github:CLICK_HERE")}](${json.html_url})`)
.addField("Название", json.name, true)
.addField("Звёзды", json.stargazers_count, true)
@ -36,9 +39,13 @@ class Github extends Command {
.addField(message.translate("general/github:OWNER"), `[${json.owner.login}](${json.owner.html_url})`)
.setImage(json.owner.avatar_url)
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
.setFooter({
text: data.config.embed.footer
});
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -37,10 +37,14 @@ class Hastebin extends Command {
const url = `https://hastebin.com/${json.key}.js`;
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/hastebin:SUCCESS"))
.setAuthor({
name: message.translate("general/hastebin:SUCCESS")
})
.setDescription(url)
.setColor(data.config.embed.color);
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
} catch (e) {
message.error("misc:ERR_OCCURRED");
};

View file

@ -41,18 +41,24 @@ class Help extends Command {
});
const groupEmbed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/help:CMD_TITLE", {
.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(this.client.config.embed.color)
.setFooter(this.client.config.embed.footer);
.setFooter({
text: this.client.config.embed.footer
});
return message.channel.send(groupEmbed);
return message.channel.send({
embeds: [groupEmbed]
});
};
const categories = [];
@ -72,11 +78,14 @@ class Help extends Command {
prefix: message.guild ? data.guild.prefix : ""
}))
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
.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(", ")}`);
});
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(", "));
};
@ -87,14 +96,20 @@ class Help extends Command {
donateLink: "https://qiwi.com/n/JONNYBRO/",
owner: this.client.config.owner.id
}));
embed.setAuthor(message.translate("general/help:TITLE", {
embed.setAuthor({
name: message.translate("general/help:TITLE", {
name: this.client.user.username
}), this.client.user.displayAvatarURL({
}),
iconURL: this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}));
return message.channel.send(embed);
})
});
return message.channel.send({
embeds: [embed]
});
}
};

View file

@ -21,7 +21,7 @@ class Invitations extends Command {
let member = await this.client.resolveMember(args[0], message.guild);
if (!member) member = message.member;
const invites = await message.guild.fetchInvites().catch(() => {});
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);
@ -48,8 +48,12 @@ class Invitations extends Command {
const embed = new Discord.MessageEmbed()
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer)
.setAuthor(message.translate("general/invitations:TRACKER"))
.setFooter({
text: data.config.embed.footer
})
.setAuthor({
name: message.translate("general/invitations:TRACKER")
})
.setDescription(message.translate("general/invitations:TITLE", {
member: member.user.tag,
guild: message.guild.name
@ -59,7 +63,9 @@ class Invitations extends Command {
}))
.addField(message.translate("general/invitations:FIELD_CODES"), content);
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -18,14 +18,21 @@ class Invite extends Command {
}
async run(message, args, data) {
const inviteLink = `https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=8`;
const inviteLink = this.client.generateInvite({
scopes: ["bot"],
permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR]
});
const voteURL = `https://discordbots.org/bot/${this.client.user.id}/vote`;
const supportURL = await this.client.functions.supportLink(this.client);
if (args[0] && args[0] === "copy") return message.channel.send(inviteLink);
if (args[0] && args[0] === "copy") return message.channel.send({
content: inviteLink
});
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/invite:LINKS"))
.setAuthor({
name: message.translate("general/invite:LINKS")
})
.setDescription(message.translate("general/invite:TIP", {
prefix: data.guild.prefix || ""
}))
@ -33,9 +40,13 @@ class Invite extends Command {
.addField(message.translate("general/invite:VOTE"), voteURL)
.addField(message.translate("general/invite:SUPPORT"), supportURL)
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
.setFooter({
text: data.config.embed.footer
});
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -66,9 +66,11 @@ class Minecraft extends Command {
const imgAttachment = new Discord.MessageAttachment(await imgRes.buffer(), "success.png");
const mcEmbed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/minecraft:FIELD_NAME", {
.setAuthor({
name: message.translate("general/minecraft:FIELD_NAME", {
ip: json.name
}))
})
})
.addField(message.translate("general/minecraft:FIELD_VERSION"), json.raw.vanilla.raw.version.name)
.addField(message.translate("general/minecraft:FIELD_CONNECTED"), message.translate("general/minecraft:PLAYERS", {
count: (json.raw.players ? json.raw.players.online : json.players.length)
@ -80,9 +82,15 @@ class Minecraft extends Command {
.addField(message.translate("general/minecraft:FIELD_IP"), json.connect)
.setColor(data.config.embed.color)
.setThumbnail(favicon)
.setFooter(data.config.embed.footer);
.setFooter({
text: data.config.embed.footer
});
m.edit(null, [mcEmbed, imgAttachment]);
m.edit({
content: null,
embeds: [mcEmbed],
files: [imgAttachment]
});
}
};

View file

@ -37,7 +37,9 @@ class Permissions extends Command {
};
});
text += `\n${total.allowed} ✅ | ${total.denied}` + "\n```";
message.channel.send(text);
message.channel.send({
content: text
});
}
};

View file

@ -22,9 +22,7 @@ class Ping extends Command {
}).then((m) => {
m.sendT("general/ping:CONTENT", {
ping: m.createdTimestamp - message.createdTimestamp
}, {
edit: true
});
}, { edit: true });
});
}
};

View file

@ -20,14 +20,19 @@ class Quote extends Command {
async run(message, args, data) {
function embed(m) {
const embed = new Discord.MessageEmbed()
.setAuthor(m.author.tag, m.author.displayAvatarURL({
.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(m.guild.name + " | #" + m.channel.name)
.setFooter({
text: m.guild.name + " | #" + m.channel.name
})
.setTimestamp(m.createdTimestamp);
if (m.attachments.size > 0) embed.setImage(m.attachments.first().url);
return embed;
@ -35,7 +40,9 @@ class Quote extends Command {
const msgID = args[0];
if (isNaN(msgID)) {
message.author.send(message.translate("general/quote:MISSING_ID")).then(() => {
message.author.send({
content: message.translate("general/quote:MISSING_ID")
}).then(() => {
message.delete();
}).catch(() => {
message.error("misc:CANNOT_DM");
@ -66,7 +73,9 @@ class Quote extends Command {
return;
}).then((msg) => {
message.delete();
message.channel.send(embed(msg));
message.channel.send({
embeds: [embed(msg)]
});
});
} else {
channel.messages.fetch(msgID).catch(() => {
@ -78,7 +87,9 @@ class Quote extends Command {
return;
}).then((msg) => {
message.delete();
message.channel.send(embed(msg));
message.channel.send({
embeds: [embed(msg)]
});
});
};
}

View file

@ -29,24 +29,31 @@ class Report extends Command {
if (!rep) return message.error("general/report:MISSING_REASON");
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/report:TITLE", {
.setAuthor({
name: message.translate("general/report:TITLE", {
user: member.user.tag
}), message.author.displayAvatarURL({
}),
iconURL: message.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
})
})
.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)
.setFooter(data.config.embed.footer);
.setFooter({
text: data.config.embed.footer
});
const success = Discord.Util.parseEmoji(this.client.customEmojis.success).id;
const error = Discord.Util.parseEmoji(this.client.customEmojis.error).id;
repChannel.send(embed).then(async (m) => {
repChannel.send({
embeds: [embed]
}).then(async (m) => {
await m.react(success);
await m.react(error);
});

View file

@ -32,9 +32,12 @@ class Serverinfo extends Command {
const owner = await guild.fetchOwner();
const embed = new Discord.MessageEmbed()
.setAuthor(guild.name, guild.iconURL({
.setAuthor({
name: guild.name,
iconURL: guild.iconURL({
dynamic: true
}))
})
})
.setThumbnail(guild.iconURL({
dynamic: true
}))
@ -49,14 +52,18 @@ class Serverinfo extends Command {
.addField(this.client.customEmojis.crown + message.translate("common:OWNER"), owner.toString(), true)
.addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount || "0", true)
.addField(this.client.customEmojis.channels + message.translate("common:CHANNELS"),
`${guild.channels.cache.filter(c => c.type === "text").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "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 === "voice").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "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 === "category").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "category").size, message.translate("misc:NOUNS:CATEGORY:1"), message.translate("misc:NOUNS:CATEGORY:2"), message.translate("misc:NOUNS:CATEGORY:5"))}`, true
`${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)
.setFooter(data.config.embed.footer);
.setFooter({
text: data.config.embed.footer
});
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -29,9 +29,13 @@ class ShortURL extends Command {
const embed = new Discord.MessageEmbed()
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer)
.setFooter({
text: data.config.embed.footer
})
.setDescription(body);
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -30,7 +30,9 @@ class Someone extends Command {
format: "png"
}))
.setColor(data.config.embed.color);
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -19,17 +19,23 @@ class Staff extends Command {
async run(message, args, data) {
await message.guild.members.fetch();
const administrators = message.guild.members.cache.filter((m) => m.hasPermission("ADMINISTRATOR") && !m.user.bot);
const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.hasPermission("MANAGE_MESSAGES") && !m.user.bot);
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()
.setAuthor(message.translate("general/staff:TITLE", {
.setAuthor({
name: message.translate("general/staff:TITLE", {
guild: message.guild.name
}))
})
})
.addField(message.translate("general/staff:ADMINS"), (administrators.size > 0 ? administrators.map((a) => `${this.client.customEmojis.status[a.presence.status]} | <@${a.user.id}>`).join("\n") : message.translate("general/staff:NO_ADMINS")))
.addField(message.translate("general/staff:MODS"), (moderators.size > 0 ? moderators.map((m) => `${this.client.customEmojis.status[m.presence.status]} | <@${m.user.id}>`).join("\n") : message.translate("general/staff:NO_MODS")))
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
message.channel.send(embed);
.setFooter({
text: data.config.embed.footer
});
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -20,8 +20,12 @@ class Stats extends Command {
async run(message, args, data) {
const statsEmbed = new Discord.MessageEmbed()
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer)
.setAuthor(message.translate("common:STATS"))
.setFooter({
text: data.config.embed.footer
})
.setAuthor({
name: message.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: this.client.guilds.cache.size,
@ -46,7 +50,9 @@ class Stats extends Command {
donateLink: "https://qiwi.com/n/JONNYBRO/",
owner: this.client.config.owner.id
}));
message.channel.send(statsEmbed);
message.channel.send({
embeds: [statsEmbed]
});
}
};

View file

@ -25,23 +25,30 @@ class Suggest extends Command {
if (!sugg) return message.error("general/suggest:MISSING_CONTENT");
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/suggest:TITLE", {
.setAuthor({
name: message.translate("general/suggest:TITLE", {
user: message.author.username
}), message.author.displayAvatarURL({
}),
iconURL: message.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
})
})
.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)
.setFooter(data.config.embed.footer);
.setFooter({
text: data.config.embed.footer
});
const success = Discord.Util.parseEmoji(this.client.customEmojis.success).id;
const error = Discord.Util.parseEmoji(this.client.customEmojis.error).id;
suggChannel.send(embed).then(async (m) => {
suggChannel.send({
embeds: [embed]
}).then(async (m) => {
await m.react(success);
await m.react(error);
});

View file

@ -44,23 +44,27 @@ class Translate extends Command {
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 translated = await translate(toTranslate, { to: language });
const resEmbed = new Discord.MessageEmbed()
.setAuthor("Переводчик", this.client.user.displayAvatarURL({
.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(data.config.embed.footer);
.setFooter({
text: data.config.embed.footer
});
return pWait.edit("", {
embed: resEmbed
return pWait.edit({
content: null,
embeds: [resEmbed]
});
}
};

View file

@ -41,11 +41,14 @@ class Userinfo extends Command {
if (message.guild) member = await message.guild.members.fetch(user).catch(() => {});
const embed = new Discord.MessageEmbed()
.setAuthor(user.tag, user.displayAvatarURL({
.setAuthor({
name: user.tag,
iconURL: user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
})
})
.setThumbnail(user.displayAvatarURL({
dynamic: true
}))
@ -59,15 +62,17 @@ class Userinfo extends Command {
format: "png"
}))
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
.setFooter({
text: data.config.embed.footer
});
if (displayPresence) {
embed.addField(this.client.customEmojis.games + " " + message.translate("common:GAME"), (user.presence.activity ? user.presence.activity.name : message.translate("general/userinfo:NO_GAME")), true)
embed.addField(this.client.customEmojis.status[user.presence.status] + " " + message.translate("common:STATUS"), message.translate("common:STATUS_" + (user.presence.status.toUpperCase())), true);
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) {
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.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)
@ -95,7 +100,9 @@ class Userinfo extends Command {
};
};
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -28,10 +28,13 @@ class Approved extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "approved.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -26,10 +26,13 @@ class Avatar extends Command {
format: "png"
});
if (message.content.includes("link")) message.channel.send(`<${avatarURL}>`);
if (message.content.includes("link")) message.channel.send({ content: `<${avatarURL}>` });
const attachment = new Discord.MessageAttachment(avatarURL, `avatar.${avatarURL.split(".").pop().split("?")[0]}`);
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: avatarURL
}]
});
}
};

View file

@ -35,10 +35,13 @@ class BatSlap extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "batslap.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -28,10 +28,13 @@ class Beautiful extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "beautiful.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -33,9 +33,13 @@ class Bed extends Command {
}), users[1].displayAvatarURL({
format: "png"
}));
const attachment = new Discord.MessageAttachment(buffer, "bed.png");
message.channel.send(attachment);
m.delete();
message.channel.send({
files: [{
attachment: buffer
}]
});
} catch (e) {
console.log(e);
m.error("misc:ERROR_OCCURRED", null, {

View file

@ -28,10 +28,13 @@ class Brazzers extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "brazzers.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -28,10 +28,13 @@ class Burn extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "burn.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -26,9 +26,13 @@ class Captcha extends Command {
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();
const attachment = new Discord.MessageAttachment(json.message, "captcha.png");
message.channel.send(attachment);
m.delete();
message.channel.send({
files: [{
attachment: json.message
}]
});
} catch (e) {
console.log(e);
m.error("misc:ERR_OCCURRED", null, {

View file

@ -28,10 +28,13 @@ class Challenger extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "challenger.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -29,8 +29,11 @@ class Clyde extends Command {
try {
const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=clyde&text=${text}`));
const json = await res.json();
const attachment = new Discord.MessageAttachment(json.message, "clyde.png");
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: json.message
}]
});
m.delete();
} catch (e) {
console.log(e);

View file

@ -28,10 +28,13 @@ class Dictator extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "dictator.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -42,11 +42,13 @@ class Facepalm extends Command {
const layer = await Canvas.loadImage("./assets/img/facepalm.png");
ctx.drawImage(layer, 0, 0, 632, 357);
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "facepalm.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -28,10 +28,13 @@ class Fire extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "fire.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -28,10 +28,13 @@ class Jail extends Command {
size: 1024
})
});
const attachment = new Discord.MessageAttachment(buffer, "jail.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -30,8 +30,11 @@ class Love extends Command {
try {
const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=ship&user1=${users[0].displayAvatarURL({ format: "png", size: 512 })}&user2=${users[1].displayAvatarURL({ format: "png", size: 512 })}`));
const json = await res.json();
const attachment = new Discord.MessageAttachment(json.message, "love.png");
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: json.message
}]
});
m.delete();
} catch (e) {
console.log(e);

View file

@ -28,10 +28,13 @@ class Mission extends Command {
size: 2048
})
});
const attachment = new Discord.MessageAttachment(buffer, "mission.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -41,9 +41,13 @@ class Phcomment extends Command {
}),
message: text
});
const attachment = new Discord.MessageAttachment(buffer, "phcomment.png");
message.channel.send(attachment);
m.delete();
message.channel.send({
files: [{
attachment: buffer
}]
});
} catch (e) {
console.log(e);
m.error("misc:ERROR_OCCURRED", null, {

View file

@ -29,9 +29,11 @@ class Qrcode extends Command {
.setImage(`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${text.replace(new RegExp(" ", "g"), "%20")}`)
.setColor(data.config.embed.color);
pleaseWait.edit(message.translate("images/qrcode:SUCCESS"), {
embed
pleaseWait.edit({
content: message.translate("images/qrcode:SUCCESS"),
embeds: [embed]
});
}
};

View file

@ -28,10 +28,13 @@ class Rip extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "rip.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -28,10 +28,13 @@ class Scary extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "scary.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -28,10 +28,13 @@ class Tobecontinued extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "tobecontinued.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -27,10 +27,13 @@ class Trash extends Command {
format: "png",
size: 512
}));
const attachment = new Discord.MessageAttachment(buffer, "trash.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -30,10 +30,13 @@ class Triggered extends Command {
sepia: "true",
invert: "true"
});
const attachment = new Discord.MessageAttachment(buffer, "triggered.gif");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -39,10 +39,13 @@ class Tweet extends Command {
avatar3: randomMembers[2].user.displayAvatarURL(),
text
});
const attachment = new Discord.MessageAttachment(buffer, "twitter.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -28,10 +28,13 @@ class Wanted extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "wanted.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -28,10 +28,13 @@ class Wasted extends Command {
size: 512
})
});
const attachment = new Discord.MessageAttachment(buffer, "wasted.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: buffer
}]
});
}
};

View file

@ -40,10 +40,13 @@ class YouTubeComment extends Command {
}),
content: text
});
const attachment = new Discord.MessageAttachment(image, "ytb-comment.png");
m.delete();
message.channel.send(attachment);
message.channel.send({
files: [{
attachment: image
}]
});
}
};

View file

@ -26,7 +26,10 @@ class Announcement extends Command {
let mention = null;
const msg = await message.sendT("moderation/announcement:MENTION_PROMPT");
const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, {
const filter = m => m.author.id === message.author.id;
const collector = new Discord.MessageCollector(message.channel, {
filter,
time: 240000
});
@ -41,7 +44,10 @@ class Announcement extends Command {
tmsg.delete();
msg.delete();
const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT");
const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, {
const filter = m => m.author.id === message.author.id;
const c = new Discord.MessageCollector(message.channel, {
filter,
time: 60000
});
c.on("collect", (m) => {
@ -69,13 +75,20 @@ class Announcement extends Command {
if (reason === "time") return message.error("misc:TIMES_UP");
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("moderation/announcement:TITLE"))
.setAuthor({
name: message.translate("moderation/announcement:TITLE")
})
.setColor(data.config.embed.color)
.setFooter(message.author.tag)
.setFooter({
text: message.author.tag
})
.setTimestamp()
.setDescription(text);
message.channel.send(mention, embed);
message.channel.send({
content: mention,
embeds: [embed]
});
});
}
};

View file

@ -29,7 +29,7 @@ class Ban extends Command {
if (user.id === message.author.id) return message.error("moderation/ban:YOURSELF");
// If the user is already banned
const banned = await message.guild.fetchBans();
const banned = await message.guild.bans.fetch();
if (banned.some((m) => m.user.id === user.id)) return message.error("moderation/ban:ALREADY_BANNED", {
username: user.tag
});
@ -42,7 +42,7 @@ class Ban extends Command {
if (member) {
const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
if (!member.bannable) return message.error("moderation/ban:MISSING_PERM");
};
@ -86,14 +86,18 @@ class Ban extends Command {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if (!channel) return;
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("moderation/ban:CASE", {
.setAuthor({
name: message.translate("moderation/ban:CASE", {
count: data.guild.casesCount
}))
})
})
.addField(message.translate("common:USER"), `\`${user.tag}\` (${user.toString()})`, true)
.addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true)
.addField(message.translate("common:REASON"), reason, true)
.setColor("#e02316");
channel.send(embed);
channel.send({
embeds: [embed]
});
};
}).catch((err) => {

View file

@ -1,49 +0,0 @@
const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Checkinvites extends Command {
constructor(client) {
super(client, {
name: "checkinvites",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["checkinvite", "checkinv"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const withInvite = [];
message.guild.members.cache.forEach((m) => {
const possibleLinks = m.user.presence.activities.map((a) => [a.state, a.details, a.name]).flat();
const inviteLinks = possibleLinks.filter((l) => /(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(l));
if (inviteLinks.length > 0) {
withInvite.push({
id: m.user.id,
tag: Discord.Util.escapeMarkdown(m.user.tag),
links: "**" + Discord.Util.escapeMarkdown(inviteLinks.join(", ")) + "**"
});
};
});
const text = (withInvite.length > 0 ? withInvite.map((m) => "`" + m.id + "` (" + m.tag + ") : " + m.links).join("\n") : message.translate("moderation/checkinvites:NOBODY"));
const embed = new Discord.MessageEmbed()
.setDescription(text)
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
const m = await message.channel.send(embed);
setTimeout(function () {
m.delete();
}, 3000);
}
};
module.exports = Checkinvites;

View file

@ -30,7 +30,9 @@ class Clear extends Command {
const newChannel = await message.channel.clone();
await message.channel.delete();
newChannel.setPosition(position);
return newChannel.send(message.translate("moderation/clear:CHANNEL_CLEARED"));
return newChannel.send({
content: message.translate("moderation/clear:CHANNEL_CLEARED")
});
};
let amount = args[0];
@ -41,9 +43,8 @@ class Clear extends Command {
const user = message.mentions.users.first();
let messages = await message.channel.messages.fetch({
limit: 100
limit: amount
});
messages = messages.array();
if (user) messages = messages.filter((m) => m.author.id === user.id);
if (messages.length > amount) messages.length = parseInt(amount, 10);

View file

@ -22,7 +22,7 @@ class Giveaway extends Command {
if (!status) return message.error("moderation/giveaway:MISSING_STATUS");
if (status === "create") {
const currentGiveaways = this.client.giveawaysManager.giveaways.filter((g) => g.guildID === message.guild.id && !g.ended).length;
const currentGiveaways = this.client.giveawaysManager.giveaways.filter((g) => g.guildId === message.guild.id && !g.ended).length;
if (currentGiveaways > 3) return message.error("moderation/giveaway:MAX_COUNT");
const time = args[1];

View file

@ -34,7 +34,7 @@ class Kick extends Command {
const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
if (!member.kickable) return message.error("moderation/kick:MISSING_PERM");
await member.send(message.translate("moderation/kick:KICKED_DM", {
@ -73,14 +73,18 @@ class Kick extends Command {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if (!channel) return;
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("moderation/kick:CASE", {
.setAuthor({
name: message.translate("moderation/kick:CASE", {
count: data.guild.casesCount
}))
})
})
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true)
.addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true)
.addField(message.translate("common:REASON"), reason, true)
.setColor("#e88709");
channel.send(embed);
channel.send({
embeds: [embed]
});
};
}).catch(() => {

View file

@ -25,7 +25,7 @@ class Mute extends Command {
const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
const memberData = await this.client.findOrCreateMember({
id: member.id,
@ -38,7 +38,7 @@ class Mute extends Command {
if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED");
message.guild.channels.cache.forEach((channel) => {
channel.updateOverwrite(member.id, {
channel.permissionOverwrites.edit(member.id, {
SEND_MESSAGES: false,
ADD_REACTIONS: false,
CONNECT: false
@ -90,16 +90,20 @@ class Mute extends Command {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if (!channel) return;
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("moderation/mute:CASE", {
.setAuthor({
name: message.translate("moderation/mute:CASE", {
count: data.guild.casesCount
}))
})
})
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true)
.addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true)
.addField(message.translate("common:REASON"), reason, true)
.addField(message.translate("common:DURATION"), time, true)
.addField(message.translate("common:EXPIRY"), message.printDate(new Date(Date.now() + ms(time))), true)
.setColor("#f44271");
channel.send(embed);
channel.send({
embeds: [embed]
});
}
}
};

View file

@ -25,7 +25,10 @@ class Poll extends Command {
let mention = null;
const msg = await message.sendT("moderation/announcement:MENTION_PROMPT");
const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, {
const filter = m => m.author.id === message.author.id;
const collector = new Discord.MessageCollector(message.channel, {
filter,
time: 240000
});
@ -40,7 +43,10 @@ class Poll extends Command {
tmsg.delete();
msg.delete();
const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT");
const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, {
const filter = m => m.author.id === message.author.id;
const c = new Discord.MessageCollector(message.channel, {
filter,
time: 60000
});
@ -77,14 +83,19 @@ class Poll extends Command {
];
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("moderation/poll:TITLE"))
.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()
}));
message.channel.send(mention, embed).then(async (m) => {
message.channel.send({
content: mention,
embeds: [embed]
}).then(async (m) => {
await m.react(emojis[0]);
await m.react(emojis[1]);
});

View file

@ -27,25 +27,34 @@ class Sanctions extends Command {
});
const embed = new Discord.MessageEmbed()
.setAuthor(user.tag, user.displayAvatarURL({
.setAuthor({
name: user.tag,
iconURL: user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
})
})
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
.setFooter({
text: data.config.embed.footer
});
if (memberData.sanctions.length < 1) {
embed.setDescription(message.translate("moderation/sanctions:NO_SANCTION", {
username: user.tag
}));
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
} else {
memberData.sanctions.forEach((s) => {
embed.addField(s.type + " | #" + s.case, `${message.translate("common:MODERATOR")}: <@${s.moderator}>\n${message.translate("common:REASON")}: ${s.reason}`, true);
});
};
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -43,7 +43,7 @@ class Unban extends Command {
if (!user) return message.error("misc:NO_USER_FOUND_ID", { id: args[0] });
// check if the user is banned
const banned = await message.guild.fetchBans();
const banned = await message.guild.bans.fetch();
if (!banned.some((e) => e.user.id === user.id)) return message.success("moderation/unban:NOT_BANNED", { username: user.tag });
// Unban user

View file

@ -22,7 +22,7 @@ class Unmute extends Command {
const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
const memberData = await this.client.findOrCreateMember({
id: member.id,

View file

@ -31,7 +31,7 @@ class Warn extends Command {
const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
const reason = args.slice(1).join(" ");
if (!reason) return message.error("moderation/warn:MISSING_REASON");
@ -67,9 +67,11 @@ class Warn extends Command {
reason
}));
caseInfo.type = "ban";
embed.setAuthor(message.translate("moderation/ban:CASE", {
embed.setAuthor({
name: message.translate("moderation/ban:CASE", {
count: data.guild.casesCount
}))
})
})
.setColor("#e02316");
message.guild.members.ban(member).catch(() => {});
message.success("moderation/setwarns:AUTO_BAN", {
@ -88,9 +90,11 @@ class Warn extends Command {
reason
}));
caseInfo.type = "kick";
embed.setAuthor(message.translate("moderation/kick:CASE", {
embed.setAuthor({
name: message.translate("moderation/kick:CASE", {
count: data.guild.casesCount
}))
})
})
.setColor("#e88709");
member.kick().catch(() => {});
message.success("moderation/setwarns:AUTO_KICK", {
@ -107,9 +111,11 @@ class Warn extends Command {
reason
}));
caseInfo.type = "warn";
embed.setAuthor(message.translate("moderation/warn:CASE", {
embed.setAuthor({
name: message.translate("moderation/warn:CASE", {
caseNumber: data.guild.casesCount
}))
})
})
.setColor("#8c14e2");
message.success("moderation/warn:WARNED", {
username: member.user.tag,
@ -122,7 +128,9 @@ class Warn extends Command {
if (data.guild.plugins.modlogs) {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if (!channel) return;
channel.send(embed);
channel.send({
embeds: [embed]
});
};
}
};

View file

@ -26,16 +26,24 @@ class Back extends Command {
if (!queue.previousSongs[0]) return message.error("music/back:NO_PREV_SONG");
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("music/back:DESCRIPTION"))
.setAuthor({
name: message.translate("music/back:DESCRIPTION")
})
.setThumbnail(queue.tracks[0].thumbnail)
.setFooter(data.config.embed.footer)
.setColor(data.config.embed.color);
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
const m = await message.channel.send(embed);
const m = await message.channel.send({
embeds: [embed]
});
this.client.player.previous(message);
embed.setDescription(message.translate("music/back:SUCCESS"));
m.edit(embed);
m.edit({
embeds: [embed]
});
}
};

View file

@ -32,9 +32,13 @@ class Clips extends Command {
.setTitle(message.translate("music/clips:EMBED_TITLE"))
.setDescription(clips.join("\n"))
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer)
.setTimestamp()
message.channel.send(embed);
.setFooter({
text: data.config.embed.footer
})
.setTimestamp();
message.channel.send({
embeds: [embed]
});
});
}
};

View file

@ -39,7 +39,9 @@ class Filters extends Command {
.addField("** **", filtersStatuses[1].join("\n"), true)
.setColor(data.config.embed.color);
message.channel.send(list);
message.channel.send({
embeds: [list]
});
}
};

View file

@ -27,18 +27,26 @@ class Jump extends Command {
if (number < 0) return message.error("music/jump:NO_PREV_SONG", { prefix: data.guild.prefix });
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("music/jump:SUCCESS"))
.setAuthor({
name: message.translate("music/jump:SUCCESS")
})
.setThumbnail(queue.songs[number].thumbnail)
.setFooter(data.config.embed.footer)
.setFooter({
text: data.config.embed.footer
})
.setColor(data.config.embed.color);
const m = await message.channel.send(embed);
const m = await message.channel.send({
embeds: [embed]
});
this.client.player.jump(message, number);
embed.setDescription(message.translate("music/play:NOW_PLAYING", {
songName: queue.songs[number].name
}));
m.edit(embed);
m.edit({
embeds: [embed]
});
}
};

View file

@ -27,7 +27,9 @@ class Lyrics extends Command {
songName
}))
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
.setFooter({
text: data.config.embed.footer
});
try {
const songNameFormated = songName
@ -46,7 +48,9 @@ class Lyrics extends Command {
};
embed.setDescription(lyrics);
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
} catch (e) {
console.log(e);

View file

@ -39,18 +39,24 @@ class Np extends Command {
// Generate discord embed to display song informations
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("music/queue:TITLE"))
.setAuthor({
name: message.translate("music/queue:TITLE")
})
.setThumbnail(track.thumbnail)
.addField(message.translate("music/np:T_TITLE"), `[${track.name}](${track.url})`)
.addField(message.translate("music/np:T_CHANNEL"), track.uploader.name ? track.uploader.name : "Отсутствует")
.addField(message.translate("music/np:T_DURATION"), `${queue.formattedCurrentTime} / ${track.formattedDuration}`)
.addField(message.translate("music/np:T_CONF"), status(queue))
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer)
.setFooter({
text: data.config.embed.footer
})
.setTimestamp();
// Send the embed in the current channel
message.channel.send(embed);
message.channel.send({
embeds: [embed]
});
}
};

View file

@ -1,4 +1,5 @@
const Command = require("../../base/Command.js");
const Command = require("../../base/Command.js"),
{ Permissions } = require("discord.js");
class Play extends Command {
constructor(client) {
@ -24,7 +25,7 @@ class Play extends Command {
// Check my permissions
const perms = voice.permissionsFor(this.client.user);
if (!perms.has("CONNECT") || !perms.has("SPEAK")) return message.error("music/play:VOICE_CHANNEL_CONNECT");
if (!perms.has(Permissions.FLAGS.CONNECT) || !perms.has(Permissions.FLAGS.SPEAK)) return message.error("music/play:VOICE_CHANNEL_CONNECT");
try {
this.client.player.play(message, args.join(" "));

View file

@ -27,21 +27,29 @@ class Queue extends Command {
if (queue.songs.length === 1) {
const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("music/queue:TITLE"), message.guild.iconURL({
.setAuthor({
name: message.translate("music/queue:TITLE"),
iconURL: message.guild.iconURL({
dynamic: true
}))
})
})
.addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.songs[0].name}](${queue.songs[0].url})\n*Добавил ${queue.songs[0].member}*\n`)
.setColor(data.config.embed.color);
return message.channel.send(embed);
return message.channel.send({
embeds: [embed]
});
};
const FieldsEmbed = new Pagination.FieldsEmbed();
FieldsEmbed.embed
.setColor(data.config.embed.color)
.setAuthor(message.translate("music/queue:TITLE"), message.guild.iconURL({
.setAuthor({
name: message.translate("music/queue:TITLE"),
iconURL: message.guild.iconURL({
dynamic: true
}))
})
})
.addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.songs[0].name}](${queue.songs[0].url})\n*Добавил ${queue.songs[0].member}*\n`);
FieldsEmbed

View file

@ -20,15 +20,10 @@ class Seek extends Command {
async run(message, args) {
const voice = message.member.voice.channel;
const queue = this.client.player.getQueue(message);
<<<<<<< HEAD
=======
const time = ms(args[0]) / 1000;
>>>>>>> discordjs-13
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
if (!queue) return message.error("music/play:NOT_PLAYING");
const time = ms(args[0]) / 1000;
if (isNaN(time)) return message.error("music/seek:INVALID_TIME");
await this.client.player.seek(message, time);

Some files were not shown because too many files have changed in this diff Show more