繁体   English   中英

不和谐的python api Bot()和Client()

[英]discord python api Bot() and Client()

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

该命令的代码是:

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

您不能只使用:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM