有没有办法在机器人的帮助下加入服务器/通过它的 ID 获取它的邀请?(在这种情况下,机器人已经在服务器中)



我的机器人位于我不在的某些服务器中,我想在我的机器人的帮助下加入这些服务器。

我尝试了get_invite(url)但看起来它只收到 discord.gg 的邀请,这不是我想要的。

我拿到了公会ID,现在怎么办?

@bot.command(pass_context = True)
async def mycmd(ctx):
    guild = bot.get_guild(521738684803055636)

我正在使用 Discord.py 重写 1.0.0a。

当然,使用 create_invite()

它应该看起来像这样

@bot.command(pass_context = True)
async def mycmd(ctx):
    channel = ctx.channel
    invite = await channel.create_invite()
@client.command(pass_context=True)
async def link(ctx):
    server = client.get_server("server_id")
    link = client.create_invite(destination=server,xkcd=True,max_age=0,max_uses=number)
    await client.say(link)
    #max_age=0-> Never expire link
    #max_uses-> limit to usage the link
    #xkcd-> The URL fragment used for the invite if it is human readable.    

相关内容

最新更新