1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-12-25 23:15:38 -05:00

Compare commits

...

3 Commits

Author SHA1 Message Date
toast-ts
e188c54b67 Allow power operator to regex 2024-11-29 10:41:48 +11:00
toast-ts
32d5dc27e0 Push uncommitted change 2024-11-29 10:39:16 +11:00
toast-ts
024ef0114e Update deps 2024-11-25 14:13:11 +11:00
5 changed files with 77 additions and 67 deletions

View File

@ -1,5 +1,5 @@
FROM node:22.7-alpine3.20 FROM node:22.7-alpine3.20
ENV YARN_VERSION="4.5.1" ENV YARN_VERSION="4.5.2"
ENV TZ="Australia/Sydney" ENV TZ="Australia/Sydney"
ENV NODE_COMPILE_CACHE="/Daggerbot/build_cache" ENV NODE_COMPILE_CACHE="/Daggerbot/build_cache"
RUN yarn policies set-version $YARN_VERSION RUN yarn policies set-version $YARN_VERSION

View File

@ -7,7 +7,7 @@ services:
- 6379:6379/tcp - 6379:6379/tcp
db: db:
container_name: daggerbot-postgres container_name: daggerbot-postgres
image: postgres:16.4-alpine3.20 image: postgres:16.6-alpine3.20
restart: unless-stopped restart: unless-stopped
ports: ports:
- 5432:5432/tcp - 5432:5432/tcp

View File

@ -25,9 +25,9 @@
"npm": "NPM isn't supported, please use Yarn instead." "npm": "NPM isn't supported, please use Yarn instead."
}, },
"engineStrict": true, "engineStrict": true,
"packageManager": "yarn@4.5.1+sha512.341db9396b6e289fecc30cd7ab3af65060e05ebff4b3b47547b278b9e67b08f485ecd8c79006b405446262142c7a38154445ef7f17c1d5d1de7d90bf9ce7054d", "packageManager": "yarn@4.5.2+sha512.570504f67349ef26d2d86a768dc5ec976ead977aa086b0bb4237e97d5db7ae5c620f9f0e0edf3ea5047205063faff102bf2a2d778664a94eaaa1085ad483fe2e",
"dependencies": { "dependencies": {
"@napi-rs/canvas": "0.1.62", "@napi-rs/canvas": "0.1.63",
"@octokit/rest": "21.0.2", "@octokit/rest": "21.0.2",
"@sequelize/core": "7.0.0-alpha.43", "@sequelize/core": "7.0.0-alpha.43",
"@sequelize/postgres": "7.0.0-alpha.43", "@sequelize/postgres": "7.0.0-alpha.43",
@ -36,7 +36,7 @@
"dayjs": "1.11.13", "dayjs": "1.11.13",
"discord.js": "14.16.3", "discord.js": "14.16.3",
"fast-xml-parser": "4.5.0", "fast-xml-parser": "4.5.0",
"mathjs": "13.2.2", "mathjs": "14.0.0",
"ms": "2.1.3", "ms": "2.1.3",
"node-cron": "3.0.3", "node-cron": "3.0.3",
"redis": "4.7.0", "redis": "4.7.0",
@ -46,7 +46,7 @@
}, },
"devDependencies": { "devDependencies": {
"@types/ms": "0.7.34", "@types/ms": "0.7.34",
"@types/node": "22.9.0", "@types/node": "22.9.3",
"@types/node-cron": "3.0.11", "@types/node-cron": "3.0.11",
"typescript": "5.5.4" "typescript": "5.5.4"
} }

View File

@ -7,7 +7,7 @@ import * as math from 'mathjs';// I hate this, but it doesn't provide a default
export default class Calculator { export default class Calculator {
static run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ static run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
const now = Date.now(); const now = Date.now();
const exp = interaction.options.getString('expression', true).replace(/[^-()\d/*+.]/g, ''); const exp = interaction.options.getString('expression', true).replace(/[^-()\d/*+.^]/g, '');
try { try {
let result:math.EvalFunction; let result:math.EvalFunction;
switch (exp) { switch (exp) {
@ -23,7 +23,7 @@ export default class Calculator {
'Imagine that you have zero cookies and you split them evenly among zero friends.', 'Imagine that you have zero cookies and you split them evenly among zero friends.',
'How many cookies does each person get? See? It doesn\'t make sense.', 'How many cookies does each person get? See? It doesn\'t make sense.',
'And Cookie Monster is sad that there are no cookies, and you are sad that you have no friends.', 'And Cookie Monster is sad that there are no cookies, and you are sad that you have no friends.',
'-- Siri, 2015' '𑁋 Siri, 2015'
)); ));
default: default:
result = math.evaluate(exp); result = math.evaluate(exp);

128
yarn.lock
View File

@ -109,82 +109,90 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@napi-rs/canvas-android-arm64@npm:0.1.62": "@napi-rs/canvas-android-arm64@npm:0.1.63":
version: 0.1.62 version: 0.1.63
resolution: "@napi-rs/canvas-android-arm64@npm:0.1.62" resolution: "@napi-rs/canvas-android-arm64@npm:0.1.63"
conditions: os=android & cpu=arm64 conditions: os=android & cpu=arm64
languageName: node languageName: node
linkType: hard linkType: hard
"@napi-rs/canvas-darwin-arm64@npm:0.1.62": "@napi-rs/canvas-darwin-arm64@npm:0.1.63":
version: 0.1.62 version: 0.1.63
resolution: "@napi-rs/canvas-darwin-arm64@npm:0.1.62" resolution: "@napi-rs/canvas-darwin-arm64@npm:0.1.63"
conditions: os=darwin & cpu=arm64 conditions: os=darwin & cpu=arm64
languageName: node languageName: node
linkType: hard linkType: hard
"@napi-rs/canvas-darwin-x64@npm:0.1.62": "@napi-rs/canvas-darwin-x64@npm:0.1.63":
version: 0.1.62 version: 0.1.63
resolution: "@napi-rs/canvas-darwin-x64@npm:0.1.62" resolution: "@napi-rs/canvas-darwin-x64@npm:0.1.63"
conditions: os=darwin & cpu=x64 conditions: os=darwin & cpu=x64
languageName: node languageName: node
linkType: hard linkType: hard
"@napi-rs/canvas-linux-arm-gnueabihf@npm:0.1.62": "@napi-rs/canvas-linux-arm-gnueabihf@npm:0.1.63":
version: 0.1.62 version: 0.1.63
resolution: "@napi-rs/canvas-linux-arm-gnueabihf@npm:0.1.62" resolution: "@napi-rs/canvas-linux-arm-gnueabihf@npm:0.1.63"
conditions: os=linux & cpu=arm conditions: os=linux & cpu=arm
languageName: node languageName: node
linkType: hard linkType: hard
"@napi-rs/canvas-linux-arm64-gnu@npm:0.1.62": "@napi-rs/canvas-linux-arm64-gnu@npm:0.1.63":
version: 0.1.62 version: 0.1.63
resolution: "@napi-rs/canvas-linux-arm64-gnu@npm:0.1.62" resolution: "@napi-rs/canvas-linux-arm64-gnu@npm:0.1.63"
conditions: os=linux & cpu=arm64 & libc=glibc conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node languageName: node
linkType: hard linkType: hard
"@napi-rs/canvas-linux-arm64-musl@npm:0.1.62": "@napi-rs/canvas-linux-arm64-musl@npm:0.1.63":
version: 0.1.62 version: 0.1.63
resolution: "@napi-rs/canvas-linux-arm64-musl@npm:0.1.62" resolution: "@napi-rs/canvas-linux-arm64-musl@npm:0.1.63"
conditions: os=linux & cpu=arm64 & libc=musl conditions: os=linux & cpu=arm64 & libc=musl
languageName: node languageName: node
linkType: hard linkType: hard
"@napi-rs/canvas-linux-x64-gnu@npm:0.1.62": "@napi-rs/canvas-linux-riscv64-gnu@npm:0.1.63":
version: 0.1.62 version: 0.1.63
resolution: "@napi-rs/canvas-linux-x64-gnu@npm:0.1.62" resolution: "@napi-rs/canvas-linux-riscv64-gnu@npm:0.1.63"
conditions: os=linux & cpu=riscv64 & libc=glibc
languageName: node
linkType: hard
"@napi-rs/canvas-linux-x64-gnu@npm:0.1.63":
version: 0.1.63
resolution: "@napi-rs/canvas-linux-x64-gnu@npm:0.1.63"
conditions: os=linux & cpu=x64 & libc=glibc conditions: os=linux & cpu=x64 & libc=glibc
languageName: node languageName: node
linkType: hard linkType: hard
"@napi-rs/canvas-linux-x64-musl@npm:0.1.62": "@napi-rs/canvas-linux-x64-musl@npm:0.1.63":
version: 0.1.62 version: 0.1.63
resolution: "@napi-rs/canvas-linux-x64-musl@npm:0.1.62" resolution: "@napi-rs/canvas-linux-x64-musl@npm:0.1.63"
conditions: os=linux & cpu=x64 & libc=musl conditions: os=linux & cpu=x64 & libc=musl
languageName: node languageName: node
linkType: hard linkType: hard
"@napi-rs/canvas-win32-x64-msvc@npm:0.1.62": "@napi-rs/canvas-win32-x64-msvc@npm:0.1.63":
version: 0.1.62 version: 0.1.63
resolution: "@napi-rs/canvas-win32-x64-msvc@npm:0.1.62" resolution: "@napi-rs/canvas-win32-x64-msvc@npm:0.1.63"
conditions: os=win32 & cpu=x64 conditions: os=win32 & cpu=x64
languageName: node languageName: node
linkType: hard linkType: hard
"@napi-rs/canvas@npm:0.1.62": "@napi-rs/canvas@npm:0.1.63":
version: 0.1.62 version: 0.1.63
resolution: "@napi-rs/canvas@npm:0.1.62" resolution: "@napi-rs/canvas@npm:0.1.63"
dependencies: dependencies:
"@napi-rs/canvas-android-arm64": "npm:0.1.62" "@napi-rs/canvas-android-arm64": "npm:0.1.63"
"@napi-rs/canvas-darwin-arm64": "npm:0.1.62" "@napi-rs/canvas-darwin-arm64": "npm:0.1.63"
"@napi-rs/canvas-darwin-x64": "npm:0.1.62" "@napi-rs/canvas-darwin-x64": "npm:0.1.63"
"@napi-rs/canvas-linux-arm-gnueabihf": "npm:0.1.62" "@napi-rs/canvas-linux-arm-gnueabihf": "npm:0.1.63"
"@napi-rs/canvas-linux-arm64-gnu": "npm:0.1.62" "@napi-rs/canvas-linux-arm64-gnu": "npm:0.1.63"
"@napi-rs/canvas-linux-arm64-musl": "npm:0.1.62" "@napi-rs/canvas-linux-arm64-musl": "npm:0.1.63"
"@napi-rs/canvas-linux-x64-gnu": "npm:0.1.62" "@napi-rs/canvas-linux-riscv64-gnu": "npm:0.1.63"
"@napi-rs/canvas-linux-x64-musl": "npm:0.1.62" "@napi-rs/canvas-linux-x64-gnu": "npm:0.1.63"
"@napi-rs/canvas-win32-x64-msvc": "npm:0.1.62" "@napi-rs/canvas-linux-x64-musl": "npm:0.1.63"
"@napi-rs/canvas-win32-x64-msvc": "npm:0.1.63"
dependenciesMeta: dependenciesMeta:
"@napi-rs/canvas-android-arm64": "@napi-rs/canvas-android-arm64":
optional: true optional: true
@ -198,13 +206,15 @@ __metadata:
optional: true optional: true
"@napi-rs/canvas-linux-arm64-musl": "@napi-rs/canvas-linux-arm64-musl":
optional: true optional: true
"@napi-rs/canvas-linux-riscv64-gnu":
optional: true
"@napi-rs/canvas-linux-x64-gnu": "@napi-rs/canvas-linux-x64-gnu":
optional: true optional: true
"@napi-rs/canvas-linux-x64-musl": "@napi-rs/canvas-linux-x64-musl":
optional: true optional: true
"@napi-rs/canvas-win32-x64-msvc": "@napi-rs/canvas-win32-x64-msvc":
optional: true optional: true
checksum: 10/179289512fa76653071fe2192e9828e8a688241630071b6bc820c3fde8107cc83461998430adcae49188dc14a908e13aa7d514cb8a550178b794e176f9bb94d3 checksum: 10/b700becb2b696926ea1db0d7d23a4c9fc84e40e77073843e4dbb5d6b0262801945d250d1d690be6c95ff85c730bc2a32cb45e5e5058d11bc39ff5607800fd420
languageName: node languageName: node
linkType: hard linkType: hard
@ -538,12 +548,12 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/node@npm:*, @types/node@npm:22.9.0": "@types/node@npm:*, @types/node@npm:22.9.3":
version: 22.9.0 version: 22.9.3
resolution: "@types/node@npm:22.9.0" resolution: "@types/node@npm:22.9.3"
dependencies: dependencies:
undici-types: "npm:~6.19.8" undici-types: "npm:~6.19.8"
checksum: 10/a7df3426891868b0f5fb03e46aeddd8446178233521c624a44531c92a040cf08a82d8235f7e1e02af731fd16984665d4d71f3418caf9c2788313b10f040d615d checksum: 10/c32a03ff998b8c6cf7d653216508a92b1e6569dd5031ea6cfc2aaa8c75ebbf4172bf1602f0e1f673086e210787dc96667b99ba4d919bc151f9a1f88aeac42822
languageName: node languageName: node
linkType: hard linkType: hard
@ -636,19 +646,19 @@ __metadata:
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "daggerbot-ts@workspace:." resolution: "daggerbot-ts@workspace:."
dependencies: dependencies:
"@napi-rs/canvas": "npm:0.1.62" "@napi-rs/canvas": "npm:0.1.63"
"@octokit/rest": "npm:21.0.2" "@octokit/rest": "npm:21.0.2"
"@sequelize/core": "npm:7.0.0-alpha.43" "@sequelize/core": "npm:7.0.0-alpha.43"
"@sequelize/postgres": "npm:7.0.0-alpha.43" "@sequelize/postgres": "npm:7.0.0-alpha.43"
"@toast/tokenservice-client": "npm:1.3.1" "@toast/tokenservice-client": "npm:1.3.1"
"@types/ms": "npm:0.7.34" "@types/ms": "npm:0.7.34"
"@types/node": "npm:22.9.0" "@types/node": "npm:22.9.3"
"@types/node-cron": "npm:3.0.11" "@types/node-cron": "npm:3.0.11"
ansi-colors: "npm:4.1.3" ansi-colors: "npm:4.1.3"
dayjs: "npm:1.11.13" dayjs: "npm:1.11.13"
discord.js: "npm:14.16.3" discord.js: "npm:14.16.3"
fast-xml-parser: "npm:4.5.0" fast-xml-parser: "npm:4.5.0"
mathjs: "npm:13.2.2" mathjs: "npm:14.0.0"
ms: "npm:2.1.3" ms: "npm:2.1.3"
node-cron: "npm:3.0.3" node-cron: "npm:3.0.3"
redis: "npm:4.7.0" redis: "npm:4.7.0"
@ -789,10 +799,10 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"fraction.js@npm:^4.3.7": "fraction.js@npm:^5.2.1":
version: 4.3.7 version: 5.2.1
resolution: "fraction.js@npm:4.3.7" resolution: "fraction.js@npm:5.2.1"
checksum: 10/bb5ebcdeeffcdc37b68ead3bdfc244e68de188e0c64e9702197333c72963b95cc798883ad16adc21588088b942bca5b6a6ff4aeb1362d19f6f3b629035dc15f5 checksum: 10/ea6789794274817610b6b8ae5713d1e81a04903e19b1c6d57c958fb15abb4ea7187a630011ceae5f474ed9871268bbc80abbbbfa3cc7d66bc9c5e60835aa1f27
languageName: node languageName: node
linkType: hard linkType: hard
@ -870,22 +880,22 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"mathjs@npm:13.2.2": "mathjs@npm:14.0.0":
version: 13.2.2 version: 14.0.0
resolution: "mathjs@npm:13.2.2" resolution: "mathjs@npm:14.0.0"
dependencies: dependencies:
"@babel/runtime": "npm:^7.25.7" "@babel/runtime": "npm:^7.25.7"
complex.js: "npm:^2.2.5" complex.js: "npm:^2.2.5"
decimal.js: "npm:^10.4.3" decimal.js: "npm:^10.4.3"
escape-latex: "npm:^1.2.0" escape-latex: "npm:^1.2.0"
fraction.js: "npm:^4.3.7" fraction.js: "npm:^5.2.1"
javascript-natural-sort: "npm:^0.7.1" javascript-natural-sort: "npm:^0.7.1"
seedrandom: "npm:^3.0.5" seedrandom: "npm:^3.0.5"
tiny-emitter: "npm:^2.1.0" tiny-emitter: "npm:^2.1.0"
typed-function: "npm:^4.2.1" typed-function: "npm:^4.2.1"
bin: bin:
mathjs: bin/cli.js mathjs: bin/cli.js
checksum: 10/0b0eac47221d316deef9747e44bda31412b9916e47caea357be60a55f9ed328e52a9eb840449a4f15c0867cd6939f6904075e01391ed992e3c879efbfd0de2e7 checksum: 10/6cc115917ad853abf22d97bf649a6cf4a54d9d184067ef95e4e5011fc3b120e31740ab68348929a67b94f0704e96f6bab9ce2353e83234674ad4a1cfccb8aad3
languageName: node languageName: node
linkType: hard linkType: hard
@ -1262,9 +1272,9 @@ __metadata:
linkType: hard linkType: hard
"type-fest@npm:^4.14.0": "type-fest@npm:^4.14.0":
version: 4.26.1 version: 4.28.0
resolution: "type-fest@npm:4.26.1" resolution: "type-fest@npm:4.28.0"
checksum: 10/b82676194f80af228cb852e320d2ea8381c89d667d2e4d9f2bdfc8f254bccc039c7741a90c53617a4de0c9fdca8265ed18eb0888cd628f391c5c381c33a9f94b checksum: 10/2fc54972af0aff1846786c11beeb2e446a1a6ea19b07ba80db1d3f24894002e0ed3de7f40d2a1007fe2e6e6da264a3790a844d744825dba3d31505d1983df2a5
languageName: node languageName: node
linkType: hard linkType: hard