2021年3月5日星期五

How to save values from a command into .json?

I have a command that every time it is triggered, it increases its value by 1, but whenever the bot goes offline, the counter goes to 0 again:

class Counter(commands.Cog):      def __init__(self, bot):          self.bot = bot          self.counter = 0        @commands.command()      async def increase(self, ctx):          self.counter += 1    def setup(bot):      bot.add_cog(Counter(bot))  

I want to save the number into a .json file so that he is always saved and continues where he left off but I don't know how to do it.

https://stackoverflow.com/questions/66501970/how-to-save-values-from-a-command-into-json March 06, 2021 at 11:07AM

没有评论:

发表评论