r-Techsupport / TuringBot

A scaleable Discord bot, built as a replacement for https://github.com/r-Techsupport/TechSupportBot
GNU Affero General Public License v3.0
1 stars 3 forks source link

Add handling for no users config set to prevent infinite error loop #8

Closed Cpt-Dingus closed 1 year ago

Cpt-Dingus commented 1 year ago

There should be handling for this, currently this happens

|04/08/2023, 17:18:20| [II] core: Starting... |04/08/2023, 17:18:20| [II] core: Initialized Discord connection |04/08/2023, 17:18:21| [WW] core: No config option found for "note" in the config,this module will be disabled. |04/08/2023, 17:18:21| [EE] core: An unhandled async error occurred: DiscordAPIError[50035] DiscordAPIError[50035]: Invalid Form Body recipient_id[NUMBER_TYPE_COERCE]: Value "" is not snowflake. at handleErrors (C:\Users\Meti\Documents\TuringBot\node_modules\@discordjs\rest\src\lib\handlers\Shared.ts:152:10) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at SequentialHandler.runRequest (C:\Users\Meti\Documents\TuringBot\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:399:20) at SequentialHandler.queueRequest (C:\Users\Meti\Documents\TuringBot\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:169:11) at REST.request (C:\Users\Meti\Documents\TuringBot\node_modules\@discordjs\rest\src\lib\REST.ts:343:20) at async UserManager.createDM (C:\Users\Meti\Documents\TuringBot\node_modules\discord.js\src\managers\UserManager.js:60:18) at async UserManager.send (C:\Users\Meti\Documents\TuringBot\node_modules\discord.js\src\managers\UserManager.js:112:13) |04/08/2023, 17:18:21| [EE] core: An unhandled async error occurred: DiscordAPIError[50035] DiscordAPIError[50035]: Invalid Form Body recipient_id[NUMBER_TYPE_COERCE]: Value "" is not snowflake. at handleErrors (C:\Users\Meti\Documents\TuringBot\node_modules\@discordjs\rest\src\lib\handlers\Shared.ts:152:10) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at SequentialHandler.runRequest (C:\Users\Meti\Documents\TuringBot\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:399:20) at SequentialHandler.queueRequest (C:\Users\Meti\Documents\TuringBot\node_modules\@discordjs\rest\src\lib\handlers\SequentialHandler.ts:169:11) at REST.request (C:\Users\Meti\Documents\TuringBot\node_modules\@discordjs\rest\src\lib\REST.ts:343:20) at async UserManager.createDM (C:\Users\Meti\Documents\TuringBot\node_modules\discord.js\src\managers\UserManager.js:60:18) at async UserManager.send (C:\Users\Meti\Documents\TuringBot\node_modules\discord.js\src\managers\UserManager.js:112:13)

This error is continously spammed until the bot isn't terminated using ^C
Cpt-Dingus commented 1 year ago

This was PEBKAC, the userDM config entry was not set causing an infinite loop of errors. There should be a warning for this, or just handling to not recurse infinitely.

Cpt-Dingus commented 1 year ago

This is a more widespread issue, literally any config value that isn't set can cause any number of errors