久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <small id='H4l7Q'></small><noframes id='H4l7Q'>

    1. <i id='H4l7Q'><tr id='H4l7Q'><dt id='H4l7Q'><q id='H4l7Q'><span id='H4l7Q'><b id='H4l7Q'><form id='H4l7Q'><ins id='H4l7Q'></ins><ul id='H4l7Q'></ul><sub id='H4l7Q'></sub></form><legend id='H4l7Q'></legend><bdo id='H4l7Q'><pre id='H4l7Q'><center id='H4l7Q'></center></pre></bdo></b><th id='H4l7Q'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='H4l7Q'><tfoot id='H4l7Q'></tfoot><dl id='H4l7Q'><fieldset id='H4l7Q'></fieldset></dl></div>
        <bdo id='H4l7Q'></bdo><ul id='H4l7Q'></ul>
      <legend id='H4l7Q'><style id='H4l7Q'><dir id='H4l7Q'><q id='H4l7Q'></q></dir></style></legend>

      1. <tfoot id='H4l7Q'></tfoot>

      2. ValueError:replit 數據庫檢測到循環引用

        ValueError: circular reference detected with replit database(ValueError:replit 數據庫檢測到循環引用)

          <tfoot id='5NsI5'></tfoot>

            <small id='5NsI5'></small><noframes id='5NsI5'>

            • <legend id='5NsI5'><style id='5NsI5'><dir id='5NsI5'><q id='5NsI5'></q></dir></style></legend>
                <tbody id='5NsI5'></tbody>
              • <bdo id='5NsI5'></bdo><ul id='5NsI5'></ul>
                <i id='5NsI5'><tr id='5NsI5'><dt id='5NsI5'><q id='5NsI5'><span id='5NsI5'><b id='5NsI5'><form id='5NsI5'><ins id='5NsI5'></ins><ul id='5NsI5'></ul><sub id='5NsI5'></sub></form><legend id='5NsI5'></legend><bdo id='5NsI5'><pre id='5NsI5'><center id='5NsI5'></center></pre></bdo></b><th id='5NsI5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='5NsI5'><tfoot id='5NsI5'></tfoot><dl id='5NsI5'><fieldset id='5NsI5'></fieldset></dl></div>

                1. 本文介紹了ValueError:replit 數據庫檢測到循環引用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  所以我正在為我的服務器開發帶有 discord.py 的不和諧機器人.我正在使用replit的數據庫系統.當我嘗試將我的類 Player 的實例添加到該數據庫的鍵時,它說:

                  So I'm developing discord bot with discord.py for my server. I'm using replit's database system. When I try to add instance of my class Player to key of that database it says:

                  
                  Traceback (most recent call last):
                    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
                      ret = await coro(*args, **kwargs)
                    File "main.py", line 36, in jointothefun
                      db[f"{context.message.author.id}"] = p
                    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/database.py", line 486, in __setitem__
                      self.set(key, value)
                    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/database.py", line 495, in set
                      self.set_raw(key, _dumps(value))
                    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/database.py", line 56, in dumps
                      return json.dumps(val, separators=(",", ":"), cls=DBJSONEncoder)
                    File "/usr/lib/python3.8/json/__init__.py", line 234, in dumps
                      return cls(
                    File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
                      chunks = self.iterencode(o, _one_shot=True)
                    File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
                      return _iterencode(o, 0)
                  ValueError: Circular reference detected
                  
                  The above exception was the direct cause of the following exception:
                  
                  Traceback (most recent call last):
                    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 902, in invoke
                      await ctx.command.invoke(ctx)
                    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 864, in invoke
                      await injected(*ctx.args, **ctx.kwargs)
                    File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
                      raise CommandInvokeError(exc) from exc
                  discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: Circular reference detected
                  

                  我不知道為什么它根本不起作用.有人可以幫忙嗎?

                  I have no idea why it's not working at all. Some one could help?

                  哦,還有源代碼(是的,我知道我正在制作意大利面條代碼)

                  Oh and source code (yes i know i'm making spaghetti code)

                  機器人的主文件

                  from discord.ext import commands
                  from replit import db
                  from alive import startup
                  from playerclass import Player
                  print(db.keys())
                  class PlayerClient(discord.Client):
                      async def on_member_join(self,member):
                          print(f"{member} joined")
                      async def on_ready(self):
                          print("Bot ready to work!")
                      def __init__(self):
                          self.intents = discord.Intents(messages = True, guilds = True, reactions = True, members = True, presences = True)
                          self.bot = commands.Bot(command_prefix = '~rpg ', intents = intents)
                  intents = discord.Intents(messages = True, guilds = True, reactions = True, members = True, presences = True)
                  client = bot = commands.Bot(command_prefix = '~rpg ', intents = intents)
                  @client.command(name='join')
                  async def jointothefun(context):
                      keys = db.keys()
                      rpgc = client.get_channel(811518285634863124)
                      if context.message.channel == rpgc:
                          if not f"{context.message.author.id}" in keys:            
                              await context.message.channel.send("Hi "+str(context.message.author.mention))
                              #not working code
                              db[f"{context.message.author.id}"] = Player(100,0,0,0,0,1)
                          else:
                              await context.message.channel.send("Bruh you've joined already")
                      else:
                          await context.message.channel.send('Yo wrong channel!')
                  @client.command(name='stats')
                  async def stats(context):
                      rpgc = client.get_channel(811518285634863124)
                      if context.message.channel==rpgc:
                        keys = db.keys()
                        if str(context.message.author.id) in keys:
                              embed=db[str(context.message.author.id)].displayEquipment
                              await context.send(embed=embed)
                        else:
                              await context.message.channel.send("Join first to access stats!")
                      else:
                          await context.message.channel.send(f"XD {context.message.author.mention} to nie ten kana?! Pisz na #rpg")
                  
                  @client.command()
                  async def ping(ctx):
                      await ctx.send("Pong!")
                  startup()
                  #yes i know that will not work but it's private i guess it's obvious
                  client.run("my bot token")
                  

                  播放器類

                  from item_class import Weapon
                  import discord
                  class Player:
                    def __init__(self,h,m,de,c,t,dm):
                      self.hp=h
                      self.mana=m
                      self.defense=de
                      self.coins=c
                      self.truecoins=t
                      self.weapon=Weapon("Stick",10,1,1,100,1,0)
                      self.dmg=dm+self.weapon.dmg
                      self.itlist=[]
                    def addItemToEq(self,it):
                      self.itlist.append(it)
                    def displayEquipment(self,client,context):
                      embed = discord.Embed(
                        title="Inventory",colour=discord.Colour.Green)
                      for i in self.itlist:
                        if type(i)==Weapon:
                          embed.add_field(i.self.name,"Weapon",False)
                        else:
                          embed.add_field(i.self.name,"Item",False)
                      return embed
                  

                  物品類別

                  import random
                  class Item:
                      def __init__(self,name):
                          self.name = name
                      def use(self):
                          print("its normal item bruh")
                  class Food(Item):
                      def __init__(self,name,nutrition):
                          self.name=name
                          self.hpboost=nutrition
                  class Weapon(Item):
                      def __init__(self,name,durablity,dmgboost,critchcmin,critchcmax,crit,boost):
                          self.name=name
                          self.durablity=durablity
                          self.dmg=dmgboost
                          self.critmin=critchcmin
                          self.critmax=critchcmax
                          self.critdmg=crit
                          self.fnc=boost
                      def attack(self):
                          print(self.dmg)
                          print(str(self.calcCrit()))
                          self.durablity-=1
                      def calcCrit(self):
                          if random.randint(self.critmin,self.critmax)<=self.critmax/2:
                              return True
                          else:
                              return False
                      def useBoost(self):
                          self.boost()
                  

                  如果有人能幫助我,我將不勝感激:)

                  I would be so grateful if someone would help me :)

                  推薦答案

                  如回答 here, 的 repli 數據庫必須是 JSON 可序列化的.這意味著,您必須(很可能)傳遞一個 dict 而不是類對象,但是您將無法使用該對象的函數.

                  as answered here, the values of replit's database must be JSON-serializable. This means, you'd have to pass (most likely) a dict instead of a class object, but then you won't be able to use the object's functions.

                  這篇關于ValueError:replit 數據庫檢測到循環引用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)

                          <tbody id='diJ1C'></tbody>
                        • <tfoot id='diJ1C'></tfoot>

                          <small id='diJ1C'></small><noframes id='diJ1C'>

                          <i id='diJ1C'><tr id='diJ1C'><dt id='diJ1C'><q id='diJ1C'><span id='diJ1C'><b id='diJ1C'><form id='diJ1C'><ins id='diJ1C'></ins><ul id='diJ1C'></ul><sub id='diJ1C'></sub></form><legend id='diJ1C'></legend><bdo id='diJ1C'><pre id='diJ1C'><center id='diJ1C'></center></pre></bdo></b><th id='diJ1C'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='diJ1C'><tfoot id='diJ1C'></tfoot><dl id='diJ1C'><fieldset id='diJ1C'></fieldset></dl></div>

                        • <legend id='diJ1C'><style id='diJ1C'><dir id='diJ1C'><q id='diJ1C'></q></dir></style></legend>
                          • <bdo id='diJ1C'></bdo><ul id='diJ1C'></ul>

                          • 主站蜘蛛池模板: 亚洲欧美一区二区三区国产精品 | 精品久久电影 | 久久综合久色欧美综合狠狠 | 久久国内 | 久久精品成人 | 九九九久久国产免费 | 欧美性一区二区三区 | 久久精品国产一区二区电影 | 亚洲午夜av久久乱码 | 一区二区三区国产好 | 在线午夜电影 | 亚洲日本视频 | 欧美久久久久久久 | 91精品国产欧美一区二区 | 99亚洲精品 | 中文字幕亚洲区一区二 | 婷婷中文字幕 | 一区二区三区四区免费观看 | 亚洲国产aⅴ成人精品无吗 欧美激情欧美激情在线五月 | 国产精品视频久久久 | 亚洲不卡 | 色欧美片视频在线观看 | 亚洲成人一区 | 欧美黄色一级毛片 | 国产精品国产精品国产专区不片 | 欧美福利视频一区 | 久久成人一区 | 久久视频精品在线 | 亚洲性综合网 | 欧美成人一区二区 | 国产9久| 亚洲日韩中文字幕一区 | 国产日韩精品视频 | 美女毛片免费看 | 国产欧美日韩一区二区三区在线 | 欧美一区二区免费 | 五月香婷婷 | 亚洲精品视频一区 | 国产在线资源 | 国产成人精品久久二区二区 | 日日日操 |