generated from nhcarrigan/template
Compare commits
2 Commits
feat/add-d
...
main
Author | SHA1 | Date | |
---|---|---|---|
c0b21ce82f
|
|||
8121f3bb6d
|
@ -26,7 +26,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nhcarrigan/logger": "1.0.0",
|
"@nhcarrigan/logger": "1.0.0",
|
||||||
"discord.js": "14.21.0",
|
"discord.js": "14.21.0",
|
||||||
"mongodb": "6.17.0",
|
|
||||||
"node-schedule": "2.1.1"
|
"node-schedule": "2.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
104
pnpm-lock.yaml
generated
104
pnpm-lock.yaml
generated
@ -14,9 +14,6 @@ importers:
|
|||||||
discord.js:
|
discord.js:
|
||||||
specifier: 14.21.0
|
specifier: 14.21.0
|
||||||
version: 14.21.0
|
version: 14.21.0
|
||||||
mongodb:
|
|
||||||
specifier: ^6.17.0
|
|
||||||
version: 6.17.0
|
|
||||||
node-schedule:
|
node-schedule:
|
||||||
specifier: 2.1.1
|
specifier: 2.1.1
|
||||||
version: 2.1.1
|
version: 2.1.1
|
||||||
@ -408,9 +405,6 @@ packages:
|
|||||||
'@jridgewell/trace-mapping@0.3.25':
|
'@jridgewell/trace-mapping@0.3.25':
|
||||||
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
|
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
|
||||||
|
|
||||||
'@mongodb-js/saslprep@1.3.0':
|
|
||||||
resolution: {integrity: sha512-zlayKCsIjYb7/IdfqxorK5+xUMyi4vOKcFy10wKJYc63NSdKI8mNME+uJqfatkPmOSMMUiojrL58IePKBm3gvQ==}
|
|
||||||
|
|
||||||
'@nhcarrigan/eslint-config@5.2.0':
|
'@nhcarrigan/eslint-config@5.2.0':
|
||||||
resolution: {integrity: sha512-YpTTqhviKMlRwKF+RC/GYiA5i2jTCmg8uftuiufldneNV5HMbGpTfBbV7tpa8++5mpYJc4+eZaf40QbDiz84dQ==}
|
resolution: {integrity: sha512-YpTTqhviKMlRwKF+RC/GYiA5i2jTCmg8uftuiufldneNV5HMbGpTfBbV7tpa8++5mpYJc4+eZaf40QbDiz84dQ==}
|
||||||
engines: {node: '>=22', pnpm: '>=9'}
|
engines: {node: '>=22', pnpm: '>=9'}
|
||||||
@ -590,12 +584,6 @@ packages:
|
|||||||
'@types/normalize-package-data@2.4.4':
|
'@types/normalize-package-data@2.4.4':
|
||||||
resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==}
|
resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==}
|
||||||
|
|
||||||
'@types/webidl-conversions@7.0.3':
|
|
||||||
resolution: {integrity: sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==}
|
|
||||||
|
|
||||||
'@types/whatwg-url@11.0.5':
|
|
||||||
resolution: {integrity: sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==}
|
|
||||||
|
|
||||||
'@types/ws@8.5.14':
|
'@types/ws@8.5.14':
|
||||||
resolution: {integrity: sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw==}
|
resolution: {integrity: sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw==}
|
||||||
|
|
||||||
@ -861,10 +849,6 @@ packages:
|
|||||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
bson@6.10.4:
|
|
||||||
resolution: {integrity: sha512-WIsKqkSC0ABoBJuT1LEX+2HEvNmNKKgnTAyd0fL8qzK4SH2i9NXg+t08YtdZp/V9IZ33cxe3iV4yM0qg8lMQng==}
|
|
||||||
engines: {node: '>=16.20.1'}
|
|
||||||
|
|
||||||
builtin-modules@3.3.0:
|
builtin-modules@3.3.0:
|
||||||
resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==}
|
resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
@ -1657,9 +1641,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
|
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
memory-pager@1.5.0:
|
|
||||||
resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==}
|
|
||||||
|
|
||||||
merge2@1.4.1:
|
merge2@1.4.1:
|
||||||
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
|
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
@ -1686,36 +1667,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==}
|
resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==}
|
||||||
engines: {node: '>=16 || 14 >=14.17'}
|
engines: {node: '>=16 || 14 >=14.17'}
|
||||||
|
|
||||||
mongodb-connection-string-url@3.0.2:
|
|
||||||
resolution: {integrity: sha512-rMO7CGo/9BFwyZABcKAWL8UJwH/Kc2x0g72uhDWzG48URRax5TCIcJ7Rc3RZqffZzO/Gwff/jyKwCU9TN8gehA==}
|
|
||||||
|
|
||||||
mongodb@6.17.0:
|
|
||||||
resolution: {integrity: sha512-neerUzg/8U26cgruLysKEjJvoNSXhyID3RvzvdcpsIi2COYM3FS3o9nlH7fxFtefTb942dX3W9i37oPfCVj4wA==}
|
|
||||||
engines: {node: '>=16.20.1'}
|
|
||||||
peerDependencies:
|
|
||||||
'@aws-sdk/credential-providers': ^3.188.0
|
|
||||||
'@mongodb-js/zstd': ^1.1.0 || ^2.0.0
|
|
||||||
gcp-metadata: ^5.2.0
|
|
||||||
kerberos: ^2.0.1
|
|
||||||
mongodb-client-encryption: '>=6.0.0 <7'
|
|
||||||
snappy: ^7.2.2
|
|
||||||
socks: ^2.7.1
|
|
||||||
peerDependenciesMeta:
|
|
||||||
'@aws-sdk/credential-providers':
|
|
||||||
optional: true
|
|
||||||
'@mongodb-js/zstd':
|
|
||||||
optional: true
|
|
||||||
gcp-metadata:
|
|
||||||
optional: true
|
|
||||||
kerberos:
|
|
||||||
optional: true
|
|
||||||
mongodb-client-encryption:
|
|
||||||
optional: true
|
|
||||||
snappy:
|
|
||||||
optional: true
|
|
||||||
socks:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
ms@2.1.3:
|
ms@2.1.3:
|
||||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||||
|
|
||||||
@ -2027,9 +1978,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
|
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
sparse-bitfield@3.0.3:
|
|
||||||
resolution: {integrity: sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==}
|
|
||||||
|
|
||||||
spdx-correct@3.2.0:
|
spdx-correct@3.2.0:
|
||||||
resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==}
|
resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==}
|
||||||
|
|
||||||
@ -2143,10 +2091,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
|
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
|
||||||
engines: {node: '>=8.0'}
|
engines: {node: '>=8.0'}
|
||||||
|
|
||||||
tr46@5.1.1:
|
|
||||||
resolution: {integrity: sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==}
|
|
||||||
engines: {node: '>=18'}
|
|
||||||
|
|
||||||
ts-api-utils@1.4.3:
|
ts-api-utils@1.4.3:
|
||||||
resolution: {integrity: sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==}
|
resolution: {integrity: sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
@ -2301,14 +2245,6 @@ packages:
|
|||||||
jsdom:
|
jsdom:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
webidl-conversions@7.0.0:
|
|
||||||
resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
|
|
||||||
whatwg-url@14.2.0:
|
|
||||||
resolution: {integrity: sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==}
|
|
||||||
engines: {node: '>=18'}
|
|
||||||
|
|
||||||
which-boxed-primitive@1.1.1:
|
which-boxed-primitive@1.1.1:
|
||||||
resolution: {integrity: sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==}
|
resolution: {integrity: sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
@ -2714,10 +2650,6 @@ snapshots:
|
|||||||
'@jridgewell/resolve-uri': 3.1.2
|
'@jridgewell/resolve-uri': 3.1.2
|
||||||
'@jridgewell/sourcemap-codec': 1.5.0
|
'@jridgewell/sourcemap-codec': 1.5.0
|
||||||
|
|
||||||
'@mongodb-js/saslprep@1.3.0':
|
|
||||||
dependencies:
|
|
||||||
sparse-bitfield: 3.0.3
|
|
||||||
|
|
||||||
'@nhcarrigan/eslint-config@5.2.0(@typescript-eslint/utils@8.25.0(eslint@9.30.0)(typescript@5.8.3))(eslint@9.30.0)(playwright@1.50.1)(react@19.0.0)(typescript@5.8.3)(vitest@3.2.4(@types/node@24.0.6))':
|
'@nhcarrigan/eslint-config@5.2.0(@typescript-eslint/utils@8.25.0(eslint@9.30.0)(typescript@5.8.3))(eslint@9.30.0)(playwright@1.50.1)(react@19.0.0)(typescript@5.8.3)(vitest@3.2.4(@types/node@24.0.6))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/eslint-plugin-eslint-comments': 4.4.1(eslint@9.30.0)
|
'@eslint-community/eslint-plugin-eslint-comments': 4.4.1(eslint@9.30.0)
|
||||||
@ -2872,12 +2804,6 @@ snapshots:
|
|||||||
|
|
||||||
'@types/normalize-package-data@2.4.4': {}
|
'@types/normalize-package-data@2.4.4': {}
|
||||||
|
|
||||||
'@types/webidl-conversions@7.0.3': {}
|
|
||||||
|
|
||||||
'@types/whatwg-url@11.0.5':
|
|
||||||
dependencies:
|
|
||||||
'@types/webidl-conversions': 7.0.3
|
|
||||||
|
|
||||||
'@types/ws@8.5.14':
|
'@types/ws@8.5.14':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 24.0.6
|
'@types/node': 24.0.6
|
||||||
@ -3237,8 +3163,6 @@ snapshots:
|
|||||||
node-releases: 2.0.19
|
node-releases: 2.0.19
|
||||||
update-browserslist-db: 1.1.2(browserslist@4.24.4)
|
update-browserslist-db: 1.1.2(browserslist@4.24.4)
|
||||||
|
|
||||||
bson@6.10.4: {}
|
|
||||||
|
|
||||||
builtin-modules@3.3.0: {}
|
builtin-modules@3.3.0: {}
|
||||||
|
|
||||||
cac@6.7.14: {}
|
cac@6.7.14: {}
|
||||||
@ -4205,8 +4129,6 @@ snapshots:
|
|||||||
|
|
||||||
math-intrinsics@1.1.0: {}
|
math-intrinsics@1.1.0: {}
|
||||||
|
|
||||||
memory-pager@1.5.0: {}
|
|
||||||
|
|
||||||
merge2@1.4.1: {}
|
merge2@1.4.1: {}
|
||||||
|
|
||||||
micromatch@4.0.8:
|
micromatch@4.0.8:
|
||||||
@ -4228,17 +4150,6 @@ snapshots:
|
|||||||
|
|
||||||
minipass@7.1.2: {}
|
minipass@7.1.2: {}
|
||||||
|
|
||||||
mongodb-connection-string-url@3.0.2:
|
|
||||||
dependencies:
|
|
||||||
'@types/whatwg-url': 11.0.5
|
|
||||||
whatwg-url: 14.2.0
|
|
||||||
|
|
||||||
mongodb@6.17.0:
|
|
||||||
dependencies:
|
|
||||||
'@mongodb-js/saslprep': 1.3.0
|
|
||||||
bson: 6.10.4
|
|
||||||
mongodb-connection-string-url: 3.0.2
|
|
||||||
|
|
||||||
ms@2.1.3: {}
|
ms@2.1.3: {}
|
||||||
|
|
||||||
nanoid@3.3.8: {}
|
nanoid@3.3.8: {}
|
||||||
@ -4588,10 +4499,6 @@ snapshots:
|
|||||||
|
|
||||||
source-map-js@1.2.1: {}
|
source-map-js@1.2.1: {}
|
||||||
|
|
||||||
sparse-bitfield@3.0.3:
|
|
||||||
dependencies:
|
|
||||||
memory-pager: 1.5.0
|
|
||||||
|
|
||||||
spdx-correct@3.2.0:
|
spdx-correct@3.2.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
spdx-expression-parse: 3.0.1
|
spdx-expression-parse: 3.0.1
|
||||||
@ -4727,10 +4634,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-number: 7.0.0
|
is-number: 7.0.0
|
||||||
|
|
||||||
tr46@5.1.1:
|
|
||||||
dependencies:
|
|
||||||
punycode: 2.3.1
|
|
||||||
|
|
||||||
ts-api-utils@1.4.3(typescript@5.8.3):
|
ts-api-utils@1.4.3(typescript@5.8.3):
|
||||||
dependencies:
|
dependencies:
|
||||||
typescript: 5.8.3
|
typescript: 5.8.3
|
||||||
@ -4892,13 +4795,6 @@ snapshots:
|
|||||||
- tsx
|
- tsx
|
||||||
- yaml
|
- yaml
|
||||||
|
|
||||||
webidl-conversions@7.0.0: {}
|
|
||||||
|
|
||||||
whatwg-url@14.2.0:
|
|
||||||
dependencies:
|
|
||||||
tr46: 5.1.1
|
|
||||||
webidl-conversions: 7.0.0
|
|
||||||
|
|
||||||
which-boxed-primitive@1.1.1:
|
which-boxed-primitive@1.1.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-bigint: 1.1.0
|
is-bigint: 1.1.0
|
||||||
|
3
prod.env
3
prod.env
@ -1,3 +1,2 @@
|
|||||||
DISCORD_TOKEN="op://Environment Variables - Naomi/Standup Bot/discord_token"
|
DISCORD_TOKEN="op://Environment Variables - Naomi/Standup Bot/discord_token"
|
||||||
LOG_TOKEN="op://Environment Variables - Naomi/Alert Server/api_auth"
|
LOG_TOKEN="op://Environment Variables - Naomi/Alert Server/api_auth"
|
||||||
MONGO_DB_URL="op://Environment Variables - Naomi/Database/mongo_url"
|
|
@ -4,12 +4,14 @@
|
|||||||
* @author Naomi Carrigan
|
* @author Naomi Carrigan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ReminderChannel } from "../models/channel";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The channels to post standup reminders in.
|
* The channels to post standup reminders in.
|
||||||
*/
|
*/
|
||||||
export const channels: Array<ReminderChannel> = [
|
export const channels: Array<{
|
||||||
|
channelId: string;
|
||||||
|
roleId: string;
|
||||||
|
name: string;
|
||||||
|
}> = [
|
||||||
{
|
{
|
||||||
channelId: "1382093555228606484",
|
channelId: "1382093555228606484",
|
||||||
name: "red-script",
|
name: "red-script",
|
||||||
|
19
src/index.ts
19
src/index.ts
@ -7,7 +7,6 @@ import { Client, Events, GatewayIntentBits } from "discord.js";
|
|||||||
import { scheduleJob } from "node-schedule";
|
import { scheduleJob } from "node-schedule";
|
||||||
import { channels } from "./config/channels.js";
|
import { channels } from "./config/channels.js";
|
||||||
import { standup } from "./modules/standup.js";
|
import { standup } from "./modules/standup.js";
|
||||||
import { closeDatabase, initializeDatabase } from "./utils/database.js";
|
|
||||||
import { logger } from "./utils/logger.js";
|
import { logger } from "./utils/logger.js";
|
||||||
|
|
||||||
const activeIds: Array<string> = [];
|
const activeIds: Array<string> = [];
|
||||||
@ -18,7 +17,6 @@ process.on("unhandledRejection", (error) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void logger.error("unhandled rejection", new Error(String(error)));
|
void logger.error("unhandled rejection", new Error(String(error)));
|
||||||
void closeDatabase();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on("uncaughtException", (error) => {
|
process.on("uncaughtException", (error) => {
|
||||||
@ -27,15 +25,12 @@ process.on("uncaughtException", (error) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void logger.error("uncaught exception", new Error(String(error)));
|
void logger.error("uncaught exception", new Error(String(error)));
|
||||||
void closeDatabase();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages ],
|
intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages ],
|
||||||
});
|
});
|
||||||
|
|
||||||
await initializeDatabase();
|
|
||||||
|
|
||||||
client.on(Events.ClientReady, () => {
|
client.on(Events.ClientReady, () => {
|
||||||
void logger.log("debug", "Bot is ready.");
|
void logger.log("debug", "Bot is ready.");
|
||||||
scheduleJob("reminders", "0 9 * * 1-5", async() => {
|
scheduleJob("reminders", "0 9 * * 1-5", async() => {
|
||||||
@ -43,7 +38,8 @@ client.on(Events.ClientReady, () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on(Events.MessageCreate, (message) => {
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises -- sod off this is going away next month.
|
||||||
|
client.on(Events.MessageCreate, async(message) => {
|
||||||
if (!message.channel.isThread() || !message.inGuild()) {
|
if (!message.channel.isThread() || !message.inGuild()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -59,8 +55,19 @@ client.on(Events.MessageCreate, (message) => {
|
|||||||
if (message.author.bot) {
|
if (message.author.bot) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const threadOwner = await message.channel.fetchOwner();
|
||||||
|
// Check if thread owner is Maribelle (to indicate it is progress thread)
|
||||||
|
if (threadOwner?.id !== "1386862413936328796") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!activeIds.includes(message.author.id)) {
|
if (!activeIds.includes(message.author.id)) {
|
||||||
activeIds.push(message.author.id);
|
activeIds.push(message.author.id);
|
||||||
|
await message.channel.send({
|
||||||
|
allowedMentions: {
|
||||||
|
parse: [],
|
||||||
|
},
|
||||||
|
content: `-# Thank you for your progress update, <@${message.author.id}>! Your participation for today has been recorded.`,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
/**
|
|
||||||
* @copyright nhcarrigan
|
|
||||||
* @license Naomi's Public License
|
|
||||||
* @author Anna
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface ReminderChannel {
|
|
||||||
channelId: string;
|
|
||||||
roleId: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
/**
|
|
||||||
* @copyright nhcarrigan
|
|
||||||
* @license Naomi's Public License
|
|
||||||
* @author Anna
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { type Collection, MongoClient } from "mongodb";
|
|
||||||
import type { ReminderChannel } from "../models/channel";
|
|
||||||
|
|
||||||
const client = new MongoClient(process.env.MONGO_DB_URL ?? "");
|
|
||||||
|
|
||||||
const databaseName = "Maribelle";
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/init-declarations -- I need a reference to the collection to insert records
|
|
||||||
let collection: Collection<ReminderChannel>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes a connection to the database
|
|
||||||
* using the environment variable.
|
|
||||||
*/
|
|
||||||
async function initializeDatabase(): Promise<void> {
|
|
||||||
await client.connect();
|
|
||||||
const database = client.db(databaseName);
|
|
||||||
collection = database.collection<ReminderChannel>("channel");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inserts a new channel into the database.
|
|
||||||
* @param channelId - The id of the channel to post in.
|
|
||||||
* @param roleId - The id of the role to ping.
|
|
||||||
* @param name - The name of the group.
|
|
||||||
*/
|
|
||||||
async function insertRecord(channelId: string,
|
|
||||||
roleId: string,
|
|
||||||
name: string): Promise<void> {
|
|
||||||
const document = { channelId, name, roleId };
|
|
||||||
await collection.insertOne(document);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes the connection to the database.
|
|
||||||
*/
|
|
||||||
async function closeDatabase(): Promise<void> {
|
|
||||||
await client.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
export { closeDatabase, initializeDatabase, insertRecord };
|
|
@ -10,4 +10,3 @@ export const logger = new Logger(
|
|||||||
"Maribelle",
|
"Maribelle",
|
||||||
process.env.LOG_TOKEN ?? "",
|
process.env.LOG_TOKEN ?? "",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user