Compare commits

...

2 commits

Author SHA1 Message Date
8b677f9ec4
v4.6.1 2024-06-23 18:01:23 +05:00
0e38d2086c
Fix welcome/goodbye saving
Remove images (fonts are broken)
2024-06-23 18:00:59 +05:00
6 changed files with 50 additions and 38 deletions

View file

@ -61,16 +61,16 @@ class Goodbye extends BaseCommand {
uk: client.translate("administration/goodbye:MESSAGE", null, "uk-UA"),
ru: client.translate("administration/goodbye:MESSAGE", null, "ru-RU"),
}),
)
.addBooleanOption(option =>
option
.setName("image")
.setDescription(client.translate("administration/goodbye:IMAGE"))
.setDescriptionLocalizations({
uk: client.translate("administration/goodbye:IMAGE", null, "uk-UA"),
ru: client.translate("administration/goodbye:IMAGE", null, "ru-RU"),
}),
),
// .addBooleanOption(option =>
// option
// .setName("image")
// .setDescription(client.translate("administration/goodbye:IMAGE"))
// .setDescriptionLocalizations({
// uk: client.translate("administration/goodbye:IMAGE", null, "uk-UA"),
// ru: client.translate("administration/goodbye:IMAGE", null, "ru-RU"),
// }),
// ),
),
dirname: __dirname,
ownerOnly: false,
@ -103,13 +103,14 @@ class Goodbye extends BaseCommand {
withImage: null,
};
await guildData.markModified("plugins.goodbye");
await guildData.save();
interaction.success("administration/goodbye:DISABLED", null, { edit: true });
} else {
const channel = interaction.options.getChannel("channel") || interaction.channel;
const message = interaction.options.getString("message") || interaction.translate("administration/goodbye:DEFAULT_MESSAGE");
const image = interaction.options.getBoolean("image") || false;
const image = false; // interaction.options.getBoolean("image") || false;
guildData.plugins.goodbye = {
enabled: true,
@ -118,6 +119,7 @@ class Goodbye extends BaseCommand {
withImage: image,
};
await guildData.markModified("plugins.goodbye");
await guildData.save();
interaction.success("administration/goodbye:ENABLED", {

View file

@ -61,16 +61,16 @@ class Welcome extends BaseCommand {
uk: client.translate("administration/goodbye:MESSAGE", null, "uk-UA"),
ru: client.translate("administration/goodbye:MESSAGE", null, "ru-RU"),
}),
)
.addBooleanOption(option =>
option
.setName("image")
.setDescription(client.translate("administration/goodbye:IMAGE"))
.setDescriptionLocalizations({
uk: client.translate("administration/goodbye:IMAGE", null, "uk-UA"),
ru: client.translate("administration/goodbye:IMAGE", null, "ru-RU"),
}),
),
// .addBooleanOption(option =>
// option
// .setName("image")
// .setDescription(client.translate("administration/goodbye:IMAGE"))
// .setDescriptionLocalizations({
// uk: client.translate("administration/goodbye:IMAGE", null, "uk-UA"),
// ru: client.translate("administration/goodbye:IMAGE", null, "ru-RU"),
// }),
// ),
),
dirname: __dirname,
ownerOnly: false,
@ -103,13 +103,14 @@ class Welcome extends BaseCommand {
withImage: null,
};
await guildData.markModified("plugins.welcome");
await guildData.save();
interaction.success("administration/welcome:DISABLED", null);
} else {
const channel = interaction.options.getChannel("channel") || interaction.channel;
const message = interaction.options.getString("message") || interaction.translate("administration/welcome:DEFAULT_MESSAGE");
const image = interaction.options.getBoolean("image") || false;
const image = false; // interaction.options.getBoolean("image") || false;
guildData.plugins.welcome = {
enabled: true,
@ -118,6 +119,7 @@ class Welcome extends BaseCommand {
withImage: image,
};
await guildData.markModified("plugins.welcome");
await guildData.save();
interaction.success("administration/welcome:ENABLED", {

View file

@ -1,7 +1,9 @@
const Canvas = require("@napi-rs/canvas"),
BaseEvent = require("../../base/BaseEvent"),
{ AttachmentBuilder } = require("discord.js"),
{ applyText } = require("../../helpers/functions");
// const Canvas = require("@napi-rs/canvas"),
// BaseEvent = require("../../base/BaseEvent"),
// { AttachmentBuilder } = require("discord.js"),
// { applyText } = require("../../helpers/functions");
const BaseEvent = require("../../base/BaseEvent");
class GuildMemberAdd extends BaseEvent {
constructor() {
@ -34,6 +36,7 @@ class GuildMemberAdd extends BaseEvent {
.replace(/{server}/g, member.guild.name)
.replace(/{membercount}/g, member.guild.memberCount);
/*
if (guildData.plugins.welcome.withImage) {
const canvas = Canvas.createCanvas(1024, 450),
ctx = canvas.getContext("2d");
@ -127,8 +130,9 @@ class GuildMemberAdd extends BaseEvent {
content: message,
files: [attachment],
});
} else
channel.send({ content: message });
} else */
channel.send({ content: message });
}
}
}

View file

@ -1,7 +1,9 @@
const Canvas = require("@napi-rs/canvas"),
BaseEvent = require("../../base/BaseEvent"),
{ AttachmentBuilder } = require("discord.js"),
{ applyText } = require("../../helpers/functions");
// const Canvas = require("@napi-rs/canvas"),
// BaseEvent = require("../../base/BaseEvent"),
// { AttachmentBuilder } = require("discord.js"),
// { applyText } = require("../../helpers/functions");
const BaseEvent = require("../../base/BaseEvent");
class GuildMemberRemove extends BaseEvent {
constructor() {
@ -32,6 +34,7 @@ class GuildMemberRemove extends BaseEvent {
.replace(/{server}/g, member.guild.name)
.replace(/{membercount}/g, member.guild.memberCount);
/*
if (guildData.plugins.goodbye.withImage) {
const canvas = Canvas.createCanvas(1024, 450),
ctx = canvas.getContext("2d");
@ -130,8 +133,9 @@ class GuildMemberRemove extends BaseEvent {
content: message,
files: [attachment],
});
} else
channel.send({ content: message });
} else */
channel.send({ content: message });
}
}
}

View file

@ -1,9 +1,9 @@
const moment = require("moment"),
{ GlobalFonts } = require("@napi-rs/canvas"),
{ resolve } = require("path");
const moment = require("moment");
// const { GlobalFonts } = require("@napi-rs/canvas"),
// const { resolve } = require("path");
GlobalFonts.registerFromPath(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), "RubikMonoOne");
GlobalFonts.registerFromPath(resolve("./assets/fonts/KeepCalm-Medium.ttf"), "KeepCalm");
// GlobalFonts.registerFromPath(resolve("./assets/fonts/RubikMonoOne-Regular.ttf"), "RubikMonoOne");
// GlobalFonts.registerFromPath(resolve("./assets/fonts/KeepCalm-Medium.ttf"), "KeepCalm");
module.exports = {
/**

View file

@ -1,6 +1,6 @@
{
"name": "jaba",
"version": "4.6.0",
"version": "4.6.1",
"description": "My Discord Bot",
"main": "index.js",
"scripts": {