Новые карточки
Фикс goodbye
Удалены лишние шрифты
This commit is contained in:
JonnyBro 2022-01-11 02:18:39 +05:00
parent d48719612a
commit b079cfaabc
16 changed files with 141 additions and 137 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

@ -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");

View file

@ -193,6 +193,17 @@
<div class="row">
<div class="col-md-12">
<pre class="brush: html">
-----------------------------------------------------------------------------------------
JaBa v3.2.6
-----------------------------------------------------------------------------------------
Исправления
- Команда goodbye снова работает.
Изменено
- Новые карточки при входе и выходе пользователей
(Я не дизайнер, не бейте :( ).
- Обновлена локализация для карточек.
-----------------------------------------------------------------------------------------
JaBa v3.2.5
-----------------------------------------------------------------------------------------

View file

@ -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);

View file

@ -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);

View file

@ -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
});
};
};
};

View file

@ -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
});
};
};
};

View file

@ -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(", ") });

View file

@ -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": "До встречи!"
}

View file

@ -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": "Добро пожаловать!"
}

View file

@ -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",