From ccb94cc475392c253053940f692acb508fe5b598 Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:14:08 +1000 Subject: [PATCH] Mentally dying of 9 commands being loaded. --- .pnp.cjs | 4 +++- Dockerfile | 3 +++ docker-compose.yml | 5 +++-- package.json | 3 ++- src/client.ts | 4 ++-- src/index.ts | 1 + yarn.lock | 7 ++++--- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.pnp.cjs b/.pnp.cjs index 2c2dece..37ce65c 100644 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -46,6 +46,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["systeminformation", "npm:5.18.12"],\ ["typescript", "patch:typescript@npm%3A5.1.6#~builtin::version=5.1.6&hash=5da071"],\ ["xml-js", "npm:1.6.11"],\ + ["youtube-sr", "npm:4.3.4"],\ ["ytdl-core", "npm:4.11.5"]\ ],\ "linkType": "SOFT"\ @@ -1035,6 +1036,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["systeminformation", "npm:5.18.12"],\ ["typescript", "patch:typescript@npm%3A5.1.6#~builtin::version=5.1.6&hash=5da071"],\ ["xml-js", "npm:1.6.11"],\ + ["youtube-sr", "npm:4.3.4"],\ ["ytdl-core", "npm:4.11.5"]\ ],\ "linkType": "SOFT"\ @@ -1158,7 +1160,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/youtube-sr", null],\ ["discord.js", "npm:14.12.1"],\ ["libsodium-wrappers", "npm:0.7.11"],\ - ["youtube-sr", null]\ + ["youtube-sr", "npm:4.3.4"]\ ],\ "packagePeers": [\ "@discord-player/extractor",\ diff --git a/Dockerfile b/Dockerfile index 77b85fd..c9fb148 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,6 @@ +# main; node:current-alpine3.18 +# backup; node:current-bookworm FROM node:current-alpine3.18 WORKDIR /bot +RUN yarn CMD ["yarn", "node", "dist/index.js"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8ce9922..7345321 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,7 @@ version: '3' services: bot: container_name: 'Daggerbot' - image: 'git.toast-server.net/toast/daggerbot-ts:debian12' + image: 'git.toast-server.net/toast/daggerbot-ts:alpine3.18' volumes: - - .:/bot \ No newline at end of file + - .:/bot + network_mode: host \ No newline at end of file diff --git a/package.json b/package.json index f5f41bd..607531f 100644 --- a/package.json +++ b/package.json @@ -39,10 +39,11 @@ "moment": "2.29.4", "mongoose": "7.4.2", "ms": "2.1.3", - "prism-media": "^1.3.5", + "prism-media": "1.3.5", "systeminformation": "5.18.12", "typescript": "5.1.6", "xml-js": "1.6.11", + "youtube-sr": "4.3.4", "ytdl-core": "4.11.5" }, "devDependencies": { diff --git a/src/client.ts b/src/client.ts index 68197de..930ac2f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -107,12 +107,12 @@ export default class TClient extends Client { for await (const file of readdirSync('dist/events')){ const eventFile = await import(`./events/${file}`); this.on(file.replace('.js',''), async(...args)=>eventFile.default.run(this,...args)) - }; + } for await (const file of readdirSync('dist/commands')){ const command = await import(`./commands/${file}`); this.commands.set(command.default.data.name,{command, uses: 0}); this.registry.push(command.default.data.toJSON()) - }; + } } formatTime(integer: number, accuracy = 1, options?: formatTimeOpt){ let achievedAccuracy = 0; diff --git a/src/index.ts b/src/index.ts index 0b4b922..29d1bb2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,6 +16,7 @@ client.on('ready', async()=>{ },300000) }); if (client.config.botSwitches.registerCommands){ + console.log('Total commands: '+client.registry.length) //Debugging reasons. client.config.whitelistedServers.forEach(guildId=>(client.guilds.cache.get(guildId) as Discord.Guild).commands.set(client.registry).catch((e:Error)=>{ console.log(`Couldn't register slash commands for ${guildId} because`, e.stack); (client.channels.resolve(client.config.mainServer.channels.errors) as Discord.TextChannel).send(`Cannot register slash commands for **${client.guilds.cache.get(guildId).name}** (\`${guildId}\`):\n\`\`\`${e.message}\`\`\``) diff --git a/yarn.lock b/yarn.lock index 16768f8..fb9a5cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -848,10 +848,11 @@ __metadata: moment: 2.29.4 mongoose: 7.4.2 ms: 2.1.3 - prism-media: ^1.3.5 + prism-media: 1.3.5 systeminformation: 5.18.12 typescript: 5.1.6 xml-js: 1.6.11 + youtube-sr: 4.3.4 ytdl-core: 4.11.5 languageName: unknown linkType: soft @@ -1979,7 +1980,7 @@ __metadata: languageName: node linkType: hard -"prism-media@npm:^1.3.5": +"prism-media@npm:1.3.5, prism-media@npm:^1.3.5": version: 1.3.5 resolution: "prism-media@npm:1.3.5" peerDependencies: @@ -2576,7 +2577,7 @@ __metadata: languageName: node linkType: hard -"youtube-sr@npm:^4.3.4": +"youtube-sr@npm:4.3.4, youtube-sr@npm:^4.3.4": version: 4.3.4 resolution: "youtube-sr@npm:4.3.4" checksum: e097f2a82ddc51a580e7b8556aba83968ee580ad29a8d035cbfdc497c4a6f227b3e3ef0bf4648c6edaf25aed18b872a0fad8fda0554d270129f7c5e60e4a01ef