Skip to content
Advertisement

discord bot command runs, but gets stuck trying to multiply

everything works fine, it prints the multiplication but it gets stuck on adding more coins to the server, it worked ok until I added the multiplier

JavaScript

any help is appreciated (typing random stuff because my post is mostly code and i need to put these edits but stack overflow is being rude so yeah)

Advertisement

Answer

Initially, you set

JavaScript

but then modified it into a string in on_ready:

JavaScript

Here, result is a list of strings, so servercoins is set to a string. (This is why globals are bad!)

You later try to add it servercoins += 1 * servermultiplier, which is not allowed.

JavaScript

I still don’t know why it causes the code to hang. I would assume that the exception stopped the rest of the command from executing, and then it was silently ignored later on.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement