Add support for new name system

This commit is contained in:
Jonny_Bro (Nikita) 2023-06-07 23:59:38 +05:00
parent f05081845a
commit 6e7ade5da7
21 changed files with 48 additions and 43 deletions

View file

@ -58,7 +58,7 @@ class Money extends BaseCommand {
const embed = new EmbedBuilder()
.setAuthor({
name: interaction.translate("economy/money:TITLE", {
user: member.user.tag,
user: member.user.discriminator === "0" ? member.user.username : member.user.tag,
}),
iconURL: member.user.displayAvatarURL(),
})

View file

@ -62,7 +62,7 @@ class Pay extends BaseCommand {
memberData.save();
const info1 = {
user: member.user.tag,
user: member.user.discriminator === "0" ? member.user.username : member.user.tag,
amount: amount,
date: Date.now(),
type: "send",
@ -70,7 +70,7 @@ class Pay extends BaseCommand {
data.memberData.transactions.push(info1);
const info2 = {
user: member.user.tag,
user: member.user.discriminator === "0" ? member.user.username : member.user.tag,
amount: amount,
date: Date.now(),
type: "got",

View file

@ -60,6 +60,8 @@ class Profile extends BaseCommand {
globalMoney += data.money + data.bankSold;
});
const lover = client.users.cache.get(userData.lover);
const profileEmbed = new EmbedBuilder()
.setAuthor({
name: interaction.translate("economy/profile:TITLE", {
@ -119,7 +121,7 @@ class Profile extends BaseCommand {
},
{
name: interaction.translate("economy/profile:LOVER"),
value: (!userData.lover ? interaction.translate("common:NOT_DEFINED") : client.users.cache.get(userData.lover).tag),
value: (!userData.lover ? interaction.translate("common:NOT_DEFINED") : lover.discriminator === "0" ? lover.username : lover.tag),
inline: true,
},
{

View file

@ -49,7 +49,7 @@ class Report extends BaseCommand {
const embed = new EmbedBuilder()
.setAuthor({
name: interaction.translate("general/report:TITLE", {
user: member.user.tag,
user: member.user.discriminator === "0" ? member.user.username : member.user.tag,
}),
iconURL: interaction.user.displayAvatarURL({
extension: "png",

View file

@ -43,7 +43,7 @@ class Suggest extends BaseCommand {
const embed = new EmbedBuilder()
.setAuthor({
name: interaction.translate("general/suggest:TITLE", {
user: interaction.user.tag,
user: interaction.user.discriminator === "0" ? interaction.user.username : interaction.user.tag,
}),
iconURL: interaction.member.displayAvatarURL(),
})

View file

@ -38,7 +38,7 @@ class Userinfo extends BaseCommand {
const member = interaction.options.getMember("user") || interaction.member;
const embed = new EmbedBuilder()
.setAuthor({
name: `${member.user.tag} (${member.id})`,
name: `${member.user.discriminator === "0" ? member.user.username : member.user.tag} (${member.id})`,
iconURL: member.displayAvatarURL(),
})
.setThumbnail(member.displayAvatarURL({
@ -47,7 +47,7 @@ class Userinfo extends BaseCommand {
.addFields([
{
name: ":man: " + interaction.translate("common:USERNAME"),
value: member.user.tag,
value: member.user.discriminator === "0" ? member.user.username : member.user.tag,
inline: true,
},
{

View file

@ -125,7 +125,7 @@ class Clear extends BaseCommand {
if (member || user_id) {
interaction.replyT("moderation/clear:CLEARED_MEMBER", {
amount: `**${option}** ${client.functions.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`,
user: (member?.user.tag || user_id),
user: (member?.user.discriminator === "0" ? member?.user.username : member?.user.tag || user_id),
}, { edit: true });
} else {
interaction.replyT("moderation/clear:CLEARED", {

View file

@ -47,7 +47,7 @@ class Warn extends BaseCommand {
const modal = new ModalBuilder()
.setCustomId("warn_modal")
.setTitle(interaction.translate("moderation/warn:MODAL_TITLE", { nickname: member.user.tag }).normalize("NFKD"));
.setTitle(interaction.translate("moderation/warn:MODAL_TITLE", { nickname: member.user.discriminator === "0" ? member.user.username : member.user.tag }).normalize("NFKD"));
const reasonInput = new TextInputBuilder()
.setCustomId("warn_reason")
@ -89,11 +89,11 @@ class Warn extends BaseCommand {
.addFields([
{
name: interaction.translate("common:USER"),
value: `\`${member.user.tag}\` (${member.user.toString()})`,
value: `\`${member.user.discriminator === "0" ? member.user.username : member.user.tag}\` (${member.user.toString()})`,
},
{
name: interaction.translate("common:MODERATOR"),
value: `\`${interaction.user.tag}\` (${interaction.user.toString()})`,
value: `\`${interaction.user.discriminator === "0" ? interaction.user.username : interaction.user.tag}\` (${interaction.user.toString()})`,
},
{
name: interaction.translate("common:REASON"),
@ -107,7 +107,7 @@ class Warn extends BaseCommand {
member.send({
content: interaction.translate("moderation/ban:BANNED_DM", {
user: member.user,
moderator: interaction.user.tag,
moderator: interaction.user.discriminator === "0" ? interaction.user.username : interaction.user.tag,
server: interaction.guild.name,
reason,
}),
@ -124,7 +124,7 @@ class Warn extends BaseCommand {
interaction.guild.members.ban(member).catch(() => {});
interaction.followUp({
content: interaction.translate("moderation/setwarns:AUTO_BAN", {
user: member.user.tag,
user: member.user.discriminator === "0" ? member.user.username : member.user.tag,
count: `${banCount} ${client.functions.getNoun(banCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`,
}),
});
@ -136,7 +136,7 @@ class Warn extends BaseCommand {
member.send({
content: interaction.translate("moderation/kick:KICKED_DM", {
user: member.user,
moderator: interaction.user.tag,
moderator: interaction.user.discriminator === "0" ? interaction.user.username : interaction.user.tag,
server: interaction.guild.name,
reason,
}),
@ -153,7 +153,7 @@ class Warn extends BaseCommand {
member.kick().catch(() => {});
interaction.followUp({
content: interaction.translate("moderation/setwarns:AUTO_KICK", {
user: member.user.tag,
user: member.user.discriminator === "0" ? member.user.username : member.user.tag,
count: `${kickCount} ${client.functions.getNoun(kickCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`,
}),
});
@ -162,9 +162,9 @@ class Warn extends BaseCommand {
member.send({
content: interaction.translate("moderation/warn:WARNED_DM", {
user: member.user.tag,
user: member.user.discriminator === "0" ? member.user.username : member.user.tag,
server: interaction.guild.name,
moderator: interaction.user.tag,
moderator: interaction.user.discriminator === "0" ? interaction.user.username : interaction.user.tag,
reason,
}),
});

View file

@ -55,7 +55,7 @@ class Announcement extends BaseCommand {
.setDescription(text)
.setColor(client.config.embed.color)
.setFooter({
text: interaction.user.tag,
text: interaction.user.discriminator === "0" ? interaction.user.username : interaction.user.tag,
})
.setTimestamp();

View file

@ -87,7 +87,7 @@ router.get("/callback", async (req, res) => {
const embed = new Discord.EmbedBuilder()
.setAuthor({ name: user.username, iconURL: user.displayAvatarURL() })
.setColor(req.client.config.embed.color)
.setDescription(req.client.translate("dashboard:FIRST_LOGIN", { user: user.tag }));
.setDescription(req.client.translate("dashboard:FIRST_LOGIN", { user: user.discriminator === "0" ? user.username : user.tag }));
logsChannel.send({ embeds: [embed] });

View file

@ -20,7 +20,7 @@
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="<%= user.displayAvatarURL %>" class="user-image" alt="User Image">
<span class="hidden-xs"><%= user.tag %></span>
<span class="hidden-xs"><%= user.discriminator === "0" ? user.username : user.tag %></span>
</a>
<ul class="dropdown-menu">
<!-- Menu Footer-->

View file

@ -8,7 +8,7 @@
<img src="<%= user.displayAvatarURL %>" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<p><%= user.tag %></p>
<p><%= user.discriminator === "0" ? user.username : user.tag %></p>
<!-- <a href="#"><i class="fa fa-circle text-<%=// user.status === "dnd" ? "danger" : user.status === "idle" ? "warning" : user.status === "online" ? "success" : ""%>"></i>
<%=// translate("common:STATUS_" + user.status.toUpperCase()) %>
</a> -->

View file

@ -32,7 +32,7 @@
<div class="box box-widget widget-user">
<!-- Add the bg color to the header using any of the bg-* classes -->
<div class="widget-user-header bg-red">
<h3 class="widget-user-username"><%= user.tag %></h3>
<h3 class="widget-user-username"><%= user.discriminator === "0" ? user.username : user.tag %></h3>
</div>
<div class="widget-user-image">
<img class="img-circle" src="<%= user.displayAvatarURL %>" alt="User Avatar">
@ -68,8 +68,9 @@
<div class="description-block">
<h5 class="description-header">
<%= translate("economy/profile:LOVER").substr(2) %></h5>
<% const lover = bot.users.cache.get(user.lover) %>
<span
class="description-text"><%= !user.lover ? translate("economy/profile:NO_LOVER") : bot.users.cache.get(user.lover).tag %></span>
class="description-text"><%= !user.lover ? translate("economy/profile:NO_LOVER") : lover.discriminator === "0" ? lover.username : lover.tag %></span>
</div>
<!-- /.description-block -->
</div>

View file

@ -27,7 +27,7 @@
<div class="box box-widget widget-user">
<!-- Add the bg color to the header using any of the bg-* classes -->
<div class="widget-user-header bg-red">
<h3 class="widget-user-username"><%= userInfos.tag %> (<%= userInfos.id %>)</h3>
<h3 class="widget-user-username"><%= userInfos.discriminator === "0" ? userInfos.username : userInfos.tag %> (<%= userInfos.id %>)</h3>
<i><%= bot.guilds.cache.get(guild.id).name %> (<%= guild.id %>)</i>
</div>
<div class="widget-user-image">
@ -65,8 +65,9 @@
<div class="description-block">
<h5 class="description-header">
<%= translate("economy/profile:LOVER").substr(2) %></h5>
<% const lover = bot.users.cache.get(userInfos.lover) %>
<span
class="description-text"><%= !userInfos.lover ? translate("economy/profile:NO_LOVER") : bot.users.cache.get(userInfos.lover).tag %></span>
class="description-text"><%= !userInfos.lover ? translate("economy/profile:NO_LOVER") : lover.discriminator === "0" ? lover.username : lover.tag %></span>
</div>
<!-- /.description-block -->
</div>

View file

@ -61,7 +61,7 @@ class CommandHandler extends BaseEvent {
interaction.channel.isDMBased() ? interaction.user.send(args) : await interaction.channel.send(args);
}
client.logger.log(`User ${interaction.user.tag} used ${command.command.name} in ${interaction.guild ? interaction.guild.name : "DM"} with arguments: ${interaction.options.data.length > 0 ? interaction.options.data.map(arg => { return `${arg.name}: ${arg.value}`; }).join(", ") : "no args"}`, "cmd");
client.logger.log(`User ${interaction.user.discriminator === "0" ? interaction.user.username : interaction.user.tag} used ${command.command.name} in ${interaction.guild ? interaction.guild.name : "DM"} with arguments: ${interaction.options.data.length > 0 ? interaction.options.data.map(arg => { return `${arg.name}: ${arg.value}`; }).join(", ") : "no args"}`, "cmd");
return command.execute(client, interaction, data);
}

View file

@ -101,7 +101,7 @@ class GuildMemberAdd extends BaseEvent {
// Draw discriminator
ctx.font = "35px RubikMonoOne";
ctx.fillText(member.user.discriminator, canvas.width - 623, canvas.height - 178);
ctx.fillText(member.user.discriminator === "0" ? "" : member.user.discriminator, canvas.width - 623, canvas.height - 178);
// Draw membercount
ctx.font = "22px RubikMonoOne";

View file

@ -41,7 +41,7 @@ class GuildMemberRemove extends BaseEvent {
const channel = member.guild.channels.cache.get(guildData.plugins.goodbye.channel);
if (channel) {
const message = guildData.plugins.goodbye.message
.replace(/{user}/g, member.user.tag)
.replace(/{user}/g, member.user.discriminator === "0" ? member.user.username : member.user.tag)
.replace(/{server}/g, member.guild.name)
.replace(/{membercount}/g, member.guild.memberCount);
if (guildData.plugins.goodbye.withImage) {
@ -86,7 +86,7 @@ class GuildMemberRemove extends BaseEvent {
// Draw discriminator
ctx.font = "35px RubikMonoOne";
ctx.fillText(member.user.discriminator, canvas.width - 623, canvas.height - 178);
ctx.fillText(member.user.discriminator === "0" ? "" : member.user.discriminator, canvas.width - 623, canvas.height - 178);
// Draw membercount
ctx.font = "22px RubikMonoOne";

View file

@ -56,7 +56,7 @@ class MessageCreate extends BaseEvent {
const embed = new EmbedBuilder()
.setAuthor({
name: message.translate("misc:QUOTE_TITLE", {
user: msg.author.tag,
user: msg.author.discriminator === "0" ? msg.author.username : msg.author.tag,
}),
iconURL: "https://wynem.com/assets/images/icons/quote.webp",
})
@ -71,7 +71,7 @@ class MessageCreate extends BaseEvent {
},
])
.setFooter({
text: message.translate("misc:QUOTE_FOOTER", { user: message.author.tag }),
text: message.translate("misc:QUOTE_FOOTER", { user: message.author.discriminator === "0" ? message.author.username : message.author.tag }),
})
.setColor(client.config.embed.color)
.setTimestamp(msg.createdTimestamp);
@ -122,7 +122,7 @@ class MessageCreate extends BaseEvent {
const userData = await client.findOrCreateUser({
id: u.id,
});
if (userData.afk) message.replyT("general/afk:IS_AFK", { user: u.tag, reason: userData.afk }, { ephemeral: true });
if (userData.afk) message.replyT("general/afk:IS_AFK", { user: u.discriminator === "0" ? u.username : u.tag, reason: userData.afk }, { ephemeral: true });
});
}

View file

@ -24,7 +24,7 @@ class Ready extends BaseEvent {
tUsers = tUsers - hiddenGuildMembersCount;
client.logger.log(`Loaded a total of ${commands.length} command(s).`, "ready");
client.logger.log(`${client.user.tag}, ready to serve ${tUsers} members in ${tServers} servers.`, "ready");
client.logger.log(`${client.user.discriminator === "0" ? client.user.username : client.user.tag}, ready to serve ${tUsers} members in ${tServers} servers.`, "ready");
client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] })}`, "ready");
console.timeEnd("botReady");

View file

@ -42,7 +42,7 @@ module.exports.init = async function (client) {
const embed = new EmbedBuilder()
.setDescription(guild.translate("moderation/unmute:SUCCESS_CASE", {
user: user.toString(),
usertag: user.tag,
usertag: user.discriminator === "0" ? user.username : user.tag,
count: memberData.mute.case,
}))
.setColor("#F44271")

View file

@ -64,15 +64,16 @@ async function tictactoe(interaction, options = {}) {
});
}
const foot = options.embedFoot ? { text: options.embedFoot } : { text: "Удачи =)" };
const foot = options.embedFoot ? { text: options.embedFoot } : { text: "Удачи =)" },
user = interaction.user ? interaction.user : interaction.author
const acceptEmbed = new EmbedBuilder()
.setTitle(interaction.translate("fun/tictactoe:REQUEST_WAIT", {
user: opponent.tag,
user: opponent.discriminator === "0" ? opponent.username : opponent.tag,
}))
.setAuthor({
name: (interaction.user ? interaction.user : interaction.author).tag,
iconURL: (interaction.user ? interaction.user : interaction.author).displayAvatarURL(),
name: user.discriminator === "0" ? user.username : user.tag,
iconURL: user.displayAvatarURL(),
})
.setColor(options.embedColor || "#075FFF")
.setFooter(foot)
@ -831,8 +832,8 @@ async function tictactoe(interaction, options = {}) {
const embed = new EmbedBuilder()
.setTitle(interaction.translate("fun/tictactoe:NO_ANSWER_TITLE"))
.setAuthor({
name: (interaction.user ? interaction.user : interaction.author).tag,
iconURL: (interaction.user ? interaction.user : interaction.author).displayAvatarURL(),
name: user.discriminator === "0" ? user.username : user.tag,
iconURL: user.displayAvatarURL(),
})
.setColor(options.timeoutEmbedColor || "#C90000")
.setFooter(foot)
@ -850,8 +851,8 @@ async function tictactoe(interaction, options = {}) {
const embed = new EmbedBuilder()
.setTitle(interaction.translate("fun/tictactoe:CANCELED"))
.setAuthor({
name: (interaction.user ? interaction.user : interaction.author).tag,
iconURL: (interaction.user ? interaction.user : interaction.author).displayAvatarURL(),
name: user.discriminator === "0" ? user.username : user.tag,
iconURL: user.displayAvatarURL(),
})
.setColor(options.timeoutEmbedColor || "#C90000")
.setFooter(foot)