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