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
|
@ -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");
|
||||||
|
|
Loading…
Reference in a new issue