FKLC / WhatsAppToDiscord

WhatsAppToDiscord is a Discord bot that uses WhatsApp Web as a bridge between Discord and WhatsApp.
https://fklc.github.io/WhatsAppToDiscord/
MIT License
252 stars 74 forks source link

Bot will crash when invoking list command #115

Closed stnKrisna closed 1 year ago

stnKrisna commented 1 year ago

Describe the bug Bot will crash when you call the list command when the total concatenated groups/chat name is greater than 2000 characters

To Reproduce Steps to reproduce the behavior:

  1. Have lots of active chat/groups (name should total to be greater than 2000 characters)
  2. Invoke list command

Expected behavior The list of active chat/groups should be returned. Either pagination or multiple messages should be returned when listing all active chats. If this is not possible, then the bot should automatically restart

Logs

{"level":50,"time":1667091530065,"pid":63456,"hostname":"[redacted].local","err":{"type":"DiscordAPIError","message":"Invalid Form Body\ncontent: Must be 2000 or fewer in length.","stack":"DiscordAPIError: Invalid Form Body\ncontent: Must be 2000 or fewer in length.\n    at RequestHandler.execute (/snapshot/WhatsAppToDiscord/node_modules/discord.js/src/rest/RequestHandler.js:350:13)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async RequestHandler.push (/snapshot/WhatsAppToDiscord/node_modules/discord.js/src/rest/RequestHandler.js:51:14)\n    at async TextChannel.send (/snapshot/WhatsAppToDiscord/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:176:15)","name":"DiscordAPIError","method":"post","path":"/channels/[redacted]/messages","code":50035,"httpStatus":400,"requestData":{"json":{"content":"[redacted]","tts":false},"files":[]}},"msg":"Invalid Form Body\ncontent: Must be 2000 or fewer in length."}
{"level":30,"time":1667091530065,"pid":63456,"hostname":"[redacted].local","msg":"Exiting!"}

Platform

Additional context Server does not automatically restart on failure. Current workaround is to start the bot using the following command (MacOS & Linux only): while true; do ./WA2DC; sleep 2; done This will start the bot indefinitely. You have 2 seconds after the bot exit to kill the process. Spam ctrl+c to kill

4A49 commented 1 year ago

Try make it restart in Windows by running this batch file.

@echo off :Start C:\path\to\application.exe :: Wait 0 seconds before restarting. TIMEOUT /T 0 GOTO:Start

V3rotti commented 1 year ago

the bot went offline on my server too, but running the batch file is not reactivating it is this another issue?

4A49 commented 1 year ago

the bot went offline on my server too, but running the batch file is not reactivating it

is this another issue?

Let me see your config

V3rotti commented 1 year ago

i cannot recreate the initials setup, even by deleting the bot and creating it back up from scratch. The bot will not create the channels even when i add him to the server.

FKLC commented 1 year ago

If you are still having this issue, please open the issue back with logs. Closing it for now.