mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
feat: new username support
This commit is contained in:
parent
514e93aa23
commit
0e70412bc4
8 changed files with 42 additions and 20 deletions
|
@ -9,6 +9,7 @@ import {
|
|||
isGroupDMInvite,
|
||||
isGuildInvite,
|
||||
preEmbedPadding,
|
||||
renderUsername,
|
||||
resolveInvite,
|
||||
trimLines,
|
||||
} from "../../../utils";
|
||||
|
@ -93,7 +94,7 @@ export async function getInviteInfoEmbed(
|
|||
embed.fields.push({
|
||||
name: preEmbedPadding + "Invite creator",
|
||||
value: trimLines(`
|
||||
Name: **${invite.inviter.tag}**
|
||||
Name: **${renderUsername(invite.inviter.username, invite.inviter.discriminator)}**
|
||||
ID: \`${invite.inviter.id}\`
|
||||
Mention: <@!${invite.inviter.id}>
|
||||
`),
|
||||
|
@ -139,7 +140,7 @@ export async function getInviteInfoEmbed(
|
|||
embed.fields.push({
|
||||
name: preEmbedPadding + "Invite creator",
|
||||
value: trimLines(`
|
||||
Name: **${invite.inviter.tag}**
|
||||
Name: **${renderUsername(invite.inviter.username, invite.inviter.discriminator)}**
|
||||
ID: \`${invite.inviter.id}\`
|
||||
Mention: <@!${invite.inviter.id}>
|
||||
`),
|
||||
|
|
|
@ -2,7 +2,15 @@ import { APIEmbed, MessageType, Snowflake, TextChannel } from "discord.js";
|
|||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildPluginData, getDefaultMessageCommandPrefix } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
import { EmbedWith, chunkMessageLines, messageLink, preEmbedPadding, trimEmptyLines, trimLines } from "../../../utils";
|
||||
import {
|
||||
EmbedWith,
|
||||
chunkMessageLines,
|
||||
messageLink,
|
||||
preEmbedPadding,
|
||||
renderUsername,
|
||||
trimEmptyLines,
|
||||
trimLines,
|
||||
} from "../../../utils";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { UtilityPluginType } from "../types";
|
||||
|
||||
|
@ -109,7 +117,7 @@ export async function getMessageInfoEmbed(
|
|||
embed.fields.push({
|
||||
name: preEmbedPadding + "Author information",
|
||||
value: trimLines(`
|
||||
Name: **${message.author.tag}**
|
||||
Name: **${renderUsername(message.author.username, message.author.discriminator)}**
|
||||
ID: \`${message.author.id}\`
|
||||
Created: **${authorAccountAge} ago** (\`${prettyAuthorCreatedAt}\`)
|
||||
${authorJoinedAt ? `Joined: **${authorServerAge} ago** (\`${prettyAuthorJoinedAt}\`)` : ""}
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
inviteHasCounts,
|
||||
memoize,
|
||||
preEmbedPadding,
|
||||
renderUsername,
|
||||
resolveInvite,
|
||||
resolveUser,
|
||||
trimLines,
|
||||
|
@ -66,7 +67,7 @@ export async function getServerInfoEmbed(
|
|||
|
||||
if (thisServer) {
|
||||
const owner = await resolveUser(pluginData.client, thisServer.ownerId);
|
||||
const ownerName = owner.tag;
|
||||
const ownerName = renderUsername(owner.username, owner.discriminator);
|
||||
|
||||
basicInformation.push(`Owner: **${ownerName}** (\`${thisServer.ownerId}\`)`);
|
||||
// basicInformation.push(`Voice region: **${thisServer.region}**`); Outdated, as automatic voice regions are fully live
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
EmbedWith,
|
||||
messageLink,
|
||||
preEmbedPadding,
|
||||
renderUsername,
|
||||
resolveMember,
|
||||
resolveUser,
|
||||
sorter,
|
||||
|
@ -43,7 +44,7 @@ export async function getUserInfoEmbed(
|
|||
const timeAndDate = pluginData.getPlugin(TimeAndDatePlugin);
|
||||
|
||||
embed.author = {
|
||||
name: `${user.bot ? "Bot" : "User"}: ${user.tag}`,
|
||||
name: `${user.bot ? "Bot" : "User"}: ${renderUsername(user.username, user.discriminator)}`,
|
||||
};
|
||||
|
||||
const avatarURL = user.displayAvatarURL();
|
||||
|
@ -89,14 +90,16 @@ export async function getUserInfoEmbed(
|
|||
return embed;
|
||||
}
|
||||
|
||||
const userInfoLines = [`ID: \`${user.id}\``, `Username: **${user.username}**`];
|
||||
if (user.discriminator !== "0") {
|
||||
userInfoLines.push(`Discriminator: **${user.discriminator}**`);
|
||||
}
|
||||
userInfoLines.push(`Created: **${accountAge} ago** (\`${prettyCreatedAt}\`)`);
|
||||
userInfoLines.push(`Mention: <@!${user.id}>`);
|
||||
|
||||
embed.fields.push({
|
||||
name: preEmbedPadding + `${user.bot ? "Bot" : "User"} information`,
|
||||
value: trimLines(`
|
||||
Name: **${user.tag}**
|
||||
ID: \`${user.id}\`
|
||||
Created: **${accountAge} ago** (\`${prettyCreatedAt}\`)
|
||||
Mention: <@!${user.id}>
|
||||
`),
|
||||
value: userInfoLines.join("\n"),
|
||||
});
|
||||
|
||||
if (member) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue