utility.linvite: add boosts, invite expiry and welcome screen
This commit is contained in:
parent
7b289b0863
commit
de999f1858
1 changed files with 32 additions and 5 deletions
|
@ -292,7 +292,7 @@ lookupinvite.callback = async function (msg, line) {
|
||||||
try {
|
try {
|
||||||
invite = await hf.bot.requestHandler.request(
|
invite = await hf.bot.requestHandler.request(
|
||||||
"GET",
|
"GET",
|
||||||
`/invites/${line}?with_counts=1`
|
`/invites/${line}?with_counts=true&with_expiration=true`
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
bail = true;
|
bail = true;
|
||||||
|
@ -328,11 +328,38 @@ lookupinvite.callback = async function (msg, line) {
|
||||||
value: `**${invite.channel.name}** (${invite.channel.id})`,
|
value: `**${invite.channel.name}** (${invite.channel.id})`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Boosts",
|
||||||
|
value: invite.guild.premium_subscription_count ?? 0,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Expires",
|
||||||
|
value:
|
||||||
|
invite.expires_at == null
|
||||||
|
? "Never"
|
||||||
|
: `<t:${Math.floor(new Date(invite.expires_at).getTime / 1000)}>`,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Member Count",
|
name: "Member Count",
|
||||||
value: `${STATUS_ICONS.online}${invite.approximate_presence_count} online\t\t${STATUS_ICONS.offline}${invite.approximate_member_count} members`,
|
value: `${STATUS_ICONS.online}${invite.approximate_presence_count} online\t\t${STATUS_ICONS.offline}${invite.approximate_member_count} members`,
|
||||||
inline: false,
|
inline: false,
|
||||||
},
|
},
|
||||||
|
invite.welcome_screen && {
|
||||||
|
name: "Welcome Screen",
|
||||||
|
value: `"${
|
||||||
|
invite.welcome_screen.description
|
||||||
|
}"\n${invite.welcome_screen.welcome_channels.map(
|
||||||
|
(c) =>
|
||||||
|
`${
|
||||||
|
c.emoji_id
|
||||||
|
? `[:${c.emoji_name}:](${EMOTE_BASE}${c.emoji_id}.webp)`
|
||||||
|
: c.emoji_name
|
||||||
|
} ${c.description} \`(${c.channel_id})\``
|
||||||
|
)}`,
|
||||||
|
inline: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Features",
|
name: "Features",
|
||||||
value:
|
value:
|
||||||
|
@ -348,7 +375,7 @@ lookupinvite.callback = async function (msg, line) {
|
||||||
: "None",
|
: "None",
|
||||||
inline: false,
|
inline: false,
|
||||||
},
|
},
|
||||||
],
|
].filter((x) => !!x),
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url:
|
url:
|
||||||
invite.guild.icon &&
|
invite.guild.icon &&
|
||||||
|
@ -761,9 +788,9 @@ presence.callback = async function (msg, line) {
|
||||||
|
|
||||||
if (activity.emoji) {
|
if (activity.emoji) {
|
||||||
if (activity.emoji.id) {
|
if (activity.emoji.id) {
|
||||||
const url = `https://cdn.discordapp.com/emojis/${
|
const url = `${EMOTE_BASE}${activity.emoji.id}.${
|
||||||
activity.emoji.id
|
activity.emoji.animated ? "gif" : "png"
|
||||||
}.${activity.emoji.animated ? "gif" : "png"}`;
|
}`;
|
||||||
embed.author = {
|
embed.author = {
|
||||||
url,
|
url,
|
||||||
icon_url: url,
|
icon_url: url,
|
||||||
|
|
Loading…
Reference in a new issue