Фикс команд в ЛС

This commit is contained in:
JonnyBro 2022-11-14 17:57:20 +05:00
parent 85665f09e0
commit f6370e044a

View file

@ -1,14 +1,14 @@
const { Message, BaseInteraction } = require("discord.js"); const { Message, BaseInteraction } = require("discord.js");
BaseInteraction.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 ? (this.guild.data ? 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);
}; };
BaseInteraction.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);
if (options.prefixEmoji) string = `${this.client.customEmojis[options.prefixEmoji]} | ${string}`; if (options.prefixEmoji) string = `${this.client.customEmojis[options.prefixEmoji]} | ${string}`;
if (options.edit) return this.editReply({ content: string, ephemeral: options.ephemeral || false }); if (options.edit) return this.editReply({ content: string, ephemeral: options.ephemeral || false });