Вопрос:

discord python api Bot() and Client()

python discord.py

867 просмотра

1 ответ

345 Репутация автора

I am trying to make a discord bot in python and I keep running into a problem. What I am trying to do is use discord.ext.commands.Bot() to run a command to create a channel (which uses discord.Client() ). Whenever I start the bot using bot.run('token'), the client part does not work. But if I run the bot using client.run('token'), I am able to create the channel, but not use the command. Is there any way to have both running at the same time, or am I out of luck?

The code for the command is:

@bot.command(pass_context=True)
async def channel(ctx):
    client.create_channel(ctx.message.server, 'test', type=discord.ChannelType.text)
Автор: qspitzer Источник Размещён: 08.11.2017 10:46

Ответы (1)


1 плюс

196 Репутация автора

Решение

Can't you just use:

await bot.create_channel(ctx.message.server, 'test', type=discord.ChannelType.text)
Автор: Jörmungandr Размещён: 09.11.2017 01:03
Вопросы из категории :
32x32