Фиксики

This commit is contained in:
JonnyBro 2022-11-09 21:48:41 +05:00
parent 82813cbd36
commit 2551616886

View file

@ -1,13 +1,13 @@
const { Message, CommandInteraction } = require("discord.js"); const { Message, BaseInteraction } = require("discord.js");
CommandInteraction.prototype.translate = function (key, args) { BaseInteraction.prototype.translate = function (key, args) {
const language = this.client.translations.get(this.guild.data ? this.guild.data.language ? this.guild.data.language : "ru-RU" : "ru-RU"); const language = this.client.translations.get(this.guild.data ? this.guild.data.language ? this.guild.data.language : "ru-RU" : "ru-RU");
if (!language) throw "Interaction: Invalid language set in data."; if (!language) throw "Interaction: Invalid language set in data.";
return language(key, args); return language(key, args);
}; };
CommandInteraction.prototype.replyT = function (key, args, options = {}) { BaseInteraction.prototype.replyT = function (key, args, options = {}) {
let string = this.translate(key, args, this.guild.data ? this.guild.data.language ? this.guild.data.language : "ru-RU" : "ru-RU"); let string = this.translate(key, args, this.guild.data ? this.guild.data.language ? this.guild.data.language : "ru-RU" : "ru-RU");
if (options.prefixEmoji) string = `${this.client.customEmojis[options.prefixEmoji]} | ${string}`; if (options.prefixEmoji) string = `${this.client.customEmojis[options.prefixEmoji]} | ${string}`;
@ -15,13 +15,13 @@ CommandInteraction.prototype.replyT = function (key, args, options = {}) {
else return this.reply({ content: string, ephemeral: options.ephemeral || false }); else return this.reply({ content: string, ephemeral: options.ephemeral || false });
}; };
CommandInteraction.prototype.error = function (key, args, options = {}) { BaseInteraction.prototype.error = function (key, args, options = {}) {
options.prefixEmoji = "error"; options.prefixEmoji = "error";
return this.replyT(key, args, options); return this.replyT(key, args, options);
}; };
CommandInteraction.prototype.success = function (key, args, options = {}) { BaseInteraction.prototype.success = function (key, args, options = {}) {
options.prefixEmoji = "success"; options.prefixEmoji = "success";
return this.replyT(key, args, options); return this.replyT(key, args, options);