使用 discord.py 创建服务器并获得邀请

Using discord.py to create a server and get an invite

我使用 discord.py 创建了一个公会,但我不知道如何获得加入该公会的邀请!如何获得邀请?

相信运行create_invite()可以拿到新公会的邀请。 Documentation link

my_guild = await client.create_guild("My Server!") # replace "client" with the name of your discord client variable

my_guild_invite = await my_guild.text_channels[0].create_invite() # makes invite for the first text channel and returns an Invite class

print(my_guild_invite.code)