python - discord.ext.commands.errors.CommandInvokeError:TypeError: open() 接受 1 个位置参数,但给出了 2 个
问题描述
我正在尝试建立 discord.py 经济,这是代码
async def get_bank_data():
with open(bandata, "r") as f:
users = json.load(f)
return users
但是它返回“discord.ext.commands.errors.CommandInvokeError:命令引发异常:TypeError:open()需要1个位置参数但给出了2个”,有什么办法解决吗?
解决方案
简单命令的示例可以解决您的问题:
@discord.ext.commands.command()
async def ping(ctx: discord.ext.commands.Context):
await ctx.send('pong')
推荐阅读
- python - 由于 python 导入模块中的 c++ 断言,如何处理 Celery WorkerLostError?
- azure-logic-apps - Azure 逻辑应用程序 - 从 SharePoint Online 复制到 Azure Web 应用程序
- r - 将变量放在R中的引号中(转义函数的引号)
- mysql - 如何从表格中获取私信列表?
- jquery - 如何使用 jQuery 在元素中设置纯文本样式?
- javascript - 将 Mysql 查询结果回显到框中
- java - 在 Hibernate 中将对象从查询转换为其他类?
- node.js - Azure 函数 - 从磁盘读取文件并返回 HTML 页面
- excel - 如何使用 vbNullString 删除数字
- c++ - 如何预先分配空类对象,然后在 if 语句的花括号中创建该对象?