【问题标题】:Discord.py bot, category isn't being created at the required positionDiscord.py 机器人,未在所需位置创建类别
【发布时间】:2020-11-28 18:10:37
【问题描述】:
import discord
from discord.ext import commands

botToken = "*"
client = commands.Bot(command_prefix = '*')

@client.event
async def on_ready():
    print("I'm ready!")

@client.command()
async def start(ctx):
    a = await ctx.guild.create_category("TEST", position=0)
    a.position = 0

client.run(botToken)

position= intchannel.position = int 不起作用..

没有找到与我的问题相关的任何问题,给https://discord.com/developers/applications 的 bot 管理员权限,并获得了让他进入我的服务器的链接,创建了一个允许所有内容的角色并给了他这个角色,没有工作..

create_text_channelcreate_voice_channel 没有任何变化,频道正在设置,就好像我没有为它们分配位置一样。

Picture showing where the category position

【问题讨论】:

    标签: discord.py


    【解决方案1】:

    它不起作用,因为没有位置 0,第一个位置总是 1

    category = await ctx.guild.create_category("TEST", position=1)
    

    如果它仍然在另一个位置创建类别,您可以手动编辑它:

    await category.edit(position=1)
    

    【讨论】:

    • 谢谢,我实际上看到一个问题,有人回答的位置以 0 开头,确实如此!由于某些原因,前 3-4 次我使用了第一种方法,虽然它由于某些原因停止工作,但第二种方法在使用 position=0 时有效! 非常感谢!
    • 当然,如果有帮助记得采纳答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-09
    • 2020-03-19
    • 1970-01-01
    • 2020-10-16
    • 2020-06-26
    • 2021-05-30
    • 2020-10-26
    相关资源
    最近更新 更多