diff --git a/assets/fonts/Burbank-Big-Condensed-Bold-Font.otf b/assets/fonts/Burbank-Big-Condensed-Bold-Font.otf deleted file mode 100644 index 86eb241d..00000000 Binary files a/assets/fonts/Burbank-Big-Condensed-Bold-Font.otf and /dev/null differ diff --git a/assets/fonts/LuckiestGuy-Regular.ttf b/assets/fonts/LuckiestGuy-Regular.ttf deleted file mode 100644 index 5ca663c2..00000000 Binary files a/assets/fonts/LuckiestGuy-Regular.ttf and /dev/null differ diff --git a/assets/fonts/RussoOne-Regular.ttf b/assets/fonts/RussoOne-Regular.ttf deleted file mode 100644 index c0236b05..00000000 Binary files a/assets/fonts/RussoOne-Regular.ttf and /dev/null differ diff --git a/assets/fonts/SketchMatch.ttf b/assets/fonts/SketchMatch.ttf deleted file mode 100644 index 8cfb5f77..00000000 Binary files a/assets/fonts/SketchMatch.ttf and /dev/null differ diff --git a/assets/fonts/theboldfont.ttf b/assets/fonts/theboldfont.ttf deleted file mode 100644 index 2985b05a..00000000 Binary files a/assets/fonts/theboldfont.ttf and /dev/null differ diff --git a/assets/img/greetings_background.png b/assets/img/greetings_background.png index 0ff9d27b..cc8d3d05 100644 Binary files a/assets/img/greetings_background.png and b/assets/img/greetings_background.png differ diff --git a/commands/Administration/goodbye.js b/commands/Administration/goodbye.js index f026bb2b..4dea22c7 100644 --- a/commands/Administration/goodbye.js +++ b/commands/Administration/goodbye.js @@ -88,7 +88,7 @@ class Goodbye extends Command { if (!goodbye.channel) { const channel = await Resolvers.resolveChannel({ message: msg, - channelType: "text" + channelType: "GUILD_TEXT" }); if (!channel) return message.error("misc:INVALID_CHANNEL"); diff --git a/dashboard/views/docs.ejs b/dashboard/views/docs.ejs index eced2f24..06411827 100644 --- a/dashboard/views/docs.ejs +++ b/dashboard/views/docs.ejs @@ -193,6 +193,17 @@
+ ----------------------------------------------------------------------------------------- + JaBa v3.2.6 + ----------------------------------------------------------------------------------------- + Исправления + - Команда goodbye снова работает. + + Изменено + - Новые карточки при входе и выходе пользователей + (Я не дизайнер, не бейте :( ). + - Обновлена локализация для карточек. + ----------------------------------------------------------------------------------------- JaBa v3.2.5 ----------------------------------------------------------------------------------------- diff --git a/events/guildCreate.js b/events/guildCreate.js index 0cc61eba..e84c2549 100644 --- a/events/guildCreate.js +++ b/events/guildCreate.js @@ -30,10 +30,14 @@ module.exports = class { }; const thanksEmbed = new Discord.MessageEmbed() - .setAuthor({ name: "Спасибо что добавили меня на свой сервер!" }) + .setAuthor({ + name: "Спасибо что добавили меня на свой сервер!" + }) .setDescription(`Для настроек используйте \`${data.config.prefix}help\` и посмотрите на административные команды!\nЧтобы изменить язык используйте \`${this.client.config.prefix}setlang [язык]\`.`) .setColor(data.config.embed.color) - .setFooter({ text: data.config.embed.footer }) + .setFooter({ + text: data.config.embed.footer + }) .setTimestamp(); messageOptions.embed = thanksEmbed; @@ -41,9 +45,11 @@ module.exports = class { const text = `Зашёл на сервер **${guild.name}**. На нём **${guild.members.cache.filter((m) => !m.user.bot).size}** пользователей (из них ${guild.members.cache.filter((m) => m.user.bot).size} ботов)`; - // Sends log embed in the logs channel const logsEmbed = new Discord.MessageEmbed() - .setAuthor({ name: guild.name, iconURL: guild.iconURL()}) + .setAuthor({ + name: guild.name, + iconURL: guild.iconURL() + }) .setColor("#32CD32") .setDescription(text); this.client.channels.cache.get(data.config.support.logs).send(logsEmbed); diff --git a/events/guildDelete.js b/events/guildDelete.js index 2a18490e..d0bd396f 100644 --- a/events/guildDelete.js +++ b/events/guildDelete.js @@ -10,7 +10,10 @@ module.exports = class { // Sends log embed in the logs channel const embed = new Discord.MessageEmbed() - .setAuthor({ name: guild.name, iconURL: guild.iconURL()}) + .setAuthor({ + name: guild.name, + iconURL: guild.iconURL() + }) .setColor("#B22222") .setDescription(text); this.client.channels.cache.get(this.client.config.support.logs).send(embed); diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js index 9d43acd2..e3557e1f 100644 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.js @@ -1,17 +1,17 @@ const Canvas = require("canvas"), Discord = require("discord.js"), - stringCleaner = require("@sindresorhus/slugify"), { resolve } = require("path"); // Register assets fonts Canvas.registerFont(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), { family: "RubikMonoOne" }); Canvas.registerFont(resolve("./assets/fonts/KeepCalm-Medium.ttf"), { family: "KeepCalm" }); -const applyText = (canvas, text, defaultFontSize) => { +const applyText = (canvas, text, defaultFontSize, width, font) => { const ctx = canvas.getContext("2d"); do { - ctx.font = `${defaultFontSize -= 10}px RubikMonoOne`; - } while (ctx.measureText(text).width > 600); + ctx.font = `${(defaultFontSize -= 1)}px ${font}`; + } while (ctx.measureText(text).width > width); + return ctx.font; }; @@ -58,92 +58,88 @@ module.exports = class { const canvas = Canvas.createCanvas(1024, 450), ctx = canvas.getContext("2d"); - // Background image + // Draw background const background = await Canvas.loadImage("./assets/img/greetings_background.png"); - - // This uses the canvas dimensions to stretch the image onto the entire canvas ctx.drawImage(background, 0, 0, canvas.width, canvas.height); + // Draw layer + ctx.fillStyle = "#FFFFFF"; + ctx.globalAlpha = "0.4"; + ctx.fillRect(0, 0, 25, canvas.height); + ctx.fillRect(canvas.width - 25, 0, 25, canvas.height); + ctx.fillRect(25, 0, canvas.width - 50, 25); + ctx.fillRect(25, canvas.height - 25, canvas.width - 50, 25); + ctx.fillStyle = "#FFFFFF"; + ctx.globalAlpha = "0.4"; + ctx.fillRect(344, canvas.height - 296, 625, 65); + ctx.fillStyle = "#FFFFFF"; + ctx.globalAlpha = "0.4"; + ctx.fillRect(389, canvas.height - 225, 138, 65); + ctx.fillStyle = "#FFFFFF"; + ctx.globalAlpha = "0.4"; + ctx.fillRect(308, canvas.height - 110, 672, 65); + // Draw username - ctx.fillStyle = "#ffffff"; - const username = stringCleaner(member.user.username, { - separator: " ", - lowercase: false, - decamelize: false, - preserveLeadingUnderscore: true, - }); - ctx.font = applyText(canvas, username, 50); - ctx.fillText(username, canvas.width - 660, canvas.height - 250); + ctx.globalAlpha = 1; + ctx.fillStyle = "#FFFFFF"; + ctx.font = applyText(canvas, member.user.username, 48, 600, "RubikMonoOne"); + ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250); // Draw server name ctx.font = applyText(canvas, member.guild.translate("administration/welcome:IMG_WELCOME", { server: member.guild.name - }), 53); + }), 53, 625, "RubikMonoOne"); + ctx.fillText(member.guild.translate("administration/welcome:IMG_WELCOME", { server: member.guild.name - }), canvas.width - 690, canvas.height - 85); + }), canvas.width - 700, canvas.height - 70); // Draw discriminator ctx.font = "35px RubikMonoOne"; - ctx.fillText(member.user.discriminator, canvas.width - 624, canvas.height - 180); + ctx.fillText(member.user.discriminator, canvas.width - 623, canvas.height - 178); - // Draw number + // Draw membercount ctx.font = "22px RubikMonoOne"; ctx.fillText(member.guild.translate("administration/welcome:IMG_NB", { memberCount: member.guild.memberCount - }), 50, canvas.height - 50); + }), 40, canvas.height - 35); // Draw # for discriminator - ctx.fillStyle = "#44d14a"; + ctx.fillStyle = "#FFFFFF"; ctx.font = "70px RubikMonoOne"; ctx.fillText("#", canvas.width - 690, canvas.height - 165); - // Draw Title with gradient - ctx.font = "65px RubikMonoOne"; - ctx.strokeStyle = "#1d2124"; - ctx.lineWidth = 15; + // Draw title + ctx.font = "45px RubikMonoOne"; + ctx.strokeStyle = "#000000"; + ctx.lineWidth = 10; ctx.strokeText(member.guild.translate("administration/welcome:TITLE"), canvas.width - 670, canvas.height - 330); - - var gradient = ctx.createLinearGradient(canvas.width - 780, 0, canvas.width - 30, 0); - gradient.addColorStop(0, "#e15500"); - gradient.addColorStop(1, "#e7b121"); - ctx.fillStyle = gradient; + ctx.fillStyle = "#FFFFFF"; ctx.fillText(member.guild.translate("administration/welcome:TITLE"), canvas.width - 670, canvas.height - 330); - // Pick up the pen + // Draw avatar circle ctx.beginPath(); - - //Define Stroke Line ctx.lineWidth = 10; - - //Define Stroke Style - ctx.strokeStyle = "#03A9F4"; - - // Start the arc to form a circle + ctx.strokeStyle = "#FFFFFF"; ctx.arc(180, 225, 135, 0, Math.PI * 2, true); - - // Draw Stroke ctx.stroke(); - - // Put the pen down ctx.closePath(); - - // Clip off the region you drew on ctx.clip(); - - const options = { - format: "png", - size: 512 - }, - avatar = await Canvas.loadImage(member.user.displayAvatarURL(options)); - - // Move the image downwards vertically and constrain its height to 200, so it"s a square + const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ + format: "png", + size: 512 + })); ctx.drawImage(avatar, 45, 90, 270, 270); const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "welcome-image.png"); - channel.send({ content: message, files: [attachment] }); + channel.send({ + content: message, + files: [attachment] + }); } else { - channel.send({ content: message }); + channel.send({ + content: message + }); }; }; }; diff --git a/events/guildMemberRemove.js b/events/guildMemberRemove.js index 0cff616a..ec5726ff 100644 --- a/events/guildMemberRemove.js +++ b/events/guildMemberRemove.js @@ -1,17 +1,17 @@ const Canvas = require("canvas"), Discord = require("discord.js"), - stringCleaner = require("@sindresorhus/slugify"), { resolve } = require("path"); // Register assets fonts -Canvas.registerFont(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), { family: "RubikMonoOne" }); +Canvas.registerFont(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), { family: "RubikMonoOne" }); Canvas.registerFont(resolve("./assets/fonts/KeepCalm-Medium.ttf"), { family: "KeepCalm" }); -const applyText = (canvas, text, defaultFontSize) => { +const applyText = (canvas, text, defaultFontSize, width, font) => { const ctx = canvas.getContext("2d"); do { - ctx.font = `${defaultFontSize -= 10}px RubikMonoOne`; - } while (ctx.measureText(text).width > 600); + ctx.font = `${(defaultFontSize -= 1)}px ${font}`; + } while (ctx.measureText(text).width > width); + return ctx.font; }; @@ -41,91 +41,88 @@ module.exports = class { const canvas = Canvas.createCanvas(1024, 450), ctx = canvas.getContext("2d"); - // Background image + // Draw background const background = await Canvas.loadImage("./assets/img/greetings_background.png"); - - // This uses the canvas dimensions to stretch the image onto the entire canvas ctx.drawImage(background, 0, 0, canvas.width, canvas.height); + // Draw layer + ctx.fillStyle = "#FFFFFF"; + ctx.globalAlpha = "0.4"; + ctx.fillRect(0, 0, 25, canvas.height); + ctx.fillRect(canvas.width - 25, 0, 25, canvas.height); + ctx.fillRect(25, 0, canvas.width - 50, 25); + ctx.fillRect(25, canvas.height - 25, canvas.width - 50, 25); + ctx.fillStyle = "#FFFFFF"; + ctx.globalAlpha = "0.4"; + ctx.fillRect(344, canvas.height - 296, 625, 65); + ctx.fillStyle = "#FFFFFF"; + ctx.globalAlpha = "0.4"; + ctx.fillRect(389, canvas.height - 225, 138, 65); + ctx.fillStyle = "#FFFFFF"; + ctx.globalAlpha = "0.4"; + ctx.fillRect(308, canvas.height - 110, 672, 65); + // Draw username - ctx.fillStyle = "#ffffff"; - const username = stringCleaner(member.user.username, { - separator: " ", - lowercase: false, - decamelize: false, - preserveLeadingUnderscore: true, - }); - ctx.font = applyText(canvas, username, 50); - ctx.fillText(username, canvas.width - 660, canvas.height - 250); + ctx.globalAlpha = 1; + ctx.fillStyle = "#FFFFFF"; + ctx.font = applyText(canvas, member.user.username, 48, 600, "RubikMonoOne"); + ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250); // Draw server name ctx.font = applyText(canvas, member.guild.translate("administration/goodbye:IMG_GOODBYE", { server: member.guild.name - }), 53); + }), 53, 625, "RubikMonoOne"); + ctx.fillText(member.guild.translate("administration/goodbye:IMG_GOODBYE", { server: member.guild.name - }), canvas.width - 690, canvas.height - 65); + }), canvas.width - 700, canvas.height - 70); // Draw discriminator ctx.font = "35px RubikMonoOne"; - ctx.fillText(member.user.discriminator, canvas.width - 624, canvas.height - 180); - // Draw number + ctx.fillText(member.user.discriminator, canvas.width - 623, canvas.height - 178); + + // Draw membercount ctx.font = "22px RubikMonoOne"; ctx.fillText(member.guild.translate("administration/goodbye:IMG_NB", { memberCount: member.guild.memberCount - }), 50, canvas.height - 50); + }), 40, canvas.height - 35); // Draw # for discriminator - ctx.fillStyle = "#44d14a"; + ctx.fillStyle = "#FFFFFF"; ctx.font = "70px RubikMonoOne"; ctx.fillText("#", canvas.width - 690, canvas.height - 165); - // Draw Title with gradient - ctx.font = "65px RubikMonoOne"; - ctx.strokeStyle = "#1d2124"; - ctx.lineWidth = 15; + // Draw title + ctx.font = "45px RubikMonoOne"; + ctx.strokeStyle = "#000000"; + ctx.lineWidth = 10; ctx.strokeText(member.guild.translate("administration/goodbye:TITLE"), canvas.width - 670, canvas.height - 330); - - var gradient = ctx.createLinearGradient(canvas.width - 780, 0, canvas.width - 30, 0); - gradient.addColorStop(0, "#e15500"); - gradient.addColorStop(1, "#e7b121"); - ctx.fillStyle = gradient; + ctx.fillStyle = "#FFFFFF"; ctx.fillText(member.guild.translate("administration/goodbye:TITLE"), canvas.width - 670, canvas.height - 330); - // Pick up the pen + // Draw avatar circle ctx.beginPath(); - - //Define Stroke Line ctx.lineWidth = 10; - - //Define Stroke Style - ctx.strokeStyle = "#df0909"; - - // Start the arc to form a circle + ctx.strokeStyle = "#FFFFFF"; ctx.arc(180, 225, 135, 0, Math.PI * 2, true); - - // Draw Stroke ctx.stroke(); - - // Put the pen down ctx.closePath(); - - // Clip off the region you drew on ctx.clip(); - - const options = { - format: "png", - size: 512 - }, - avatar = await Canvas.loadImage(member.user.displayAvatarURL(options)); - - // Move the image downwards vertically and constrain its height to 200, so it"s a square + const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ + format: "png", + size: 512 + })); ctx.drawImage(avatar, 45, 90, 270, 270); const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "goodbye-image.png"); - channel.send({ content: message, files: [attachment] }); + channel.send({ + content: message, + files: [attachment] + }); } else { - channel.send({ content: message }); + channel.send({ + content: message + }); }; }; }; diff --git a/events/messageCreate.js b/events/messageCreate.js index 86404d0e..5f3fcbab 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -59,10 +59,8 @@ module.exports = class { if (uSlowmode) { 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, + time: message.convertTime(uSlowmode.time, "to", true), channel: message.channel.toString() })); } else { @@ -137,20 +135,14 @@ module.exports = class { 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 (!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 (!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(", ") }); diff --git a/languages/ru-RU/administration/goodbye.json b/languages/ru-RU/administration/goodbye.json index a0a4ef4d..15d1574e 100644 --- a/languages/ru-RU/administration/goodbye.json +++ b/languages/ru-RU/administration/goodbye.json @@ -11,7 +11,7 @@ "FORM_SUCCESS": "**Готово!**\n\n:arrow_right_hook: *Используйте `{{prefix}}goodbye test` для предпросмотра вашего сообщения!*", "MAX_CHARACT": "Ваше сообщение не должно быть больше 1800 символов!", "DISABLED": "**Сообщения отключены!**\n\n:arrow_right_hook: *Используйте `{{prefix}}configuration`, чтобы увидеть обновлённые настройки!*", - "IMG_GOODBYE": "Вышел с сервера {{server}}!", + "IMG_GOODBYE": "Вышел с {{server}}!", "IMG_NB": "{{memberCount}} участников!", - "TITLE": "Прощание" + "TITLE": "До встречи!" } \ No newline at end of file diff --git a/languages/ru-RU/administration/welcome.json b/languages/ru-RU/administration/welcome.json index 1f3705e0..9078b8cb 100644 --- a/languages/ru-RU/administration/welcome.json +++ b/languages/ru-RU/administration/welcome.json @@ -11,7 +11,7 @@ "FORM_SUCCESS": "**Готово!**\n\n:arrow_right_hook: *Используйте `{{prefix}}welcome test` для предпросмотра вашего приветственного сообщения!*", "MAX_CHARACT": "Ваше сообщение не должно быть больше 1800 символов!", "DISABLED": "**Сообщения отключены!**\n\n:arrow_right_hook: *Используйте `{{prefix}}configuration`, чтобы увидеть обновлённые настройки!*", - "IMG_WELCOME": "Добро пожаловать на сервер {{server}}!", + "IMG_WELCOME": "Добро пожаловать на {{server}}!", "IMG_NB": "{{memberCount}}й участник!", - "TITLE": "Приветствие" + "TITLE": "Добро пожаловать!" } \ No newline at end of file diff --git a/package.json b/package.json index c0cd3b46..22bcf908 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jaba", - "version": "3.2.5", + "version": "3.2.6", "description": "A very complete Discord bot (more than 100 commands) that uses the Discord.js", "main": "index.js", "private": true, @@ -31,12 +31,11 @@ "cron": "^1.7.2", "dblapi.js": "^2.3.0", "discord-backup": "^3.0.1", - "discord-canvas": "^1.3.2", "discord-giveaways": "github:Androz2091/discord-giveaways#develop", "discord-paginationembed": "github:gazmull/discord-paginationembed#v3", "discord-together": "^1.3.25", - "discord.js": "^13.5.0", - "distube": "^3.0.5", + "discord.js": "^13.5.1", + "distube": "^3.0.7", "ejs": "^3.1.3", "express": "^4.17.1", "express-session": "^1.17.0",