diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-04 14:40:16 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-04 14:40:16 -0500 |
commit | 19c0a3709156056fd092c2a43b1b47cf29f3b65f (patch) | |
tree | 8f4d3292a5b78ca0e92c14cab8229b2a37fc8dfb /src | |
parent | d5d5fd6f77f2d778ab099d52f1acaad762712822 (diff) | |
download | tanzanite-19c0a3709156056fd092c2a43b1b47cf29f3b65f.tar.gz tanzanite-19c0a3709156056fd092c2a43b1b47cf29f3b65f.tar.bz2 tanzanite-19c0a3709156056fd092c2a43b1b47cf29f3b65f.zip |
remove source-map-support and moment
Diffstat (limited to 'src')
-rw-r--r-- | src/bot.ts | 1 | ||||
-rw-r--r-- | src/commands/info/userInfo.ts | 26 | ||||
-rw-r--r-- | src/commands/moulberry-bush/report.ts | 23 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 8 |
4 files changed, 31 insertions, 27 deletions
@@ -1,5 +1,4 @@ import { dirname } from 'path'; -import 'source-map-support/register.js'; import { fileURLToPath } from 'url'; import config from './config/options.js'; import { Sentry } from './lib/common/Sentry.js'; diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 74f8185..97cdc30 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -118,11 +118,12 @@ export default class UserInfoCommand extends BushCommand { } private static async generateGeneralInfoField(embed: Embed, user: BushUser) { - const createdAt = util.timestamp(user.createdAt, 'd'), - createdAtDelta = util.dateDelta(user.createdAt); - // General Info - const generalInfo = [`**Mention:** <@${user.id}>`, `**ID:** ${user.id}`, `**Created:** ${createdAt} (${createdAtDelta} ago)`]; + const generalInfo = [ + `**Mention:** <@${user.id}>`, + `**ID:** ${user.id}`, + `**Created:** ${util.timestampAndDelta(user.createdAt)}` + ]; if (user.accentColor !== null) generalInfo.push(`**Accent Color:** ${user.hexAccentColor}`); if (user.banner) generalInfo.push(`**Banner:** [link](${user.bannerURL({ extension: 'png', size: 4096 })})`); @@ -136,24 +137,21 @@ export default class UserInfoCommand extends BushCommand { private static generateServerInfoField(embed: Embed, member?: BushGuildMember | undefined) { if (!member) return; - const joinedAt = util.timestamp(member?.joinedAt, 'd'), - joinedAtDelta = member.joinedAt ? util.dateDelta(member.joinedAt, 2) : undefined, - premiumSince = util.timestamp(member?.premiumSince, 'd'), - premiumSinceDelta = member.premiumSince ? util.dateDelta(member.premiumSince, 2) : undefined; - // Server User Info const serverUserInfo = []; - if (joinedAt) + if (member.joinedTimestamp) serverUserInfo.push( - `**${member.guild!.ownerId == member.user.id ? 'Created Server' : 'Joined'}:** ${joinedAt} (${joinedAtDelta} ago)` + `**${member.guild!.ownerId == member.user.id ? 'Created Server' : 'Joined'}:** ${util.timestampAndDelta( + member.joinedAt! + )}` ); - if (premiumSince) serverUserInfo.push(`**Boosting Since:** ${premiumSince} (${premiumSinceDelta} ago)`); - if (member?.displayHexColor) serverUserInfo.push(`**Display Color:** ${member.displayHexColor}`); + if (member.premiumSince) serverUserInfo.push(`**Boosting Since:** ${util.timestampAndDelta(member.premiumSince)}`); + if (member.displayHexColor) serverUserInfo.push(`**Display Color:** ${member.displayHexColor}`); if (member.user.id == '322862723090219008' && member.guild?.id == client.consts.mappings.guilds.bush) serverUserInfo.push(`**General Deletions:** 1⅓`); if ( (['384620942577369088', '496409778822709251'] as const).includes(member.user.id) && - member.guild?.id == client.consts.mappings.guilds.bush + member.guild.id == client.consts.mappings.guilds.bush ) serverUserInfo.push(`**General Deletions:** ⅓`); if (member?.nickname) serverUserInfo.push(`**Nickname:** ${util.discord.escapeMarkdown(member?.nickname)}`); diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 7b3e729..becdeeb 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -1,9 +1,5 @@ import { AllowedMentions, BushCommand, type ArgType, type BushMessage } from '#lib'; -import assert from 'assert'; import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js'; -import moment from 'moment'; - -assert(moment); export default class ReportCommand extends BushCommand { public constructor() { @@ -74,18 +70,21 @@ export default class ReportCommand extends BushCommand { .setDescription(evidence) .addField({ name: 'Reporter', - value: `**Name:**${message.author.tag} <@${message.author.id}>\n**Joined:** ${moment( - message.member!.joinedTimestamp - ).fromNow()}\n**Created:** ${moment(message.author.createdTimestamp).fromNow()}\n**Sent From**: <#${ - message.channel.id - }> [Jump to context](${message.url})`, + value: [ + `**Name:**${message.author.tag} <@${message.author.id}>`, + `**Joined:** $${util.timestampAndDelta(message.member!.joinedAt!)}`, + `**Created:** ${util.timestampAndDelta(message.author.createdAt)}`, + `**Sent From**: <#${message.channel.id}> [Jump to context](${message.url})` + ].join('\n'), inline: true }) .addField({ name: 'Reported User', - value: `**Name:**${member.user.tag} <@${member.user.id}>\n**Joined:** ${moment( - member.joinedTimestamp - ).fromNow()}\n**Created:** ${moment(member.user.createdTimestamp).fromNow()}`, + value: [ + `**Name:**${member.user.tag} <@${member.user.id}>`, + `**Joined:** $${util.timestampAndDelta(member.joinedAt!)}`, + `**Created:** ${util.timestampAndDelta(member.user.createdAt)}` + ].join('\n'), inline: true }); diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 6889ae0..c3739d6 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -612,6 +612,14 @@ export class BushClientUtil extends ClientUtil { } /** + * Combines {@link timestamp} and {@link dateDelta} + * @param date The date to be compared with the current time. + */ + public timestampAndDelta(date: Date): string { + return `${this.timestamp(date)} (${this.dateDelta(date)} ago)`; + } + + /** * Convert a hex code to an rbg value. * @param hex The hex code to convert. * @returns The rbg value. |