机器人计数命令不一致 [英] bot counting command discord
问题描述
我有一个不和谐的私人机器人,我一直试图让他计算一个命令,每次我写一个命令时都加"+1",但是它保持在1且不能再走了:像这样
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
我认为我想做的是使它节省命令被写入的时间,并为此数字加上+1;我应该做一个循环之类的东西吗?
I think what I want to do is to make it save the number of time the command has been writen and add +1 to this number ; Should I do a loop or something ?
基本上,我想要的是不和谐的bot在python中是这样的: https://docs.nightbot.tv/commands/variables/count
Basically what I want is something like this in python for a discord bot : https://docs.nightbot.tv/commands/variables/count
推荐答案
每次使用该行调用函数
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.
这篇关于机器人计数命令不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!