[英]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.