mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-24 14:14:59 +05:00
Fix welcome/goodbye saving
Remove images (fonts are broken)
This commit is contained in:
parent
d1a6ed597c
commit
0e38d2086c
5 changed files with 49 additions and 37 deletions
|
@ -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", {
|
||||
|
|
|
@ -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", {
|
||||
|
|
|
@ -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,7 +130,8 @@ class GuildMemberAdd extends BaseEvent {
|
|||
content: message,
|
||||
files: [attachment],
|
||||
});
|
||||
} else
|
||||
} else */
|
||||
|
||||
channel.send({ content: message });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,7 +133,8 @@ class GuildMemberRemove extends BaseEvent {
|
|||
content: message,
|
||||
files: [attachment],
|
||||
});
|
||||
} else
|
||||
} else */
|
||||
|
||||
channel.send({ content: message });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 = {
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue