Python Discord.py票证创建有问题

Python Discord.py票证创建有问题,python,discord.py,discord.py-rewrite,Python,Discord.py,Discord.py Rewrite,嘿,伙计们,我这里有一个代码,比如说,如果我创建了一张罚单,烫发不会被编辑,就像每个人都可以看到罚单一样 有人能帮忙吗D 唯一错误的是烫发,就像我说的,它有时不编辑代码 如果你能帮我们的话,那就太棒了。这对我们的服务器非常重要,我们需要一些帮助 如果你能编辑代码,我真的不知道这个代码有什么问题 祝你玩得愉快,谢谢你的帮助 @bot.command() async def new(ctx, *, args = None): await bot.wait_until_ready()

嘿,伙计们,我这里有一个代码,比如说,如果我创建了一张罚单,烫发不会被编辑,就像每个人都可以看到罚单一样

有人能帮忙吗D

唯一错误的是烫发,就像我说的,它有时不编辑代码

如果你能帮我们的话,那就太棒了。这对我们的服务器非常重要,我们需要一些帮助

如果你能编辑代码,我真的不知道这个代码有什么问题

祝你玩得愉快,谢谢你的帮助

@bot.command()
async def new(ctx, *, args = None):

    await bot.wait_until_ready()

    if args == None:
        message_content = ""

    else:
        message_content = "".join(args)

    with open("data.json") as f:
        data = json.load(f)

    ticket_number = int(data["ticket-counter"])
    ticket_number += 1

    ticket_channel = await ctx.guild.create_text_channel("ticket-{}".format(ticket_number))
    await ticket_channel.set_permissions(ctx.guild.get_role(ctx.guild.id), send_messages=False, read_messages=False)

    for role_id in data["valid-roles"]:
        role = ctx.guild.get_role(role_id)

        await ticket_channel.set_permissions(role, send_messages=True, read_messages=True, add_reactions=True, embed_links=True, attach_files=True, read_message_history=True, external_emojis=True)

    await ticket_channel.set_permissions(ctx.author, send_messages=True, read_messages=True, add_reactions=True, embed_links=True, attach_files=True, read_message_history=True, external_emojis=True)

    em = discord.Embed(title="Ticket by {}#{}".format(ctx.author.name, ctx.author.discriminator), description= "Hey i have a Build in responding system Ask things and Maybe i can respond, if not our Supporters can help you out!\n``To close this ticket type +close``", color=0x00a8ff)

    await ticket_channel.send(embed=em)

    pinged_msg_content = ""
    non_mentionable_roles = []

    if data["pinged-roles"] != []:

        for role_id in data["pinged-roles"]:
            role = ctx.guild.get_role(role_id)

            pinged_msg_content += role.mention
            pinged_msg_content += " "

            if role.mentionable:
                pass
            else:
                await role.edit(mentionable=True)
                non_mentionable_roles.append(role)

        await ticket_channel.send(pinged_msg_content)

        for role in non_mentionable_roles:
            await role.edit(mentionable=False)

    data["ticket-channel-ids"].append(ticket_channel.id)

    data["ticket-counter"] = int(ticket_number)
    with open("data.json", 'w') as f:
        json.dump(data, f)

    created_em = discord.Embed(title="Clipox Support", description="Ohh... a Wild Ticket appeared, Look here {}".format(ticket_channel.mention), color=0x00a8ff)

    await ctx.send(embed=created_em)

对于每个人角色,使用
ctx.guild.default\u角色

换行

等待票证频道。设置权限(ctx.guild.get\u角色(ctx.guild.id),发送消息=False,读取消息=False)
对此

wait ticket\u channel.设置权限(ctx.guild.default\u角色,send\u messages=False,read\u messages=False)