[英]How do you make a bot transfer it's ownership(of a discord server) to a user using the discord.py API?
[英]Make a category on a server with a BOT inside the discord.py API
我是Python的新手(當然是discord.py的新手),在這個問題上,我在網站或官方Discord上都沒有真正找到任何文檔。
我想知道client.get_server('295959610043531264')
內部是否有任何函數可以在服務器上創建類別( client.get_server('295959610043531264')
)
非常感謝 ;)
您可以使用此代碼創建類別和渠道。
命令:!new category admin-chat
@client.command()
async def new(ctx, arg1, arg2):
guild = ctx.message.guild
if arg1 == "channel":
await guild.create_text_channel(arg2)
elif arg1 == "category":
await ctx.guild.create_category(arg2)
您只能使用重寫版本discord.py ( 1.0.0a )創建類別。
這是它的文檔。
這將是我如何使用命令擴展名執行此操作的示例:
@bot.command()
async def create_category(ctx, *, name):
await ctx.guild.create_category(name)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.