aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json13
-rw-r--r--src/bot.ts1
-rw-r--r--src/commands/info/userInfo.ts26
-rw-r--r--src/commands/moulberry-bush/report.ts23
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts8
-rw-r--r--yarn.lock12
6 files changed, 36 insertions, 47 deletions
diff --git a/package.json b/package.json
index 138415f..7194374 100644
--- a/package.json
+++ b/package.json
@@ -34,17 +34,17 @@
"build:esbuild": "yarn rimraf dist && yarn esbuild --sourcemap=inline --outdir=dist --platform=node --target=es2020 --format=esm --log-level=warning src/**/*.ts",
"build:tsc": "yarn rimraf dist && yarn tsc",
"build:tsc:no-emit": "yarn rimraf dist && yarn tsc --noEmit",
- "_start": "yarn build:esbuild && node --experimental-json-modules --no-warnings dist/src/bot.js",
- "start": "yarn build:tsc && node --experimental-json-modules --no-warnings dist/src/bot.js",
- "start:dry": "yarn build:tsc && node --experimental-json-modules --no-warnings dist/src/bot.js dry",
- "dev": "yarn build:tsc && node --experimental-json-modules --no-warnings dist/src/bot.js",
+ "_start": "yarn build:esbuild && node --enable-source-maps --experimental-json-modules --no-warnings dist/src/bot.js",
+ "start": "yarn build:tsc && node --enable-source-maps --experimental-json-modules --no-warnings dist/src/bot.js",
+ "start:dry": "yarn build:tsc && node --enable-source-maps --experimental-json-modules --no-warnings dist/src/bot.js dry",
+ "dev": "yarn build:tsc && node --enable-source-maps --experimental-json-modules --no-warnings dist/src/bot.js",
"test": "yarn lint && yarn tsc --noEmit",
"format": "yarn prettier . --write",
"lint": "yarn eslint --ext js,jsx,ts,tsx src",
"format:check": "yarn prettier . --check",
"upgrade": "yarn rimraf yarn.lock && yarn cache clean && yarn install && yarn up && yarn up -R && yarn set version latest",
"upgrade:sdk": "yarn dlx @yarnpkg/sdks vscode",
- "upgrade:manual": "yarn add @notenoughupdates/discord.js-minesweeper @notenoughupdates/events-intercept @notenoughupdates/humanize-duration @notenoughupdates/simplify-number @notenoughupdates/wolfram-alpha-api @sentry/integrations @sentry/node @sentry/tracing canvas chalk deep-lock discord-akairo@npm:@notenoughupdates/discord-akairo@dev discord.js@npm:@notenoughupdates/discord.js@dev fuse.js got lodash mathjs moment nanoid node-os-utils numeral pg pg-hstore prettier pretty-bytes rimraf sequelize source-map-support tinycolor2 tslib typescript vm2 && yarn add --dev @types/express @types/lodash @types/node @types/node-os-utils @types/numeral @types/tinycolor2 @types/validator @typescript-eslint/eslint-plugin @typescript-eslint/parser discord-api-types@0.26.1 eslint eslint-config-prettier node-fetch",
+ "upgrade:manual": "yarn add @notenoughupdates/discord.js-minesweeper @notenoughupdates/events-intercept @notenoughupdates/humanize-duration @notenoughupdates/simplify-number @notenoughupdates/wolfram-alpha-api @sentry/integrations @sentry/node @sentry/tracing canvas chalk deep-lock discord-akairo@npm:@notenoughupdates/discord-akairo@dev discord.js@npm:@notenoughupdates/discord.js@dev fuse.js got lodash mathjs nanoid node-os-utils numeral pg pg-hstore prettier pretty-bytes rimraf sequelize tinycolor2 tslib typescript vm2 && yarn add --dev @types/express @types/lodash @types/node @types/node-os-utils @types/numeral @types/tinycolor2 @types/validator @typescript-eslint/eslint-plugin @typescript-eslint/parser discord-api-types@0.26.1 eslint eslint-config-prettier node-fetch",
"upgrade:package": "powershell -c \"yarn info --name-only | %{\\$_ -replace '^(?:├─ |└─ )?(@?[a-z0-9-~][a-z0-9-._~/]{0,}(?=.*(npm:(?!.*dev)|patch:.*?@npm).*))|.*\\$','\\$1'} | where{[string]::IsNullOrEmpty(\\$_) -eq \\$false} | yarn add\"",
"beta": "git push && git checkout beta && git merge master && git push && git checkout master",
"deploy:beta": "pm2 deploy ecosystem.config.cjs beta",
@@ -70,7 +70,6 @@
"got": "^12.0.1",
"lodash": "^4.17.21",
"mathjs": "^10.1.0",
- "moment": "^2.29.1",
"nanoid": "^3.2.0",
"node-os-utils": "^1.3.6",
"numeral": "^2.0.6",
@@ -80,7 +79,6 @@
"pretty-bytes": "^5.6.0",
"rimraf": "^3.0.2",
"sequelize": "6.13.0",
- "source-map-support": "^0.5.21",
"tinycolor2": "^1.4.2",
"tslib": "^2.3.1",
"typescript": "^4.5.5",
@@ -96,7 +94,6 @@
"@types/pg": "^8",
"@types/prettier": "^2",
"@types/rimraf": "^3",
- "@types/source-map-support": "^0",
"@types/tinycolor2": "^1.4.3",
"@types/validator": "^13.7.1",
"@typescript-eslint/eslint-plugin": "^5.10.2",
diff --git a/src/bot.ts b/src/bot.ts
index 56a6148..27a86d6 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -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.
diff --git a/yarn.lock b/yarn.lock
index 8e4840f..12f21a2 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -555,15 +555,6 @@ __metadata:
languageName: node
linkType: hard
-"@types/source-map-support@npm:^0":
- version: 0.5.4
- resolution: "@types/source-map-support@npm:0.5.4"
- dependencies:
- source-map: ^0.6.0
- checksum: 160ff77e8a101b18d9915cb5320fd73d484679aef8518ce007b9b5988e333631778730196c4bb15517ff881bee805663fd8640c0ce2ebfab65f061103c452369
- languageName: node
- linkType: hard
-
"@types/tinycolor2@npm:^1.4.3":
version: 1.4.3
resolution: "@types/tinycolor2@npm:1.4.3"
@@ -897,7 +888,6 @@ __metadata:
"@types/pg": ^8
"@types/prettier": ^2
"@types/rimraf": ^3
- "@types/source-map-support": ^0
"@types/tinycolor2": ^1.4.3
"@types/validator": ^13.7.1
"@typescript-eslint/eslint-plugin": ^5.10.2
@@ -915,7 +905,6 @@ __metadata:
got: ^12.0.1
lodash: ^4.17.21
mathjs: ^10.1.0
- moment: ^2.29.1
nanoid: ^3.2.0
node-fetch: ^3.2.0
node-os-utils: ^1.3.6
@@ -926,7 +915,6 @@ __metadata:
pretty-bytes: ^5.6.0
rimraf: ^3.0.2
sequelize: 6.13.0
- source-map-support: ^0.5.21
tinycolor2: ^1.4.2
tslib: ^2.3.1
typescript: ^4.5.5