首页 > 解决方案 > discord.py 简单命令不起作用(在 pythonista 中)

问题描述

我刚刚开始使用 Pythonista 中的 discord.py 机器人,但我不确定为什么这个起始代码(从官方文档复制)不起作用 - 当我输入“!test hello”时,机器人没有回复,而当我之前使用“on_message”时,它工作得很好。当我在笔记本电脑上的 PyCharm 中尝试它时,它也不起作用。任何帮助表示赞赏。谢谢!

import discord
from discord.ext import commands

bot = commands.Bot(command_prefix='!')

@bot.command()
async def test(ctx, arg):
    await ctx.send(arg)


bot.run("myToken")

标签: pythondiscorddiscord.pypythonista

解决方案


由于我真的没有看到问题,也许你可以尝试更新 discord.py 做pip install -U discord.py


推荐阅读