mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
user.tag
This commit is contained in:
parent
3d29963b87
commit
74a676913e
38 changed files with 59 additions and 93 deletions
|
@ -37,7 +37,7 @@ export const RoleAddedTrigger = automodTrigger<RoleAddedMatchResult>()({
|
|||
const role = pluginData.guild.roles.cache.get(matchResult.extra.matchedRoleId as Snowflake);
|
||||
const roleName = role?.name || "Unknown";
|
||||
const member = contexts[0].member!;
|
||||
const memberName = `**${member.user.username}#${member.user.discriminator}** (\`${member.id}\`)`;
|
||||
const memberName = `**${member.user.tag}** (\`${member.id}\`)`;
|
||||
return `Role ${roleName} (\`${matchResult.extra.matchedRoleId}\`) was added to ${memberName}`;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@ export const RoleRemovedTrigger = automodTrigger<RoleAddedMatchResult>()({
|
|||
const role = pluginData.guild.roles.cache.get(matchResult.extra.matchedRoleId as Snowflake);
|
||||
const roleName = role?.name || "Unknown";
|
||||
const member = contexts[0].member!;
|
||||
const memberName = `**${member.user.username}#${member.user.discriminator}** (\`${member.id}\`)`;
|
||||
const memberName = `**${member.user.tag}** (\`${member.id}\`)`;
|
||||
return `Role ${roleName} (\`${matchResult.extra.matchedRoleId}\`) was removed from ${memberName}`;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -35,9 +35,7 @@ export const AddDashboardUserCmd = botControlCmd({
|
|||
await pluginData.state.apiPermissionAssignments.addUser(args.guildId, user.id, [ApiPermissions.EditConfig]);
|
||||
}
|
||||
|
||||
const userNameList = args.users.map(
|
||||
user => `<@!${user.id}> (**${user.username}#${user.discriminator}**, \`${user.id}\`)`,
|
||||
);
|
||||
const userNameList = args.users.map(user => `<@!${user.id}> (**${user.tag}**, \`${user.id}\`)`);
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
msg.channel as TextChannel,
|
||||
|
|
|
@ -46,7 +46,7 @@ export const ListDashboardPermsCmd = botControlCmd({
|
|||
|
||||
// If we have user, always display which guilds they have permissions in (or only specified guild permissions)
|
||||
if (args.user) {
|
||||
const userInfo = `**${args.user.username}#${args.user.discriminator}** (\`${args.user.id}\`)`;
|
||||
const userInfo = `**${args.user.tag}** (\`${args.user.id}\`)`;
|
||||
|
||||
for (const assignment of existingUserAssignment!) {
|
||||
if (guild != null && assignment.guild_id !== args.guildId) continue;
|
||||
|
@ -82,9 +82,7 @@ export const ListDashboardPermsCmd = botControlCmd({
|
|||
finalMessage += `The server ${guildInfo} has the following assigned permissions:\n`; // Double \n for consistency with AddDashboardUserCmd
|
||||
for (const assignment of existingGuildAssignment) {
|
||||
const user = await resolveUser(pluginData.client, assignment.target_id);
|
||||
finalMessage += `\n**${user.username}#${user.discriminator}**, \`${
|
||||
assignment.target_id
|
||||
}\`: ${assignment.permissions.join(", ")}`;
|
||||
finalMessage += `\n**${user.tag}**, \`${assignment.target_id}\`: ${assignment.permissions.join(", ")}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,7 @@ export const ListDashboardUsersCmd = botControlCmd({
|
|||
|
||||
const dashboardUsers = await pluginData.state.apiPermissionAssignments.getByGuildId(guild.id);
|
||||
const users = await Promise.all(dashboardUsers.map(perm => resolveUser(pluginData.client, perm.target_id)));
|
||||
const userNameList = users.map(
|
||||
user => `<@!${user.id}> (**${user.username}#${user.discriminator}**, \`${user.id}\`)`,
|
||||
);
|
||||
const userNameList = users.map(user => `<@!${user.id}> (**${user.tag}**, \`${user.id}\`)`);
|
||||
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
|
|
|
@ -34,9 +34,7 @@ export const RemoveDashboardUserCmd = botControlCmd({
|
|||
await pluginData.state.apiPermissionAssignments.removeUser(args.guildId, user.id);
|
||||
}
|
||||
|
||||
const userNameList = args.users.map(
|
||||
user => `<@!${user.id}> (**${user.username}#${user.discriminator}**, \`${user.id}\`)`,
|
||||
);
|
||||
const userNameList = args.users.map(user => `<@!${user.id}> (**${user.tag}**, \`${user.id}\`)`);
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
msg.channel as TextChannel,
|
||||
|
|
|
@ -49,7 +49,7 @@ export const ServersCmd = botControlCmd({
|
|||
const lines = filteredGuilds.map(g => {
|
||||
const paddedId = g.id.padEnd(longestId, " ");
|
||||
const owner = getUser(pluginData.client, g.ownerId);
|
||||
return `\`${paddedId}\` **${g.name}** (${g.memberCount} members) (owner **${owner.username}#${owner.discriminator}** \`${owner.id}\`)`;
|
||||
return `\`${paddedId}\` **${g.name}** (${g.memberCount} members) (owner **${owner.tag}** \`${owner.id}\`)`;
|
||||
});
|
||||
createChunkedMessage(msg.channel as TextChannel, lines.join("\n"));
|
||||
} else {
|
||||
|
|
|
@ -7,15 +7,15 @@ import { postCaseToCaseLogChannel } from "./postToCaseLogChannel";
|
|||
|
||||
export async function createCase(pluginData: GuildPluginData<CasesPluginType>, args: CaseArgs) {
|
||||
const user = await resolveUser(pluginData.client, args.userId);
|
||||
const userName = `${user.username}#${user.discriminator}`;
|
||||
const userName = `${user.tag}`;
|
||||
|
||||
const mod = await resolveUser(pluginData.client, args.modId);
|
||||
const modName = `${mod.username}#${mod.discriminator}`;
|
||||
const modName = `${mod.tag}`;
|
||||
|
||||
let ppName: string | null = null;
|
||||
if (args.ppId) {
|
||||
const pp = await resolveUser(pluginData.client, args.ppId);
|
||||
ppName = `${pp.username}#${pp.discriminator}`;
|
||||
ppName = `${pp.tag}`;
|
||||
}
|
||||
|
||||
if (args.auditLogId) {
|
||||
|
|
|
@ -16,7 +16,7 @@ export async function createCaseNote(pluginData: GuildPluginData<CasesPluginType
|
|||
throw new RecoverablePluginError(ERRORS.INVALID_USER);
|
||||
}
|
||||
|
||||
const modName = `${mod.username}#${mod.discriminator}`;
|
||||
const modName = `${mod.tag}`;
|
||||
|
||||
let body = args.body;
|
||||
|
||||
|
|
|
@ -73,11 +73,7 @@ export const AddCaseCmd = modActionsCmd({
|
|||
});
|
||||
|
||||
if (user) {
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`Case #${theCase.case_number} created for **${user.username}#${user.discriminator}**`,
|
||||
);
|
||||
sendSuccessMessage(pluginData, msg.channel, `Case #${theCase.case_number} created for **${user.tag}**`);
|
||||
} else {
|
||||
sendSuccessMessage(pluginData, msg.channel, `Case #${theCase.case_number} created`);
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ export const BanCmd = modActionsCmd({
|
|||
// Confirm the action to the moderator
|
||||
let response = "";
|
||||
if (!forceban) {
|
||||
response = `Banned **${user.username}#${user.discriminator}** ${forTime}(Case #${banResult.case.case_number})`;
|
||||
response = `Banned **${user.tag}** ${forTime}(Case #${banResult.case.case_number})`;
|
||||
if (banResult.notifyResult.text) response += ` (${banResult.notifyResult.text})`;
|
||||
} else {
|
||||
response = `Member forcebanned ${forTime}(Case #${banResult.case.case_number})`;
|
||||
|
|
|
@ -29,7 +29,7 @@ export const CasesModCmd = modActionsCmd({
|
|||
async run({ pluginData, message: msg, args }) {
|
||||
const modId = args.mod || msg.author.id;
|
||||
const mod = await resolveUser(pluginData.client, modId);
|
||||
const modName = mod instanceof User ? `${mod.username}#${mod.discriminator}` : modId;
|
||||
const modName = mod instanceof User ? `${mod.tag}` : modId;
|
||||
|
||||
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||
const totalCases = await casesPlugin.getTotalCasesByMod(modId);
|
||||
|
|
|
@ -61,10 +61,7 @@ export const CasesUserCmd = modActionsCmd({
|
|||
const normalCases = cases.filter(c => !c.is_hidden);
|
||||
const hiddenCases = cases.filter(c => c.is_hidden);
|
||||
|
||||
const userName =
|
||||
user instanceof UnknownUser && cases.length
|
||||
? cases[cases.length - 1].user_name
|
||||
: `${user.username}#${user.discriminator}`;
|
||||
const userName = user instanceof UnknownUser && cases.length ? cases[cases.length - 1].user_name : `${user.tag}`;
|
||||
|
||||
if (cases.length === 0) {
|
||||
msg.channel.send(`No cases found for **${userName}**`);
|
||||
|
|
|
@ -68,7 +68,7 @@ export const DeleteCaseCmd = modActionsCmd({
|
|||
}
|
||||
}
|
||||
|
||||
const deletedByName = `${message.author.username}#${message.author.discriminator}`;
|
||||
const deletedByName = `${message.author.tag}`;
|
||||
|
||||
const timeAndDate = pluginData.getPlugin(TimeAndDatePlugin);
|
||||
const deletedAt = timeAndDate.inGuildTz().format(timeAndDate.getDateFormat("pretty_datetime"));
|
||||
|
|
|
@ -30,7 +30,7 @@ export const NoteCmd = modActionsCmd({
|
|||
return;
|
||||
}
|
||||
|
||||
const userName = `${user.username}#${user.discriminator}`;
|
||||
const userName = `${user.tag}`;
|
||||
const reason = formatReasonWithAttachments(args.note, msg.attachments.array());
|
||||
|
||||
const casesPlugin = pluginData.getPlugin(CasesPlugin);
|
||||
|
|
|
@ -107,7 +107,7 @@ export const WarnCmd = modActionsCmd({
|
|||
sendSuccessMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`Warned **${memberToWarn.user.username}#${memberToWarn.user.discriminator}** (Case #${warnResult.case.case_number})${messageResultText}`,
|
||||
`Warned **${memberToWarn.user.tag}** (Case #${warnResult.case.case_number})${messageResultText}`,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -47,7 +47,7 @@ export const PostAlertOnMemberJoinEvt = modActionsEvt({
|
|||
}
|
||||
|
||||
await alertChannel.send(
|
||||
`<@!${member.id}> (${member.user.username}#${member.user.discriminator} \`${member.id}\`) joined with ${actions.length} prior record(s)`,
|
||||
`<@!${member.id}> (${member.user.tag} \`${member.id}\`) joined with ${actions.length} prior record(s)`,
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -103,7 +103,7 @@ export async function actualKickMemberCmd(
|
|||
}
|
||||
|
||||
// Confirm the action to the moderator
|
||||
let response = `Kicked **${memberToKick.user.username}#${memberToKick.user.discriminator}** (Case #${kickResult.case.case_number})`;
|
||||
let response = `Kicked **${memberToKick.user.tag}** (Case #${kickResult.case.case_number})`;
|
||||
|
||||
if (kickResult.notifyResult.text) response += ` (${kickResult.notifyResult.text})`;
|
||||
sendSuccessMessage(pluginData, msg.channel, response);
|
||||
|
|
|
@ -85,24 +85,24 @@ export async function actualMuteUserCmd(
|
|||
if (args.time) {
|
||||
if (muteResult.updatedExistingMute) {
|
||||
response = asSingleLine(`
|
||||
Updated **${user.username}#${user.discriminator}**'s
|
||||
Updated **${user.tag}**'s
|
||||
mute to ${timeUntilUnmute} (Case #${muteResult.case.case_number})
|
||||
`);
|
||||
} else {
|
||||
response = asSingleLine(`
|
||||
Muted **${user.username}#${user.discriminator}**
|
||||
Muted **${user.tag}**
|
||||
for ${timeUntilUnmute} (Case #${muteResult.case.case_number})
|
||||
`);
|
||||
}
|
||||
} else {
|
||||
if (muteResult.updatedExistingMute) {
|
||||
response = asSingleLine(`
|
||||
Updated **${user.username}#${user.discriminator}**'s
|
||||
Updated **${user.tag}**'s
|
||||
mute to indefinite (Case #${muteResult.case.case_number})
|
||||
`);
|
||||
} else {
|
||||
response = asSingleLine(`
|
||||
Muted **${user.username}#${user.discriminator}**
|
||||
Muted **${user.tag}**
|
||||
indefinitely (Case #${muteResult.case.case_number})
|
||||
`);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export async function actualUnmuteCmd(
|
|||
pluginData,
|
||||
msg.channel as TextChannel,
|
||||
asSingleLine(`
|
||||
Unmuting **${user.username}#${user.discriminator}**
|
||||
Unmuting **${user.tag}**
|
||||
in ${timeUntilUnmute} (Case #${result.case.case_number})
|
||||
`),
|
||||
);
|
||||
|
@ -57,7 +57,7 @@ export async function actualUnmuteCmd(
|
|||
pluginData,
|
||||
msg.channel as TextChannel,
|
||||
asSingleLine(`
|
||||
Unmuted **${user.username}#${user.discriminator}**
|
||||
Unmuted **${user.tag}**
|
||||
(Case #${result.case.case_number})
|
||||
`),
|
||||
);
|
||||
|
|
|
@ -67,7 +67,7 @@ export const MutesCmd = mutesCmd({
|
|||
totalMutes = manuallyMutedMembers.length;
|
||||
|
||||
lines = manuallyMutedMembers.map(member => {
|
||||
return `<@!${member.id}> (**${member.user.username}#${member.user.discriminator}**, \`${member.id}\`) 🔧 Manual mute`;
|
||||
return `<@!${member.id}> (**${member.user.tag}**, \`${member.id}\`) 🔧 Manual mute`;
|
||||
});
|
||||
} else {
|
||||
// Show filtered active mutes (but not manual mutes)
|
||||
|
@ -119,7 +119,7 @@ export const MutesCmd = mutesCmd({
|
|||
|
||||
lines = filteredMutes.map(mute => {
|
||||
const user = pluginData.client.users.resolve(mute.user_id as Snowflake);
|
||||
const username = user ? `${user.username}#${user.discriminator}` : "Unknown#0000";
|
||||
const username = user ? `${user.tag}` : "Unknown#0000";
|
||||
const theCase = muteCasesById.get(mute.case_id);
|
||||
const caseName = theCase ? `Case #${theCase.case_number}` : "No case";
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ export const NamesCmd = nameHistoryCmd({
|
|||
const usernameRows = usernames.map(r => `\`[${r.timestamp}]\` **${disableCodeBlocks(r.username)}**`);
|
||||
|
||||
const user = await pluginData.client.users.fetch(args.userId as Snowflake);
|
||||
const currentUsername = user ? `${user.username}#${user.discriminator}` : args.userId;
|
||||
const currentUsername = user ? `${user.tag}` : args.userId;
|
||||
|
||||
const nicknameDays = Math.round(NICKNAME_RETENTION_PERIOD / DAYS);
|
||||
const usernameDays = Math.round(NICKNAME_RETENTION_PERIOD / DAYS);
|
||||
|
|
|
@ -138,7 +138,7 @@ export async function actualPostCmd(
|
|||
|
||||
await pluginData.state.scheduledPosts.create({
|
||||
author_id: msg.author.id,
|
||||
author_name: `${msg.author.username}#${msg.author.discriminator}`,
|
||||
author_name: `${msg.author.tag}`,
|
||||
channel_id: targetChannel.id,
|
||||
content,
|
||||
attachments: msg.attachments.array(),
|
||||
|
|
|
@ -38,9 +38,7 @@ export async function addMemberPendingRoleChange(
|
|||
"Reaction roles",
|
||||
);
|
||||
} catch (e) {
|
||||
logger.warn(
|
||||
`Failed to apply role changes to ${member.user.username}#${member.user.discriminator} (${member.id}): ${e.message}`,
|
||||
);
|
||||
logger.warn(`Failed to apply role changes to ${member.user.tag} (${member.id}): ${e.message}`);
|
||||
}
|
||||
}
|
||||
lock.unlock();
|
||||
|
|
|
@ -45,7 +45,7 @@ export const SlowmodeClearCmd = slowmodeCmd({
|
|||
pluginData,
|
||||
msg.channel,
|
||||
asSingleLine(`
|
||||
Failed to clear slowmode from **${args.user.username}#${args.user.discriminator}** in <#${args.channel.id}>:
|
||||
Failed to clear slowmode from **${args.user.tag}** in <#${args.channel.id}>:
|
||||
Threads cannot have Bot Slowmode
|
||||
`),
|
||||
);
|
||||
|
@ -56,17 +56,13 @@ export const SlowmodeClearCmd = slowmodeCmd({
|
|||
pluginData,
|
||||
msg.channel,
|
||||
asSingleLine(`
|
||||
Failed to clear slowmode from **${args.user.username}#${args.user.discriminator}** in <#${args.channel.id}>:
|
||||
Failed to clear slowmode from **${args.user.tag}** in <#${args.channel.id}>:
|
||||
\`${disableInlineCode(e.message)}\`
|
||||
`),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`Slowmode cleared from **${args.user.username}#${args.user.discriminator}** in <#${args.channel.id}>`,
|
||||
);
|
||||
sendSuccessMessage(pluginData, msg.channel, `Slowmode cleared from **${args.user.tag}** in <#${args.channel.id}>`);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ export function createStarboardEmbedFromMessage(
|
|||
text: `#${(msg.channel as GuildChannel).name}`,
|
||||
},
|
||||
author: {
|
||||
name: `${msg.author.username}#${msg.author.discriminator}`,
|
||||
name: `${msg.author.tag}`,
|
||||
},
|
||||
fields: [],
|
||||
timestamp: msg.createdAt,
|
||||
|
|
|
@ -4,7 +4,7 @@ import { UsernameSaverPluginType } from "./types";
|
|||
|
||||
export async function updateUsername(pluginData: GuildPluginData<UsernameSaverPluginType>, user: User) {
|
||||
if (!user) return;
|
||||
const newUsername = `${user.username}#${user.discriminator}`;
|
||||
const newUsername = `${user.tag}`;
|
||||
const latestEntry = await pluginData.state.usernameHistory.getLastEntry(user.id);
|
||||
if (!latestEntry || newUsername !== latestEntry.username) {
|
||||
await pluginData.state.usernameHistory.addEntry(user.id, newUsername);
|
||||
|
|
|
@ -24,7 +24,7 @@ export const AvatarCmd = utilityCmd({
|
|||
const embed: MessageEmbedOptions = {
|
||||
image: { url: avatarUrl + `${extension}?size=2048` },
|
||||
};
|
||||
embed.title = `Avatar of ${user.username}#${user.discriminator}:`;
|
||||
embed.title = `Avatar of ${user.tag}:`;
|
||||
msg.channel.send({ embeds: [embed] });
|
||||
} else {
|
||||
sendErrorMessage(pluginData, msg.channel, "Invalid user ID");
|
||||
|
|
|
@ -17,8 +17,6 @@ export const LevelCmd = utilityCmd({
|
|||
run({ message, args, pluginData }) {
|
||||
const member = args.member || message.member;
|
||||
const level = getMemberLevel(pluginData, member);
|
||||
message.channel.send(
|
||||
`The permission level of ${member.user.username}#${member.user.discriminator} is **${level}**`,
|
||||
);
|
||||
message.channel.send(`The permission level of ${member.user.tag} is **${level}**`);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -44,10 +44,6 @@ export const VcdisconnectCmd = utilityCmd({
|
|||
oldChannel: channelToConfigAccessibleChannel(channel),
|
||||
});
|
||||
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`**${args.member.user.username}#${args.member.user.discriminator}** disconnected from **${channel.name}**`,
|
||||
);
|
||||
sendSuccessMessage(pluginData, msg.channel, `**${args.member.user.tag}** disconnected from **${channel.name}**`);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -85,11 +85,7 @@ export const VcmoveCmd = utilityCmd({
|
|||
newChannel: channelToConfigAccessibleChannel(channel),
|
||||
});
|
||||
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`**${args.member.user.username}#${args.member.user.discriminator}** moved to **${channel.name}**`,
|
||||
);
|
||||
sendSuccessMessage(pluginData, msg.channel, `**${args.member.user.tag}** moved to **${channel.name}**`);
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -162,7 +158,7 @@ export const VcmoveAllCmd = utilityCmd({
|
|||
sendErrorMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`Failed to move ${currMember.user.username}#${currMember.user.discriminator} (${currMember.id}): You cannot act on this member`,
|
||||
`Failed to move ${currMember.user.tag} (${currMember.id}): You cannot act on this member`,
|
||||
);
|
||||
errAmt++;
|
||||
continue;
|
||||
|
@ -177,11 +173,7 @@ export const VcmoveAllCmd = utilityCmd({
|
|||
sendErrorMessage(pluginData, msg.channel, "Unknown error when trying to move members");
|
||||
return;
|
||||
}
|
||||
sendErrorMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`Failed to move ${currMember.user.username}#${currMember.user.discriminator} (${currMember.id})`,
|
||||
);
|
||||
sendErrorMessage(pluginData, msg.channel, `Failed to move ${currMember.user.tag} (${currMember.id})`);
|
||||
errAmt++;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ export async function getInviteInfoEmbed(
|
|||
embed.fields.push({
|
||||
name: preEmbedPadding + "Invite creator",
|
||||
value: trimLines(`
|
||||
Name: **${invite.inviter.username}#${invite.inviter.discriminator}**
|
||||
Name: **${invite.inviter.tag}**
|
||||
ID: \`${invite.inviter.id}\`
|
||||
Mention: <@!${invite.inviter.id}>
|
||||
`),
|
||||
|
@ -143,7 +143,7 @@ export async function getInviteInfoEmbed(
|
|||
embed.fields.push({
|
||||
name: preEmbedPadding + "Invite creator",
|
||||
value: trimLines(`
|
||||
Name: **${invite.inviter.username}#${invite.inviter.discriminator}**
|
||||
Name: **${invite.inviter.tag}**
|
||||
ID: \`${invite.inviter.id}\`
|
||||
Mention: <@!${invite.inviter.id}>
|
||||
`),
|
||||
|
|
|
@ -112,7 +112,7 @@ export async function getMessageInfoEmbed(
|
|||
embed.fields.push({
|
||||
name: preEmbedPadding + "Author information",
|
||||
value: trimLines(`
|
||||
Name: **${message.author.username}#${message.author.discriminator}**
|
||||
Name: **${message.author.tag}**
|
||||
ID: \`${message.author.id}\`
|
||||
Created: **${authorAccountAge} ago** (\`${prettyAuthorCreatedAt}\`)
|
||||
${authorJoinedAt ? `Joined: **${authorServerAge} ago** (\`${prettyAuthorJoinedAt}\`)` : ""}
|
||||
|
|
|
@ -65,7 +65,7 @@ export async function getServerInfoEmbed(
|
|||
|
||||
if (thisServer) {
|
||||
const owner = await resolveUser(pluginData.client, thisServer.ownerId);
|
||||
const ownerName = `${owner.username}#${owner.discriminator}`;
|
||||
const ownerName = `${owner.tag}`;
|
||||
|
||||
basicInformation.push(`Owner: **${ownerName}** (\`${thisServer.ownerId}\`)`);
|
||||
// basicInformation.push(`Voice region: **${thisServer.region}**`); Outdated, as automatic voice regions are fully live
|
||||
|
|
|
@ -36,7 +36,7 @@ export async function getUserInfoEmbed(
|
|||
const timeAndDate = pluginData.getPlugin(TimeAndDatePlugin);
|
||||
|
||||
embed.author = {
|
||||
name: `User: ${user.username}#${user.discriminator}`,
|
||||
name: `User: ${user.tag}`,
|
||||
};
|
||||
|
||||
const avatarURL = user.displayAvatarURL();
|
||||
|
@ -84,7 +84,7 @@ export async function getUserInfoEmbed(
|
|||
embed.fields.push({
|
||||
name: preEmbedPadding + "User information",
|
||||
value: trimLines(`
|
||||
Name: **${user.username}#${user.discriminator}**
|
||||
Name: **${user.tag}**
|
||||
ID: \`${user.id}\`
|
||||
Created: **${accountAge} ago** (\`${prettyCreatedAt}\`)
|
||||
Mention: <@!${user.id}>
|
||||
|
|
|
@ -391,7 +391,7 @@ async function performMemberSearch(
|
|||
return true;
|
||||
}
|
||||
|
||||
const fullUsername = `${member.user.username}#${member.user.discriminator}`;
|
||||
const fullUsername = `${member.user.tag}`;
|
||||
if (await execRegExp(queryRegex, fullUsername).catch(allowTimeout)) return true;
|
||||
|
||||
return false;
|
||||
|
@ -458,7 +458,7 @@ async function performBanSearch(
|
|||
|
||||
const execRegExp = getOptimizedRegExpRunner(pluginData, isSafeRegex);
|
||||
matchingBans = await asyncFilter(matchingBans, async user => {
|
||||
const fullUsername = `${user.username}#${user.discriminator}`;
|
||||
const fullUsername = `${user.tag}`;
|
||||
if (await execRegExp(queryRegex, fullUsername).catch(allowTimeout)) return true;
|
||||
return false;
|
||||
});
|
||||
|
@ -502,10 +502,10 @@ function formatSearchResultList(members: Array<GuildMember | User>): string {
|
|||
const paddedId = member.id.padEnd(longestId, " ");
|
||||
let line;
|
||||
if (member instanceof GuildMember) {
|
||||
line = `${paddedId} ${member.user.username}#${member.user.discriminator}`;
|
||||
line = `${paddedId} ${member.user.tag}`;
|
||||
if (member.nickname) line += ` (${member.nickname})`;
|
||||
} else {
|
||||
line = `${paddedId} ${member.username}#${member.discriminator}`;
|
||||
line = `${paddedId} ${member.tag}`;
|
||||
}
|
||||
return line;
|
||||
});
|
||||
|
|
|
@ -1099,6 +1099,7 @@ export class UnknownUser {
|
|||
public id: string;
|
||||
public username = "Unknown";
|
||||
public discriminator = "0000";
|
||||
public tag = "Unknown#0000";
|
||||
|
||||
constructor(props = {}) {
|
||||
for (const key in props) {
|
||||
|
@ -1353,18 +1354,18 @@ export function messageSummary(msg: SavedMessage) {
|
|||
|
||||
export function verboseUserMention(user: User | UnknownUser): string {
|
||||
if (user.id == null) {
|
||||
return `**${user.username}#${user.discriminator}**`;
|
||||
return `**${user.tag}**`;
|
||||
}
|
||||
|
||||
return `<@!${user.id}> (**${user.username}#${user.discriminator}**, \`${user.id}\`)`;
|
||||
return `<@!${user.id}> (**${user.tag}**, \`${user.id}\`)`;
|
||||
}
|
||||
|
||||
export function verboseUserName(user: User | UnknownUser): string {
|
||||
if (user.id == null) {
|
||||
return `**${user.username}#${user.discriminator}**`;
|
||||
return `**${user.tag}**`;
|
||||
}
|
||||
|
||||
return `**${user.username}#${user.discriminator}** (\`${user.id}\`)`;
|
||||
return `**${user.tag}** (\`${user.id}\`)`;
|
||||
}
|
||||
|
||||
export function verboseChannelMention(channel: GuildChannel): string {
|
||||
|
|
|
@ -38,7 +38,7 @@ export interface IConfigAccessibleMember extends IConfigAccessibleUser {
|
|||
}
|
||||
|
||||
export function userToConfigAccessibleUser(user: User | UnknownUser): IConfigAccessibleUser {
|
||||
if (`${user.username}#${user.discriminator}` === "Unknown#0000") {
|
||||
if (`${user.tag}` === "Unknown#0000") {
|
||||
const toReturnPartial: IConfigAccessibleUser = {
|
||||
id: user.id,
|
||||
username: "Unknown",
|
||||
|
|
Loading…
Add table
Reference in a new issue