3.0.0 release, support Deno 2.X

This commit is contained in:
Ean Milligan 2025-04-26 16:47:55 -04:00
parent dff1e97186
commit 8483367cb5
8 changed files with 18 additions and 16 deletions

View File

@ -1,4 +1,4 @@
# The Artificer - A Dice Rolling Discord Bot | V2.1.2 - 2022/07/31 # The Artificer - A Dice Rolling Discord Bot | V3.0.0 - 2025/04/26
[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-orange.svg)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-orange.svg)](https://sonarcloud.io/summary/new_code?id=TheArtificer)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=bugs)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=bugs)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=TheArtificer)
@ -161,7 +161,7 @@ If you run into any errors or problems with the bot, or think you have a good id
--- ---
## Self Hosting The Artificer ## Self Hosting The Artificer
The Artificer is built on [Deno](https://deno.land/) `v1.22.0` using [Discordeno](https://discordeno.mod.land/) `v12.0.1`. If you choose to run this yourself, you will need to rename `config.example.ts` to `config.ts` and edit some values. You will need to create a new [Discord Application](https://discord.com/developers/applications) and copy the newly generated token into the `"token"` key. If you want to utilize some of the bots dev features, you will need to fill in the keys `"logChannel"` and `"reportChannel"` with text channel IDs and `"devServer"` with a guild ID. The Artificer is built on [Deno](https://deno.land/) `v2.2.7` using [Discordeno](https://discordeno.mod.land/) `v12.0.1`. If you choose to run this yourself, you will need to rename `config.example.ts` to `config.ts` and edit some values. You will need to create a new [Discord Application](https://discord.com/developers/applications) and copy the newly generated token into the `"token"` key. If you want to utilize some of the bots dev features, you will need to fill in the keys `"logChannel"` and `"reportChannel"` with text channel IDs and `"devServer"` with a guild ID.
You will also need to install and setup a MySQL database with a user for the bot to use to add/modify the database. This user must have the "DB Manager" admin rights and "REFERENCES" Global Privileges. Once the DB is installed and a user is setup, run the provided `db\initialize.ts` to create the schema and tables. After this, run `db\populateDefaults.ts` to insert some needed values into the tables. You will also need to install and setup a MySQL database with a user for the bot to use to add/modify the database. This user must have the "DB Manager" admin rights and "REFERENCES" Global Privileges. Once the DB is installed and a user is setup, run the provided `db\initialize.ts` to create the schema and tables. After this, run `db\populateDefaults.ts` to insert some needed values into the tables.

View File

@ -1,6 +1,6 @@
export const config = { export const config = {
name: 'The Artificer', // Name of the bot name: 'The Artificer', // Name of the bot
version: '2.1.3', // Version of the bot version: '3.0.0', // Version of the bot
token: 'the_bot_token', // Discord API Token for this bot token: 'the_bot_token', // Discord API Token for this bot
localtoken: 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token" localtoken: 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token"
prefix: '[[', // Prefix for all commands prefix: '[[', // Prefix for all commands

View File

@ -820,6 +820,9 @@
"https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/deps.ts": "4932522dd8d38cc322df6508d4f2e55e5fb0ec15e54fcdc81e2bf10051021608", "https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/deps.ts": "4932522dd8d38cc322df6508d4f2e55e5fb0ec15e54fcdc81e2bf10051021608",
"https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/mod.ts": "d9c38a41a405cf5732c9233c2391a1d7f5a12d0e464aace6f8f596fabf5f21ba", "https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/mod.ts": "d9c38a41a405cf5732c9233c2391a1d7f5a12d0e464aace6f8f596fabf5f21ba",
"https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/src/logger.ts": "f6ba6f7fe254fc3227a3ad48fd7c2c3aaaec8c350f0246fb3eeff075c21dc7e5", "https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/src/logger.ts": "f6ba6f7fe254fc3227a3ad48fd7c2c3aaaec8c350f0246fb3eeff075c21dc7e5",
"https://raw.githubusercontent.com/Burn-E99/Log4Deno/V2.0.0/deps.ts": "9a1b2d559fc8c33ae1aeed899aa821f53f9d094e9df40bd4b51b099c58961cd7",
"https://raw.githubusercontent.com/Burn-E99/Log4Deno/V2.0.0/mod.ts": "d9c38a41a405cf5732c9233c2391a1d7f5a12d0e464aace6f8f596fabf5f21ba",
"https://raw.githubusercontent.com/Burn-E99/Log4Deno/V2.0.0/src/logger.ts": "a1924f1f02b35a7501161349de90b60a3aa329e12f1033fdb212b598542897c4",
"https://unpkg.com/@evan/wasm@0.0.65/target/zlib/deno.js": "36cd3f1edd2f3a6d6fd4c2376f701c2748338c132703810d4866cfa52b5e7bf9" "https://unpkg.com/@evan/wasm@0.0.65/target/zlib/deno.js": "36cd3f1edd2f3a6d6fd4c2376f701c2748338c132703810d4866cfa52b5e7bf9"
} }
} }

View File

@ -23,6 +23,6 @@ export type { StatusCode } from 'jsr:@std/http@1.0.15';
export { nanoid } from 'https://deno.land/x/nanoid@v3.0.0/mod.ts'; export { nanoid } from 'https://deno.land/x/nanoid@v3.0.0/mod.ts';
export { initLog, log, LogTypes as LT } from 'https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/mod.ts'; export { initLog, log, LogTypes as LT } from 'https://raw.githubusercontent.com/Burn-E99/Log4Deno/V2.0.0/mod.ts';
export * as is from 'https://deno.land/x/imagescript@1.3.0/mod.ts'; export * as is from 'https://deno.land/x/imagescript@1.3.0/mod.ts';

13
mod.ts
View File

@ -7,7 +7,6 @@
import config from './config.ts'; import config from './config.ts';
import { DEBUG, DEVMODE, LOCALMODE } from './flags.ts'; import { DEBUG, DEVMODE, LOCALMODE } from './flags.ts';
import { import {
// Discordeno deps
botId, botId,
cache, cache,
DiscordActivityTypes, DiscordActivityTypes,
@ -17,10 +16,8 @@ import {
editBotStatus, editBotStatus,
initLog, initLog,
Intents, Intents,
// Log4Deno deps
log, log,
LT, LT,
// Discordeno deps
sendMessage, sendMessage,
startBot, startBot,
} from './deps.ts'; } from './deps.ts';
@ -74,10 +71,12 @@ startBot({
}, 30000); }, 30000);
// Interval to update bot list stats every 24 hours // Interval to update bot list stats every 24 hours
LOCALMODE ? log(LT.INFO, 'updateListStatistics not running') : setInterval(() => { LOCALMODE
log(LT.LOG, 'Updating all bot lists statistics'); ? log(LT.INFO, 'updateListStatistics not running')
intervals.updateListStatistics(botId, cache.guilds.size + cache.dispatchedGuildIds.size); : setInterval(() => {
}, 86400000); log(LT.LOG, 'Updating all bot lists statistics');
intervals.updateListStatistics(botId, cache.guilds.size + cache.dispatchedGuildIds.size);
}, 86400000);
// Interval to update hourlyRates every hour // Interval to update hourlyRates every hour
setInterval(() => { setInterval(() => {

View File

@ -22,7 +22,7 @@ let currentWorkers = 0;
const rollQueue: Array<ApiQueuedRoll | DDQueuedRoll> = []; const rollQueue: Array<ApiQueuedRoll | DDQueuedRoll> = [];
// Handle setting up and calling the rollWorker // Handle setting up and calling the rollWorker
const handleRollWorker = async (rq: ApiQueuedRoll | DDQueuedRoll) => { const handleRollWorker = (rq: ApiQueuedRoll | DDQueuedRoll) => {
currentWorkers++; currentWorkers++;
// gmModifiers used to create gmEmbed (basically just turn off the gmRoll) // gmModifiers used to create gmEmbed (basically just turn off the gmRoll)
@ -191,7 +191,7 @@ const handleRollWorker = async (rq: ApiQueuedRoll | DDQueuedRoll) => {
}; };
// Runs the roll or queues it depending on how many workers are currently running // Runs the roll or queues it depending on how many workers are currently running
export const queueRoll = async (rq: ApiQueuedRoll | DDQueuedRoll) => { export const queueRoll = (rq: ApiQueuedRoll | DDQueuedRoll) => {
if (rq.apiRoll) { if (rq.apiRoll) {
handleRollWorker(rq); handleRollWorker(rq);
} else if (!rollQueue.length && currentWorkers < config.limits.maxWorkers) { } else if (!rollQueue.length && currentWorkers < config.limits.maxWorkers) {
@ -215,7 +215,7 @@ The results for this roll will replace this message when it is done.`,
}; };
// Checks the queue constantly to make sure the queue stays empty // Checks the queue constantly to make sure the queue stays empty
setInterval(async () => { setInterval(() => {
log( log(
LT.LOG, LT.LOG,
`Checking rollQueue for items, rollQueue length: ${rollQueue.length}, currentWorkers: ${currentWorkers}, config.limits.maxWorkers: ${config.limits.maxWorkers}` `Checking rollQueue for items, rollQueue length: ${rollQueue.length}, currentWorkers: ${currentWorkers}, config.limits.maxWorkers: ${config.limits.maxWorkers}`

View File

@ -122,7 +122,7 @@
Built by <a href="https://github.com/Burn-E99/" target="_blank" rel="noopener">Ean Milligan</a> Built by <a href="https://github.com/Burn-E99/" target="_blank" rel="noopener">Ean Milligan</a>
</div> </div>
<div id="footer-right"> <div id="footer-right">
Version 2.0.0 Version 3.0.0
</div> </div>
</div> </div>
</div> </div>

View File

@ -94,7 +94,7 @@
Built by <a href="https://github.com/Burn-E99/" target="_blank" rel="noopener">Ean Milligan</a> Built by <a href="https://github.com/Burn-E99/" target="_blank" rel="noopener">Ean Milligan</a>
</div> </div>
<div id="footer-right"> <div id="footer-right">
Version 2.0.0 Version 3.0.0
</div> </div>
</div> </div>
</div> </div>