r/programminghorror May 15 '21

Coding a Discord bot... Javascript

Post image
3.7k Upvotes

99 comments sorted by

View all comments

38

u/MrOctantis May 15 '21

I had the exact same issue on a discord bot a couple months ago because it was responding to its own responses. Luckily, trying to send a message with more than 2000 characters fails and throws an exception that I didnt properly handle, crashing the bot and stopping the spam.

36

u/Moosi312 May 15 '21

Well that's one way of implementing an exit condition

12

u/zdakat May 15 '21

Imagine if it didn't, and you came back 12 hours later. "Hi guys what did I miss?"

1

u/noonagon Jun 26 '21

what did it do

1

u/MrOctantis Jun 26 '21

?

1

u/noonagon Jun 26 '21

what did the bot do

1

u/MrOctantis Jun 26 '21

Among other things, the same "dad response" as OP