diff --git a/.gitignore b/.gitignore index 2e2c6b7..8962c6c 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ dist/ .err .vscode /run.sh +drizzle diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fce421..749ed68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ +## 0.2.0 (March 24, 2025) + +* Removed references to terrorists in the Nassiryot Republic. +* Add `/coal` and `/version` commands. + ## 0.1.0 (January 19, 2025) * Initial commit. diff --git a/README.md b/README.md index e779de5..4e6a89c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Nassiryot Government Bot (4th Era) -This is the official bot for the [Nassiryot Government](https://gov.yusurland.xyz). +This is the official bot for the [Nassiryot Social Republic](https://gov.yusurland.xyz). For those who don't know, the Nassiryot Republic is a Virtual State, mainly active on Discord. @@ -38,5 +38,8 @@ The whole code is licensed under [Apache 2.0](https://www.apache.org/licenses/LI This code is available "AS IS", without any warranty, explicit or implied. -I (sakuragasaki46) am not legally liable from Your use of the code. +I (sakuragasaki46) am **not legally liable** from Your use of the code. + +Starting lawsuits for issues with my code is sign of low mental maturity and utter disrespect for the developer. + diff --git a/package-lock.json b/package-lock.json index e0cbe59..5981b5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,25 @@ { "name": "sknsybot", - "version": "0.1.0", + "version": "0.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "sknsybot", - "version": "0.1.0", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { "chalk": "^5.4.1", - "discord.js": "^14.17.3", + "discord.js": "^14.14.1", "dotenv": "^16.4.7", + "mysql": "^2.18.1", + "mysql2": "^3.12.0", + "node-cron": "^3.0.3", "wikijs": "^6.4.1" }, "devDependencies": { "@types/node": "^22.10.7", + "@types/node-cron": "^3.0.11", "ts-node": "^10.9.2", "tsx": "^4.19.2", "typescript": "^5.7.3" @@ -667,6 +671,13 @@ "undici-types": "~6.20.0" } }, + "node_modules/@types/node-cron": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/@types/node-cron/-/node-cron-3.0.11.tgz", + "integrity": "sha512-0ikrnug3/IyneSHqCBeslAhlK2aBfYek1fGo4bP4QnZPmiqSGRK+Oy7ZMisLWkesffJvQ1cqAcBnJC+8+nxIAg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/ws": { "version": "8.5.13", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", @@ -719,6 +730,24 @@ "dev": true, "license": "MIT" }, + "node_modules/aws-ssl-profiles": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/aws-ssl-profiles/-/aws-ssl-profiles-1.1.2.tgz", + "integrity": "sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==", + "license": "MIT", + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==", + "license": "MIT", + "engines": { + "node": "*" + } + }, "node_modules/camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", @@ -740,6 +769,12 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" + }, "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", @@ -756,6 +791,15 @@ "node-fetch": "^2.7.0" } }, + "node_modules/denque": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.10" + } + }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -871,6 +915,15 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/generate-function": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", + "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", + "license": "MIT", + "dependencies": { + "is-property": "^1.0.2" + } + }, "node_modules/get-tsconfig": { "version": "4.8.1", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", @@ -894,6 +947,18 @@ "npm": ">=5.3.0" } }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/infobox-parser": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/infobox-parser/-/infobox-parser-3.6.2.tgz", @@ -907,6 +972,24 @@ "url": "https://www.buymeacoffee.com/2tmRKi9" } }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==", + "license": "MIT" + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", @@ -919,6 +1002,36 @@ "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==", "license": "MIT" }, + "node_modules/long": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.4.tgz", + "integrity": "sha512-qtzLbJE8hq7VabR3mISmVGtoXP8KGc2Z/AT8OuqlYD7JTR3oqrgwdjnk07wpj1twXxYmgDXgoKVWUG/fReSzHg==", + "license": "Apache-2.0" + }, + "node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/lru.min": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/lru.min/-/lru.min-1.1.1.tgz", + "integrity": "sha512-FbAj6lXil6t8z4z3j0E5mfRlPzxkySotzUHwRXjlpRh10vc6AI6WN62ehZj82VG7M20rqogJ0GLwar2Xa05a8Q==", + "license": "MIT", + "engines": { + "bun": ">=1.0.0", + "deno": ">=1.30.0", + "node": ">=8.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wellwelwel" + } + }, "node_modules/magic-bytes.js": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.10.0.tgz", @@ -932,6 +1045,74 @@ "dev": true, "license": "ISC" }, + "node_modules/mysql": { + "version": "2.18.1", + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz", + "integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==", + "license": "MIT", + "dependencies": { + "bignumber.js": "9.0.0", + "readable-stream": "2.3.7", + "safe-buffer": "5.1.2", + "sqlstring": "2.3.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mysql2": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.12.0.tgz", + "integrity": "sha512-C8fWhVysZoH63tJbX8d10IAoYCyXy4fdRFz2Ihrt9jtPILYynFEKUUzpp1U7qxzDc3tMbotvaBH+sl6bFnGZiw==", + "license": "MIT", + "dependencies": { + "aws-ssl-profiles": "^1.1.1", + "denque": "^2.1.0", + "generate-function": "^2.3.1", + "iconv-lite": "^0.6.3", + "long": "^5.2.1", + "lru.min": "^1.0.0", + "named-placeholders": "^1.1.3", + "seq-queue": "^0.0.5", + "sqlstring": "^2.3.2" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/mysql2/node_modules/sqlstring": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz", + "integrity": "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/named-placeholders": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.3.tgz", + "integrity": "sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w==", + "license": "MIT", + "dependencies": { + "lru-cache": "^7.14.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/node-cron": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-3.0.3.tgz", + "integrity": "sha512-dOal67//nohNgYWb+nWmg5dkFdIwDm8EpeGYMekPMrngV3637lqnX0lbUcCtgibHTz6SEz7DAIjKvKDFYCnO1A==", + "license": "ISC", + "dependencies": { + "uuid": "8.3.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -952,6 +1133,27 @@ } } }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" + }, + "node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, "node_modules/resolve-pkg-maps": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", @@ -962,6 +1164,41 @@ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/seq-queue": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", + "integrity": "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q==" + }, + "node_modules/sqlstring": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz", + "integrity": "sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -1073,6 +1310,21 @@ "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", "license": "MIT" }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/package.json b/package.json index 75ea31e..79e8193 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sknsybot", - "version": "0.1.0", + "version": "0.2.0", "private": true, "description": "", "license": "Apache-2.0", @@ -8,16 +8,21 @@ "type": "module", "scripts": { "start": "tsx src/bot.ts", - "register": "tsx src/register.ts" + "register": "tsx src/register.ts", + "migrate": "npx drizzle-kit push" }, "dependencies": { "chalk": "^5.4.1", - "discord.js": "^14.17.3", + "discord.js": "^14.14.1", "dotenv": "^16.4.7", + "mysql": "^2.18.1", + "mysql2": "^3.12.0", + "node-cron": "^3.0.3", "wikijs": "^6.4.1" }, "devDependencies": { "@types/node": "^22.10.7", + "@types/node-cron": "^3.0.11", "ts-node": "^10.9.2", "tsx": "^4.19.2", "typescript": "^5.7.3" diff --git a/src/bot.ts b/src/bot.ts index 7e0c946..66d5483 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -14,8 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { config as configDotenv } from 'dotenv'; -configDotenv(); +import "./initConfig"; import { GatewayIntentBits, Events, Interaction, ChatInputCommandInteraction } from 'discord.js'; import { MyClient } from './client'; diff --git a/src/commandList.ts b/src/commandList.ts index 43fbaeb..cf77105 100644 --- a/src/commandList.ts +++ b/src/commandList.ts @@ -14,13 +14,36 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { SlashCommandOptionsOnlyBuilder } from 'discord.js'; +import { ChatInputCommandInteraction, MessageFlags, SlashCommandBuilder } from 'discord.js'; import yroo from './commands/yroo'; import wiki from './commands/wiki'; +import coal from './commands/coal'; +import version from './commands/version'; + +function fakeCommand(name: string, description?: string) { + const data = new SlashCommandBuilder() + .setName(name) + .setDescription(description? `[WIP] ${description}` : `[Comando non implementato]`); + + async function execute(interaction: ChatInputCommandInteraction) { + await interaction.reply({ + content: 'Comando non implementato!', + flags: MessageFlags.Ephemeral + }); + } + + return { data, execute }; +} const commandList = [ yroo, - wiki + wiki, + coal, + version, + fakeCommand('dict', 'Cerca una parola nel dizionario nassiryota'), + fakeCommand('userinfo', 'Mostra informazioni sull\'utente'), + fakeCommand('bible', 'Leggi un versetto della Bibbia'), + fakeCommand('rllaw', 'Leggi un articolo della legge italiana') ]; export default commandList; diff --git a/src/commands/coal.ts b/src/commands/coal.ts new file mode 100644 index 0000000..04779b2 --- /dev/null +++ b/src/commands/coal.ts @@ -0,0 +1,40 @@ + +import { ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js'; + +const CHARCOAL = 'opgtivcxeyqrnmabklzdwfuhjs'; +const CHARCOAL_TABLE = {}; +for (let i = 0; i < CHARCOAL.length; i++) { + CHARCOAL_TABLE[String.fromCharCode(65 + i)] = CHARCOAL[i].toUpperCase(); + CHARCOAL_TABLE[String.fromCharCode(97 + i)] = CHARCOAL[i]; +} + +function carbonize(msg: string): string { + let enc: string[] = []; + + for (let i = 0; i < msg.length; i++) { + enc.push(CHARCOAL_TABLE[msg[i]] ?? msg[i]); + } + + return enc.join(''); +} + +const data = new SlashCommandBuilder() + .setName('coal') + .setDescription('Con la panna è reato') + .addStringOption(o => o + .setName('msg') + .setDescription('La carbonella') + .setRequired(true) + ); + +async function execute(interaction: ChatInputCommandInteraction){ + await interaction.deferReply(); + + const origMsg = interaction.options.getString('msg'); + const encMsg = carbonize(origMsg); + + await interaction.followUp({ content: encMsg }); +} + +export default { data, execute }; + diff --git a/src/commands/version.ts b/src/commands/version.ts new file mode 100644 index 0000000..421a22d --- /dev/null +++ b/src/commands/version.ts @@ -0,0 +1,39 @@ +/* +Copyright 2025 Sakuragasaki46 + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + */ + +import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js"; + +import { version as packageVersion } from '../../package.json'; +import { version as discordjsVersion } from '../../node_modules/discord.js/package.json'; +const nodejsVersion = process.versions.node; + +const data = new SlashCommandBuilder() + .setName("version") + .setDescription("Informazioni sul bot"); + +async function execute (interaction: ChatInputCommandInteraction) { + await interaction.deferReply(); + + await interaction.followUp({ + content: ` +* **Versione bot**: ${packageVersion} +* **Versione discord.js**: ${discordjsVersion} +* **Versione node.js**: ${nodejsVersion} + `.trim() + }); +} + +export default { data, execute }; diff --git a/src/cron/calendar.ts b/src/cron/calendar.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/database.ts b/src/database.ts new file mode 100644 index 0000000..85ed394 --- /dev/null +++ b/src/database.ts @@ -0,0 +1,19 @@ +/* +Copyright 2025 Sakuragasaki46 + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + */ + + +// TODO + diff --git a/src/initConfig.ts b/src/initConfig.ts new file mode 100644 index 0000000..fb78f00 --- /dev/null +++ b/src/initConfig.ts @@ -0,0 +1,5 @@ + + +import { config as configDotenv } from 'dotenv'; +configDotenv(); + diff --git a/src/mediawiki.ts b/src/mediawiki.ts index 1125222..69cb6c5 100644 --- a/src/mediawiki.ts +++ b/src/mediawiki.ts @@ -42,7 +42,7 @@ export class MediaWikiClient { return { url: pageUrl, - title, + title: page.raw.title, summary: pageSummary.length > 4000? pageSummary.slice(0, 3999) + '\u2026': pageSummary, detail: detail? pageDetail.map((x: SectionObject) => ({title: x.title, content: (x.content?.slice(0, 1000))})).filter((x: SectionObject) => x.content.length > 0).slice(0, 20): null, image: pageImageThumb, diff --git a/src/register.ts b/src/register.ts index 925b64a..b981ec3 100644 --- a/src/register.ts +++ b/src/register.ts @@ -1,6 +1,20 @@ +/* +Copyright 2025 Sakuragasaki46 -import { config as configDotenv } from 'dotenv'; -configDotenv(); +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + */ + +import "./initConfig"; import commandList from "./commandList"; import { REST, Routes } from 'discord.js'; diff --git a/src/seeds/LICENSE b/src/seeds/LICENSE new file mode 100644 index 0000000..efb9808 --- /dev/null +++ b/src/seeds/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/src/seeds/README.md b/src/seeds/README.md new file mode 100644 index 0000000..1dee2ee --- /dev/null +++ b/src/seeds/README.md @@ -0,0 +1,14 @@ +# Seeds for Nassiryot Government Bot (4th Era) + +The files in these folders are seeds for some of the bot's functions. + +Namely, the `/bible` and the `/rllaw` commands (to be implemented in a future release). + +## License + +All the files in the `src/seeds/` folder are public domain. + +I (Sakuragasaki46) am NOT legally accountable for your use of these files. + +[Learn more](https://unlicense.org/) + diff --git a/src/seeds/bible_books.csv b/src/seeds/bible_books.csv new file mode 100644 index 0000000..95ad3fb --- /dev/null +++ b/src/seeds/bible_books.csv @@ -0,0 +1,73 @@ +1,,Genesi +2,,Esodo +3,,Levitico +4,,Numeri +5,,Deuteronomio +6,,Giosué +7,,Giudici +8,,Ruth +9,,"1 Samuele" +10,,"2 Samuele" +11,,"1 Re" +12,,"2 Re" +13,,"1 Cronache" +14,,"2 Cronache" +15,,Esdra +16,,Neemia +17,,Tobia +18,,Giuditta +19,,Ester +20,,"1 Maccabei" +21,,"2 Maccabei" +22,,Giobbe +23,,Salmi +24,,Proverbi +25,,Ecclesiaste +26,,"Cantico dei Cantici" +27,,Sapienza +28,,Siracide +29,,Isaia +30,,Geremia +31,,Lamentazioni +32,,Baruc +33,,Ezechiele +34,,Daniele +35,,Osea +36,,Gioele +37,,Amos +38,,Abdia +39,,Giona +40,,Michea +41,,Naum +42,,Abacuc +43,,Sofonia +44,,Aggeo +45,,Zaccaria +46,,Malachia +47,,Matteo +48,,Marco +49,,Luca +50,,Giovanni +51,,"Atti degli Apostoli" +52,,"Romani" +53,,"1 Corinzi" +54,,"2 Corinzi" +55,,"Galati" +56,,"Efesini" +57,,"Filippesi" +58,,"Colossesi" +59,,"1 Tessalonicesi" +60,,"2 Tessalonicesi" +61,,"1 Timoteo" +62,,"2 Timoteo" +63,,"Tito" +64,,"Filemone" +65,,"Ebrei" +66,,"Giacomo" +67,,"1 Pietro" +68,,"2 Pietro" +69,,"1 Giovanni" +70,,"2 Giovanni" +71,,"3 Giovanni" +72,,"Giuda" +73,,"Rivelazione" \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 6705290..5e79b6e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,9 @@ "compilerOptions": { "rootDir": "src/", "outDir": "build/", - "esModuleInterop": true + "esModuleInterop": true, + "resolveJsonModule": true + }, "include": [ "src/**/*"