chore(friendInvites): improve descriptions formatting (#628)

This commit is contained in:
afn 2023-03-20 22:13:11 -04:00 committed by GitHub
parent e36f4e5b0a
commit 87e46f5a5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,7 +23,7 @@ import { findByProps } from "@webpack";
export default definePlugin({ export default definePlugin({
name: "FriendInvites", name: "FriendInvites",
description: "Generate and manage friend invite links.", description: "Create and manage friend invite links via slash commands (/create friend invite, /view friend invites, /revoke friend invites).",
authors: [Devs.afn], authors: [Devs.afn],
dependencies: ["CommandsAPI"], dependencies: ["CommandsAPI"],
commands: [ commands: [
@ -37,8 +37,8 @@ export default definePlugin({
return void sendBotMessage(ctx.channel.id, { return void sendBotMessage(ctx.channel.id, {
content: ` content: `
discord.gg/${createInvite.code} discord.gg/${createInvite.code} ·
Expires: <t:${new Date(createInvite.expires_at).getTime() / 1000}:R> Expires: <t:${new Date(createInvite.expires_at).getTime() / 1000}:R> ·
Max uses: \`${createInvite.max_uses}\` Max uses: \`${createInvite.max_uses}\`
`.trim().replace(/\s+/g, " ") `.trim().replace(/\s+/g, " ")
}); });
@ -52,25 +52,25 @@ export default definePlugin({
const friendInvites = findByProps("createFriendInvite"); const friendInvites = findByProps("createFriendInvite");
const invites = await friendInvites.getAllFriendInvites(); const invites = await friendInvites.getAllFriendInvites();
const friendInviteList = invites.map(i => const friendInviteList = invites.map(i =>
`_discord.gg/${i.code}_ `_discord.gg/${i.code}_ ·
Expires: <t:${new Date(i.expires_at).getTime() / 1000}:R> Expires: <t:${new Date(i.expires_at).getTime() / 1000}:R> ·
Times used: \`${i.uses}/${i.max_uses}\``.trim().replace(/\s+/g, " ") Times used: \`${i.uses}/${i.max_uses}\``.trim().replace(/\s+/g, " ")
); );
return void sendBotMessage(ctx.channel.id, { return void sendBotMessage(ctx.channel.id, {
content: friendInviteList.join("\n\n") || "You have no active friend invites!" content: friendInviteList.join("\n") || "You have no active friend invites!"
}); });
}, },
}, },
{ {
name: "revoke friend invites", name: "revoke friend invites",
description: "Revokes ALL generated friend invite links.", description: "Revokes all generated friend invites.",
inputType: ApplicationCommandInputType.BOT, inputType: ApplicationCommandInputType.BOT,
execute: async (_, ctx) => { execute: async (_, ctx) => {
await findByProps("createFriendInvite").revokeFriendInvites(); await findByProps("createFriendInvite").revokeFriendInvites();
return void sendBotMessage(ctx.channel.id, { return void sendBotMessage(ctx.channel.id, {
content: "All friend links have been revoked." content: "All friend invites have been revoked."
}); });
}, },
}, },