Discord.py REWRITE-如何进行公会邀请

时间:2020-06-05 11:14:44

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

我正试图让我的机器人创建邀请

invite = await bot.create_invite()

这会导致错误'bot' object has no Attribute 'create_invite'
我正在使用Discord.py Rewrite。

谢谢!

2 个答案:

答案 0 :(得分:1)

使用channel.create_invite()

示例:

invite = await message.channel.create_invite()

答案 1 :(得分:1)

您需要指定要邀请的对象,因为该漫游器当前没有邀请对象:

@bot.command()
async def createinv(ctx):
    invite = ctx.channel.create_invite()
    await ctx.send(f"Here's your invite: {invite}")

参考:

相关问题