mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-24 22:24:58 +05:00
Чистка
This commit is contained in:
parent
dcea3731f3
commit
44c9cf958b
25 changed files with 47 additions and 83 deletions
|
@ -36,7 +36,7 @@ class Backup extends Command {
|
|||
Sentry.captureException(err);
|
||||
return message.error("misc:ERR_OCCURRED");
|
||||
});
|
||||
} else if (status === "load"){
|
||||
} else if (status === "load") {
|
||||
const backupID = args[1];
|
||||
if (!backupID) return message.error("administration/backup:MISSING_BACKUP_ID");
|
||||
|
||||
|
@ -68,7 +68,7 @@ class Backup extends Command {
|
|||
backupID
|
||||
});
|
||||
});
|
||||
} else if (status === "info"){
|
||||
} else if (status === "info") {
|
||||
const backupID = args[1];
|
||||
if (!backupID) return message.error("administration/backup:MISSING_BACKUP_ID");
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class Slots extends Command {
|
|||
|
||||
amount = Math.round(amount);
|
||||
|
||||
function getCredits(number, isJackpot){
|
||||
function getCredits(number, isJackpot) {
|
||||
if (!isJackpot) {
|
||||
number = number * 1.5;
|
||||
} else if (isJackpot) {
|
||||
|
|
|
@ -46,7 +46,7 @@ class FindWords extends Command {
|
|||
currentGames[message.guild.id] = true; // Update current game variable
|
||||
generateGame.call(this, words[i]); // Generate a new round
|
||||
|
||||
function generateGame(word){
|
||||
function generateGame(word) {
|
||||
word = word.toLowerCase();
|
||||
|
||||
// Launch timer
|
||||
|
@ -107,8 +107,8 @@ class FindWords extends Command {
|
|||
}, delay);
|
||||
};
|
||||
|
||||
async function getWinner(array){
|
||||
return new Promise(function (resolve){
|
||||
async function getWinner(array) {
|
||||
return new Promise(function (resolve) {
|
||||
const counts = {};
|
||||
let compare = 0;
|
||||
let mostFrequent;
|
||||
|
@ -119,7 +119,7 @@ class FindWords extends Command {
|
|||
} else {
|
||||
counts[winner] = counts[winner] + 1;
|
||||
};
|
||||
if (counts[winner] > compare){
|
||||
if (counts[winner] > compare) {
|
||||
compare = counts[winner];
|
||||
mostFrequent = array[i];
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@ class Hastebin extends Command {
|
|||
.setDescription(url)
|
||||
.setColor(data.config.embed.color);
|
||||
message.channel.send(embed);
|
||||
} catch(e){
|
||||
} catch(e) {
|
||||
message.error("misc:ERR_OCCURRED");
|
||||
};
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class Quote extends Command {
|
|||
}
|
||||
|
||||
async run (message, args, data) {
|
||||
function embed(m){
|
||||
function embed(m) {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setAuthor(m.author.tag, m.author.displayAvatarURL({ size: 512, dynamic: true, format: 'png' }))
|
||||
.setDescription(m.content)
|
||||
|
|
|
@ -30,7 +30,7 @@ class Bed extends Command {
|
|||
const attachment = new Discord.MessageAttachment(buffer, "bed.png");
|
||||
message.channel.send(attachment);
|
||||
m.delete();
|
||||
} catch(e){
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
m.error("misc:ERROR_OCCURRED", null, { edit: true });
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ class Captcha extends Command {
|
|||
const attachment = new Discord.MessageAttachment(json.message, "captcha.png");
|
||||
message.channel.send(attachment);
|
||||
m.delete();
|
||||
} catch(e){
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
m.error("misc:ERR_OCCURRED", null, {
|
||||
edit: true
|
||||
|
|
|
@ -30,7 +30,7 @@ class Clyde extends Command {
|
|||
const attachment = new Discord.MessageAttachment(json.message, "clyde.png");
|
||||
message.channel.send(attachment);
|
||||
m.delete();
|
||||
} catch(e){
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
m.error("misc:ERROR_OCCURRED", null, { edit: true });
|
||||
};
|
||||
|
|
|
@ -31,7 +31,7 @@ class Love extends Command {
|
|||
const attachment = new Discord.MessageAttachment(json.message, "love.png");
|
||||
message.channel.send(attachment);
|
||||
m.delete();
|
||||
} catch(e){
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
m.error("misc:ERROR_OCCURRED", null, { edit: true });
|
||||
};
|
||||
|
|
|
@ -42,7 +42,7 @@ class Phcomment extends Command {
|
|||
const attachment = new Discord.MessageAttachment(buffer, "phcomment.png");
|
||||
message.channel.send(attachment);
|
||||
m.delete();
|
||||
} catch(e){
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
m.error("misc:ERROR_OCCURRED", null, { edit: true });
|
||||
};
|
||||
|
|
|
@ -58,7 +58,7 @@ class Clear extends Command {
|
|||
toDelete = await message.success("moderation/clear:CLEARED", { amount: --amount });
|
||||
};
|
||||
|
||||
setTimeout(function(){
|
||||
setTimeout(function() {
|
||||
toDelete.delete();
|
||||
}, 2000);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class Giveaway extends Command {
|
|||
}).then(() => {
|
||||
message.success("moderation/giveaway:GIVEAWAY_CREATED");
|
||||
});
|
||||
} else if(status === "reroll"){
|
||||
} else if (status === "reroll") {
|
||||
const messageID = args[1];
|
||||
if (!messageID)return message.error("moderation/giveaway:MISSING_ID");
|
||||
|
||||
|
@ -72,23 +72,23 @@ class Giveaway extends Command {
|
|||
}).catch(() => {
|
||||
return message.error("moderation/giveaway:NOT_FOUND_ENDED", { messageID });
|
||||
});
|
||||
} else if(status === "delete"){
|
||||
} else if (status === "delete") {
|
||||
const messageID = args[1];
|
||||
if(!messageID) return message.error("moderation/giveaway:MISSING_ID");
|
||||
if (!messageID) return message.error("moderation/giveaway:MISSING_ID");
|
||||
|
||||
this.client.giveawaysManager.delete(messageID).then(() => {
|
||||
return message.success("moderation/giveaway:GIVEAWAY_DELETED");
|
||||
}).catch(() => {
|
||||
return message.error("moderation/giveaway:NOT_FOUND", { messageID });
|
||||
});
|
||||
} else if(status === "end"){
|
||||
} else if (status === "end") {
|
||||
const messageID = args[1];
|
||||
if (!messageID) return message.error("moderation/giveaway:MISSING_ID");
|
||||
|
||||
try {
|
||||
this.client.giveawaysManager.edit(messageID, { setEndTimestamp: Date.now() });
|
||||
return message.success("moderation/giveaway:GIVEAWAY_ENDED");
|
||||
} catch(e){
|
||||
} catch(e) {
|
||||
return message.error("moderation/giveaway:NOT_FOUND", { messageID });
|
||||
};
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,7 @@ class Setwarns extends Command {
|
|||
data.guild.markModified("plugins.warnsSanctions");
|
||||
data.guild.save();
|
||||
return message.success("moderation/setwarns:SUCCESS_KICK_RESET", { prefix: data.guild.prefix, count: number });
|
||||
} else if(sanction === "ban") {
|
||||
} else if (sanction === "ban") {
|
||||
data.guild.plugins.warnsSanctions.ban = false;
|
||||
data.guild.markModified("plugins.warnsSanctions");
|
||||
data.guild.save();
|
||||
|
|
|
@ -30,7 +30,7 @@ class Unban extends Command {
|
|||
// if a user was found
|
||||
user = u;
|
||||
}).catch(() => {});
|
||||
} else if(!isId) {
|
||||
} else if (!isId) {
|
||||
const arr = args[0].split("#");
|
||||
if (arr.length < 2) {
|
||||
return message.error("misc:NO_USER_FOUND_ID", {
|
||||
|
|
|
@ -88,7 +88,7 @@ class Warn extends Command {
|
|||
|
||||
if (data.guild.plugins.modlogs) {
|
||||
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
|
||||
if(!channel) return;
|
||||
if (!channel) return;
|
||||
channel.send(embed);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class Lyrics extends Command {
|
|||
embed.setDescription(lyrics);
|
||||
message.channel.send(embed);
|
||||
|
||||
} catch(e){
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
message.error("music/lyrics:NO_LYRICS_FOUND", { songName });
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ const Canvas = require("canvas"),
|
|||
|
||||
// Register assets fonts
|
||||
Canvas.registerFont(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), { family: "Regular" });
|
||||
// Canvas.registerFont(resolve("./assets/fonts/RussoOne-Regular.ttf"), { family: "Regular" });
|
||||
|
||||
const applyText = (canvas, text, defaultFontSize) => {
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
|
|
@ -5,7 +5,6 @@ const Canvas = require("canvas"),
|
|||
|
||||
// Register assets fonts
|
||||
Canvas.registerFont(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), { family: "Regular" });
|
||||
// Canvas.registerFont(resolve("./assets/fonts/RussoOne-Regular.ttf"), { family: "Regular" });
|
||||
|
||||
const applyText = (canvas, text, defaultFontSize) => {
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
|
|
@ -5,8 +5,8 @@ module.exports = class {
|
|||
|
||||
async run (oldMember, newMember) {
|
||||
if (oldMember.guild.id !== this.client.config.support.id) return;
|
||||
if (oldMember.roles.cache.some((r) => r.name === "Поддержавшие")) return;
|
||||
if (newMember.roles.cache.some((r) => r.name === "Поддержавшие")) {
|
||||
if (oldMember.roles.cache.some((r) => r.name === "Поддержавшие JaBa")) return;
|
||||
if (newMember.roles.cache.some((r) => r.name === "Поддержавшие JaBa")) {
|
||||
const userData = await this.client.findOrCreateUser({ id: newMember.id });
|
||||
userData.achievements.tip.progress.now = 1;
|
||||
userData.achievements.tip.achieved = true;
|
||||
|
|
|
@ -27,14 +27,9 @@ module.exports = class {
|
|||
// Check if the bot was mentionned
|
||||
if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) {
|
||||
if (message.guild) {
|
||||
return message.sendT("misc:HELLO_SERVER", {
|
||||
username: message.author.username,
|
||||
prefix: data.guild.prefix
|
||||
});
|
||||
return message.sendT("misc:HELLO_SERVER", { username: message.author.username, prefix: data.guild.prefix });
|
||||
} else {
|
||||
return message.sendT("misc:HELLO_DM", {
|
||||
username: message.author.username
|
||||
});
|
||||
return message.sendT("misc:HELLO_DM", { username: message.author.username });
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -60,10 +55,7 @@ module.exports = class {
|
|||
if (uSlowmode.time > Date.now()) {
|
||||
message.delete();
|
||||
const delay = message.convertTime(uSlowmode.time, "to", true);
|
||||
return message.author.send(message.translate("administration/slowmode:PLEASE_WAIT", {
|
||||
time: delay,
|
||||
channel: message.channel.toString()
|
||||
}));
|
||||
return message.author.send(message.translate("administration/slowmode:PLEASE_WAIT", { time: delay, channel: message.channel.toString() }));
|
||||
} else {
|
||||
uSlowmode.time = channelSlowmode.time + Date.now();
|
||||
};
|
||||
|
@ -83,9 +75,7 @@ module.exports = class {
|
|||
if (!message.channel.permissionsFor(message.member).has("MANAGE_MESSAGES")) {
|
||||
message.delete();
|
||||
message.author.send("```" + message.content + "```");
|
||||
return message.error("administration/automod:DELETED", {
|
||||
username: message.author.tag
|
||||
});
|
||||
return message.error("administration/automod:DELETED", { username: message.author.tag });
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -94,18 +84,13 @@ module.exports = class {
|
|||
if (afkReason) {
|
||||
data.userData.afk = null;
|
||||
await data.userData.save();
|
||||
message.sendT("general/setafk:DELETED", {
|
||||
username: message.author.username
|
||||
});
|
||||
message.sendT("general/setafk:DELETED", { username: message.author.username });
|
||||
};
|
||||
|
||||
message.mentions.users.forEach(async (u) => {
|
||||
const userData = await client.findOrCreateUser({ id: u.id });
|
||||
if (userData.afk) {
|
||||
message.error("general/setafk:IS_AFK", {
|
||||
user: u.tag,
|
||||
reason: userData.afk
|
||||
});
|
||||
message.error("general/setafk:IS_AFK", { user: u.tag, reason: userData.afk });
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -122,17 +107,11 @@ module.exports = class {
|
|||
const customCommandAnswer = customCommand ? customCommand.answer : "";
|
||||
|
||||
if (!cmd && !customCommandAnswer && message.guild) return;
|
||||
else if (!cmd && !customCommandAnswer && !message.guild) {
|
||||
return message.sendT("misc:HELLO_DM", {
|
||||
username: message.author.username
|
||||
});
|
||||
};
|
||||
else if (!cmd && !customCommandAnswer && !message.guild) return message.sendT("misc:HELLO_DM", { username: message.author.username });
|
||||
|
||||
if (message.guild && data.guild.ignoredChannels.includes(message.channel.id) && !message.member.hasPermission("MANAGE_MESSAGES")) {
|
||||
message.delete();
|
||||
message.author.send(message.translate("misc:RESTRICTED_CHANNEL", {
|
||||
channel: message.channel.toString()
|
||||
}));
|
||||
message.author.send(message.translate("misc:RESTRICTED_CHANNEL", { channel: message.channel.toString() }));
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -142,30 +121,21 @@ module.exports = class {
|
|||
|
||||
if (message.guild) {
|
||||
let neededPermissions = [];
|
||||
if (!cmd.conf.botPermissions.includes("EMBED_LINKS")) {
|
||||
cmd.conf.botPermissions.push("EMBED_LINKS");
|
||||
};
|
||||
if (!cmd.conf.botPermissions.includes("EMBED_LINKS")) cmd.conf.botPermissions.push("EMBED_LINKS");
|
||||
cmd.conf.botPermissions.forEach((perm) => {
|
||||
if (!message.channel.permissionsFor(message.guild.me).has(perm)) {
|
||||
neededPermissions.push(perm);
|
||||
};
|
||||
});
|
||||
if (neededPermissions.length > 0) {
|
||||
return message.error("misc:MISSING_BOT_PERMS", {
|
||||
list: neededPermissions.map((p) => `\`${p}\``).join(", ")
|
||||
});
|
||||
};
|
||||
if (neededPermissions.length > 0) return message.error("misc:MISSING_BOT_PERMS", { list: neededPermissions.map((p) => `\`${p}\``).join(", ") });
|
||||
|
||||
neededPermissions = [];
|
||||
cmd.conf.memberPermissions.forEach((perm) => {
|
||||
if (!message.channel.permissionsFor(message.member).has(perm)) {
|
||||
neededPermissions.push(perm);
|
||||
};
|
||||
});
|
||||
if (neededPermissions.length > 0) {
|
||||
return message.error("misc:MISSING_MEMBER_PERMS", {
|
||||
list: neededPermissions.map((p) => `\`${p}\``).join(", ")
|
||||
});
|
||||
};
|
||||
if (neededPermissions.length > 0) return message.error("misc:MISSING_MEMBER_PERMS", { list: neededPermissions.map((p) => `\`${p}\``).join(", ") });
|
||||
if (!message.channel.permissionsFor(message.member).has("MENTION_EVERYONE") && (message.content.includes("@everyone") || message.content.includes("@here"))) return message.error("misc:EVERYONE_MENTION");
|
||||
if (!message.channel.nsfw && cmd.conf.nsfw) return message.error("misc:NSFW_COMMAND");
|
||||
};
|
||||
|
@ -180,11 +150,7 @@ module.exports = class {
|
|||
uCooldown = cmdCooldown[message.author.id];
|
||||
};
|
||||
const time = uCooldown[cmd.help.name] || 0;
|
||||
if (time && (time > Date.now())) {
|
||||
return message.error("misc:COOLDOWNED", {
|
||||
seconds: Math.ceil((time-Date.now())/1000)
|
||||
});
|
||||
};
|
||||
if (time && (time > Date.now())) return message.error("misc:COOLDOWNED", { seconds: Math.ceil((time-Date.now())/1000) });
|
||||
cmdCooldown[message.author.id][cmd.help.name] = Date.now() + cmd.conf.cooldown;
|
||||
|
||||
client.logger.log(`${message.author.username} (${message.author.id}) ran command ${cmd.help.name} on ${message.guild.name}`, "cmd");
|
||||
|
|
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
client.databaseCache.usersReminds.set(user.id, user);
|
||||
};
|
||||
});
|
||||
setInterval(async function(){
|
||||
setInterval(async function() {
|
||||
const dateNow = Date.now();
|
||||
client.databaseCache.usersReminds.forEach(async (user) => {
|
||||
const dUser = client.users.cache.get(user.id);
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
* Starts checking...
|
||||
* @param {object} client The Discord Client instance
|
||||
*/
|
||||
async init(client){
|
||||
async init(client) {
|
||||
client.membersData.find({ "mute.muted": true }).then((members) => {
|
||||
members.forEach((member) => {
|
||||
client.databaseCache.mutedUsers.set(`${member.id}${member.guildID}`, member);
|
||||
|
|
|
@ -6,10 +6,10 @@ module.exports = {
|
|||
* Starts to post stats to DBL
|
||||
* @param {object} client The Discord Client instance
|
||||
*/
|
||||
init(client){
|
||||
init(client) {
|
||||
if (client.config.apiKeys.dbl && client.config.apiKeys.dbl !== "") {
|
||||
const stats = new DBL(client.config.apiKeys.dbl, client);
|
||||
setInterval(function(){
|
||||
setInterval(function() {
|
||||
stats.postStats(client.guilds.cache.size);
|
||||
}, 10 * 60000); // every 10 minutes
|
||||
const dbl = new DBL(client.config.apiKeys.dbl, { webhookPort: client.config.votes.port, webhookAuth: client.config.votes.password });
|
||||
|
|
|
@ -3,7 +3,7 @@ Logger class for easy and aesthetically pleasing console logging
|
|||
*/
|
||||
const { bgBlue, black, green } = require("chalk");
|
||||
|
||||
function dateTimePad(value, digits){
|
||||
function dateTimePad(value, digits) {
|
||||
let number = value;
|
||||
while (number.toString().length < digits) {
|
||||
number = "0" + number;
|
||||
|
@ -11,7 +11,7 @@ function dateTimePad(value, digits){
|
|||
return number;
|
||||
};
|
||||
|
||||
function format(tDate){
|
||||
function format(tDate) {
|
||||
return (tDate.getFullYear() + "-" +
|
||||
dateTimePad((tDate.getMonth() + 1), 2) + "-" +
|
||||
dateTimePad(tDate.getDate(), 2) + " " +
|
||||
|
|
|
@ -121,7 +121,7 @@ const checks = [
|
|||
}
|
||||
});
|
||||
const result = await res.json();
|
||||
if(result.status && result.status === 401){
|
||||
if (result.status && result.status === 401) {
|
||||
error("should be a valid FNBR key", "get your key here: https://fnbr.co/api/docs");
|
||||
} else {
|
||||
success("should be a valid FNBR key");
|
||||
|
@ -179,7 +179,7 @@ const checks = [
|
|||
|
||||
(async () => {
|
||||
console.log(chalk.yellow("This script will check if your config is errored, and some other important things such as whether your database is started, etc..."));
|
||||
for (const check of checks){
|
||||
for (const check of checks) {
|
||||
await check();
|
||||
};
|
||||
console.log(chalk.yellow("\n\nThank you for using Atlanta. If you need more help, join our support server here: https://discord.atlanta-bot.fr"));
|
||||
|
|
Loading…
Reference in a new issue