pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

      <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="jrz55fh" 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="d5b55fr" 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="lt7nlvz" 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>

                          • 主站蜘蛛池模板: 专业甜品培训学校_广东糖水培训_奶茶培训_特色小吃培训_广州烘趣甜品培训机构 | 冷却塔厂家_冷却塔维修_冷却塔改造_凉水塔配件填料公司- 广东康明节能空调有限公司 | 楼承板-钢筋楼承板-闭口楼承板-无锡优贝斯楼承板厂 | 引领中高档酒店加盟_含舍·美素酒店品牌官网 | 钢托盘,钢制托盘,立库钢托盘,金属托盘制造商_南京飞天金属制品实业有限公司 | 水压力传感器_数字压力传感器|佛山一众传感仪器有限公司|首页 | 杭州画室_十大画室_白墙画室_杭州美术培训_国美附中培训_附中考前培训_升学率高的画室_美术中考集训美术高考集训基地 | 中国在职研究生招生信息网| 小青瓦丨古建筑瓦丨青瓦厂家-宜兴市徽派古典建筑材料有限公司 | 视频直播 -摄影摄像-视频拍摄-直播分发| 驾驶人在线_专业学车门户网站| 车件|铜件|车削件|车床加工|五金冲压件-PIN针,精密车件定制专业厂商【东莞品晔】 | 大流量卧式砂磨机_强力分散机_双行星双动力混合机_同心双轴搅拌机-莱州市龙跃化工机械有限公司 | 棕刚玉_白刚玉_铝酸钙-锐石新材料 | 飞飞影视_热门电影在线观看_影视大全 | 喷码机,激光喷码打码机,鸡蛋打码机,手持打码机,自动喷码机,一物一码防伪溯源-恒欣瑞达有限公司 | 骨灰存放架|骨灰盒寄存架|骨灰架厂家|智慧殡葬|公墓陵园管理系统|网上祭奠|告别厅智能化-厦门慈愿科技 | HEYL硬度计量泵-荧光法在线溶解氧仪-净时测控技术(上海)有限公司 | Jaeaiot捷易科技-英伟达AI显卡模组/GPU整机服务器供应商 | 冷藏车-东风吸污车-纯电动环卫车-污水净化车-应急特勤保障车-程力专汽厂家-程力专用汽车股份有限公司销售二十一分公司 | 光栅尺厂家_数显表维修-苏州泽升精密机械 | 乐泰胶水_loctite_乐泰胶_汉高乐泰授权(中国)总代理-鑫华良供应链 | 粉末冶金-粉末冶金齿轮-粉末冶金零件厂家-东莞市正朗精密金属零件有限公司 | 闪电优家-卫生间防水补漏_酒店漏水渗水维修_防水堵漏公司 | 珠海白蚁防治_珠海灭鼠_珠海杀虫灭鼠_珠海灭蟑螂_珠海酒店消杀_珠海工厂杀虫灭鼠_立净虫控防治服务有限公司 | 环比机械 | 分光色差仪,测色仪,反透射灯箱,爱色丽分光光度仪,美能达色差仪维修_苏州欣美和仪器有限公司 | 搪玻璃冷凝器_厂家-越宏化工设备| 爱佩恒温恒湿测试箱|高低温实验箱|高低温冲击试验箱|冷热冲击试验箱-您身边的模拟环境试验设备技术专家-合作热线:400-6727-800-广东爱佩试验设备有限公司 | 车充外壳,车载充电器外壳,车载点烟器外壳,点烟器连接头,旅行充充电器外壳,手机充电器外壳,深圳市华科达塑胶五金有限公司 | 玻璃钢格栅盖板|玻璃钢盖板|玻璃钢格栅板|树篦子-长沙川皖玻璃钢制品有限公司 | 微信小程序定制,广州app公众号商城网站开发公司-广东锋火 | ZHZ8耐压测试仪-上海胜绪电气有限公司 | 福州时代广告制作装饰有限公司-福州广告公司广告牌制作,福州展厅文化墙广告设计, | 永嘉县奥阳陶瓷阀门有限公司 | 冷藏车厂家|冷藏车价格|小型冷藏车|散装饲料车厂家|程力专用汽车股份有限公司销售十二分公司 | ERP企业管理系统永久免费版_在线ERP系统_OA办公_云版软件官网 | 济南货架定做_仓储货架生产厂_重型货架厂_仓库货架批发_济南启力仓储设备有限公司 | 压片机_高速_单冲_双层_花篮式_多功能旋转压片机-上海天九压片机厂家 | 外贸资讯网 - 洞悉全球贸易,把握市场先机| 胃口福饺子加盟官网_新鲜现包饺子云吞加盟 - 【胃口福唯一官网】 |