【问题标题】:discord python api Bot() and Client()不和谐 python api Bot() 和 Client()
【发布时间】:2018-04-21 19:22:08
【问题描述】:

我正在尝试在 python 中制作一个不和谐的机器人,但我一直遇到问题。我想做的是使用 discord.ext.commands.Bot() 运行命令来创建通道(使用 discord.Client() )。每当我使用 bot.run('token') 启动机器人时,客户端部分都不起作用。但是如果我使用 client.run('token') 运行机器人,我可以创建通道,但不能使用命令。有没有办法让两者同时运行,还是我不走运?

命令代码为:

@bot.command(pass_context=True)
async def channel(ctx):
    client.create_channel(ctx.message.server, 'test', type=discord.ChannelType.text)

【问题讨论】:

标签: python discord.py


【解决方案1】:

你不能直接使用:

await bot.create_channel(ctx.message.server, 'test', type=discord.ChannelType.text)

【讨论】:

    猜你喜欢
    • 2017-03-27
    • 1970-01-01
    • 2021-02-19
    • 2021-11-15
    • 2021-11-23
    • 2021-06-23
    • 2021-08-26
    • 2018-12-16
    • 2021-07-18
    相关资源
    最近更新 更多