Kyanoxia / skycord

The unofficial official BlueSky announcement bot for Discord. It's recommended to self-host this!
https://kyanoxia.com/skycord
GNU General Public License v3.0
13 stars 0 forks source link

DiscordAPIError[50035] when running the bot with self hosting on Ubuntu Jammy #1

Closed Arimuria closed 3 weeks ago

Arimuria commented 3 weeks ago

I followed the instructions in the README file to get the bot running on my server. However, I believe Skycord was not tested on Linux, since running 'npm run clean' errors on bash due to executing Windows commands. Therefore, I tried bypassing the command, but there is a critical error afterwards preventing running the bot on Ubuntu 22.04.5 LTS (Jammy Jellyfish).

`npm run build && node build/index.js --development

bluecord@1.1.1 build tsc --build

[LOG // STATUS] Starting the bot in Development mode [LOG // SUCCESS] Connected to MongoDB [LOG // SUCCESS] xxxx#0000 is now ready! [LOG // SUCCESS] Successfully set 6 Global Application (/) Commands node:events:497 throw er; // Unhandled 'error' event ^

DiscordAPIError[50035]: Invalid Form Body guild_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake. at handleErrors (/opt/third-party/bluecord/node_modules/@discordjs/rest/dist/index.js:727:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.runRequest (/opt/gaming-tools/third-party/bluecord/node_modules/@discordjs/rest/dist/index.js:1128:23) at async SequentialHandler.queueRequest (/opt/third-party/bluecord/node_modules/@discordjs/rest/dist/index.js:959:14) at async _REST.request (/opt/third-party/bluecord/node_modules/@discordjs/rest/dist/index.js:1272:22) Emitted 'error' event on CustomClient instance at: at emitUnhandledRejectionOrErr (node:events:402:10) at process.processTicksAndRejections (node:internal/process/task_queues:84:21) { requestBody: { files: undefined, json: [ { name: 'getdatabase', description: 'Gets every subscriber database entry', options: [], default_member_permissions: '2147483648', dm_permission: true, integration_types: [ 0, 1 ], contexts: [ 0, 1, 2 ] }, { name: 'emit', description: 'Emit an event', options: [ { name: 'event', description: 'Event to emit', required: true, type: 3, choices: [Array] } ], default_member_permissions: '8', dm_permission: false, integration_types: [ 0 ], contexts: [ 0 ] } ] }, rawError: { message: 'Invalid Form Body', code: 50035, errors: { guild_id: { _errors: [ { code: 'NUMBER_TYPE_COERCE', message: 'Value "undefined" is not snowflake.' } ] } } }, code: 50035, status: 400, method: 'PUT', url: 'https://discord.com/api/v10/applications/xxxxxxxxxxx/guilds/undefined/commands' }

Node.js v21.7.1 `

Arimuria commented 3 weeks ago

The fix seems to be to define devGuildID as an environmental variable in the .env file. Running without an issue now. Please update the README when you have the chance.

Kyanoxia commented 3 weeks ago

Updated the README and the package.json with today's update, thank you for letting me know. The bot actually runs on Debian so I knew about the package.json incompatibility but I always just manually changed it. I will switch it to linux primary as most hosting providers will run linux anyways.