!invite: add invite creator information when available
This commit is contained in:
parent
0dc629ca84
commit
ff056def4a
1 changed files with 30 additions and 1 deletions
|
@ -4,7 +4,14 @@ import { BaseInvite, Constants, EmbedOptions, RESTChannelInvite, RESTPrivateInvi
|
||||||
import { snowflakeToTimestamp } from "../../../utils/snowflakeToTimestamp";
|
import { snowflakeToTimestamp } from "../../../utils/snowflakeToTimestamp";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import humanizeDuration from "humanize-duration";
|
import humanizeDuration from "humanize-duration";
|
||||||
import { emptyEmbedValue, formatNumber, isRESTGroupDMInvite, isRESTGuildInvite, resolveInvite } from "../../../utils";
|
import {
|
||||||
|
emptyEmbedValue,
|
||||||
|
formatNumber,
|
||||||
|
isRESTGroupDMInvite,
|
||||||
|
isRESTGuildInvite,
|
||||||
|
resolveInvite,
|
||||||
|
trimLines,
|
||||||
|
} from "../../../utils";
|
||||||
|
|
||||||
export async function getInviteInfoEmbed(
|
export async function getInviteInfoEmbed(
|
||||||
pluginData: PluginData<UtilityPluginType>,
|
pluginData: PluginData<UtilityPluginType>,
|
||||||
|
@ -61,6 +68,17 @@ export async function getInviteInfoEmbed(
|
||||||
inline: true,
|
inline: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (invite.inviter) {
|
||||||
|
embed.fields.push({
|
||||||
|
name: "Invite creator",
|
||||||
|
value: trimLines(`
|
||||||
|
<@!${invite.inviter.id}>
|
||||||
|
${invite.inviter.username}#${invite.inviter.discriminator}
|
||||||
|
\`${invite.inviter.id}\`
|
||||||
|
`),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return embed;
|
return embed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +105,17 @@ export async function getInviteInfoEmbed(
|
||||||
value: formatNumber((invite as any).memberCount),
|
value: formatNumber((invite as any).memberCount),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (invite.inviter) {
|
||||||
|
embed.fields.push({
|
||||||
|
name: "Invite creator",
|
||||||
|
value: trimLines(`
|
||||||
|
<@!${invite.inviter.id}>
|
||||||
|
${invite.inviter.username}#${invite.inviter.discriminator}
|
||||||
|
\`${invite.inviter.id}\`
|
||||||
|
`),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return embed;
|
return embed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue