diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-05 23:24:51 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-05 23:24:51 -0400 |
commit | 1feb515882cfbbf33dc98d75a54898c1735cf5cb (patch) | |
tree | 20386e9d6ca6b5cb978283d672528c03647ec32f /src/commands/info | |
parent | e68a0193b9f5888455f631d72c8783fc50e35faf (diff) | |
parent | 060349fcabe9e073eca9f6fd334e3355a9756096 (diff) | |
download | tanzanite-1feb515882cfbbf33dc98d75a54898c1735cf5cb.tar.gz tanzanite-1feb515882cfbbf33dc98d75a54898c1735cf5cb.tar.bz2 tanzanite-1feb515882cfbbf33dc98d75a54898c1735cf5cb.zip |
Merge branch 'wip'
Diffstat (limited to 'src/commands/info')
-rw-r--r-- | src/commands/info/botInfo.ts | 2 | ||||
-rw-r--r-- | src/commands/info/color.ts | 2 | ||||
-rw-r--r-- | src/commands/info/guildInfo.ts | 2 | ||||
-rw-r--r-- | src/commands/info/help.ts | 2 | ||||
-rw-r--r-- | src/commands/info/icon.ts | 2 | ||||
-rw-r--r-- | src/commands/info/inviteInfo.ts | 43 | ||||
-rw-r--r-- | src/commands/info/links.ts | 2 | ||||
-rw-r--r-- | src/commands/info/userInfo.ts | 6 |
8 files changed, 52 insertions, 9 deletions
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index f284e0f..d84fd4e 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -7,7 +7,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { EmbedBuilder, PermissionFlagsBits, version as discordJSVersion } from 'discord.js'; import * as os from 'os'; const { default: prettyBytes } = await import('pretty-bytes'); diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index 7286c5c..7601562 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -8,7 +8,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, GuildMember, PermissionFlagsBits, Role } from 'discord.js'; import tinycolor from 'tinycolor2'; assert(tinycolor); diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index dd5704f..e67cdf4 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -12,7 +12,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, ChannelType, diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 1a8eae5..492f25d 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -9,7 +9,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ActionRowBuilder, ApplicationCommandOptionType, diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts index e66f900..b3434ec 100644 --- a/src/commands/info/icon.ts +++ b/src/commands/info/icon.ts @@ -1,5 +1,5 @@ import { BushCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { EmbedBuilder, escapeMarkdown, PermissionFlagsBits } from 'discord.js'; export default class IconCommand extends BushCommand { diff --git a/src/commands/info/inviteInfo.ts b/src/commands/info/inviteInfo.ts new file mode 100644 index 0000000..5df86ad --- /dev/null +++ b/src/commands/info/inviteInfo.ts @@ -0,0 +1,43 @@ +import { Arg, ArgType, BushCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; +import { ApplicationCommandOptionType, EmbedBuilder, Invite, PermissionFlagsBits } from 'discord.js'; + +export default class InviteInfoCommand extends BushCommand { + public constructor() { + super('inviteInfo', { + aliases: ['invite-info', 'ii'], + category: 'info', + description: 'Get info about an invite.', + usage: ['invite-info [invite]'], + examples: ['invite-info discord.gg/moulberry'], + args: [ + { + id: 'invite', + description: 'The guild to find information about.', + type: 'invite', + prompt: 'What invite would you like to find information about?', + retry: '{error} Choose a valid invite to find information about.', + slashType: ApplicationCommandOptionType.String + } + ], + slash: true, + clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + userPermissions: [] + }); + } + + public override async exec(message: CommandMessage | SlashMessage, args: { invite: ArgType<'invite' | 'string'> }) { + const invite = message.util.isSlashMessage(message) + ? ((await Arg.cast('invite', message, args.invite as string)) as ArgType<'invite'>) + : (args.invite as Invite); + + const inviteInfoEmbed = new EmbedBuilder().setTitle(`Invite to ${invite.guild!.name}`).setColor(colors.default); + + this.generateAboutField(inviteInfoEmbed, invite); + } + + private generateAboutField(embed: EmbedBuilder, invite: Invite) { + const about = [`**code:** ${invite.code}`, `**channel:** ${invite.channel!.name}`]; + + embed.addFields({ name: '» About', value: about.join('\n') }); + } +} diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts index 3c7add2..3dbdbef 100644 --- a/src/commands/info/links.ts +++ b/src/commands/info/links.ts @@ -1,5 +1,5 @@ import { BushCommand, clientSendAndPermCheck, invite, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; import packageDotJSON from '../../../package.json' assert { type: 'json' }; diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 3479ea3..7b67816 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -162,11 +162,11 @@ export default class UserInfoCommand extends BushCommand { ); if (member.premiumSince) serverUserInfo.push(`**Booster Since:** ${timestampAndDelta(member.premiumSince, 'd')}`); if (member.displayHexColor) serverUserInfo.push(`**Display Color:** ${member.displayHexColor}`); - if (member.user.id == '322862723090219008' && member.guild?.id == mappings.guilds.bush) + if (member.user.id == mappings.users['IRONM00N'] && member.guild?.id == mappings.guilds["Moulberry's Bush"]) serverUserInfo.push(`**General Deletions:** 1⅓`); if ( - (['384620942577369088', '496409778822709251'] as const).includes(member.user.id) && - member.guild.id == mappings.guilds.bush + ([mappings.users['nopo'], mappings.users['Bestower']] as const).includes(member.user.id) && + member.guild.id == mappings.guilds["Moulberry's Bush"] ) serverUserInfo.push(`**General Deletions:** ⅓`); if (member?.nickname) serverUserInfo.push(`**Nickname:** ${escapeMarkdown(member?.nickname)}`); |