Python 3.x 有没有办法加入服务器/获取它';让我们通过它来邀请';在您的bot的帮助下的s ID?(本例中的bot已在服务器中)

Python 3.x 有没有办法加入服务器/获取它';让我们通过它来邀请';在您的bot的帮助下的s ID?(本例中的bot已在服务器中),python-3.x,discord.py,discord.py-rewrite,Python 3.x,Discord.py,Discord.py Rewrite,我的机器人在一些我不在的服务器中,我想在机器人的帮助下加入这些服务器 我尝试了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。当然,请使用 应该是这样的 @bot.comma

我的机器人在一些我不在的服务器中,我想在机器人的帮助下加入这些服务器

我尝试了
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。

当然,请使用

应该是这样的

@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.