问题描述
所以我正在为我的服务器开发带有 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:
我不知道为什么它根本不起作用.有人可以帮忙吗?
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)
机器人的主文件
播放器类
物品类别
如果有人能帮助我,我将不胜感激:)
I would be so grateful if someone would help me :)
推荐答案
如回答 here,值
的 repli 数据库必须是 JSON 可序列化的.这意味着,您必须(很可能)传递一个 dict 而不是类对象,但是您将无法使用该对象的函数.
as answered here, the value
s 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模板网!