Skip to content Skip to sidebar Skip to footer

Bot Counting Command Discord

I have a private bot on discord, i've been trying to make him count a command and adding '+1' everytime I write that one command but it stays at 1 and can't go further : like this

Solution 1:

You're resetting your counter variable back to zero every time you call the function with the line

counter = 0

You can solve this by declaring the counter variable outside of the function and by removing the

counter = 0

line in the function afterwards.

Solution 2:

You're resetting your counter on every call, declaring your counter outside your function will solve the problem

counter = 0asyncdefcmg_thatcommand(self,channel):
 ...
 counter+=1
 ...
 return Response('you wrote that command {} time.' .format(counter))

Post a Comment for "Bot Counting Command Discord"