为公会设置文本频道的命令

时间:2020-12-21 13:32:47

标签: python discord discord.py discord.py-rewrite

我想创建一个在服务器中设置频道的命令,我该怎么做?这是正确的原因,它不断给我错误,

代码:

@Bot.command()
async def azsetup(ctx, guild, channelName):
    await guild.create_text_channel('cool-channel')
    
    embed = discord.Embed(title='', description=f"Setup is Done:" , color = discord.Color.green, timestamp=ctx.message.created_at)
    embed.add_field(name="Note:" , value ="All the Modlogs and Important Announcements will be set there!")
    await ctx.send(embed = embed)

1 个答案:

答案 0 :(得分:1)

您没有正确定义命令,guild 已包含在 ctx 中。 *,channelname 将命令后的所有内容设为频道名称

@Bot.command()
async def azsetup(ctx, *,channelName):
    await ctx.guild.create_text_channel(channelName)