在response//ticket bot discord.py上删除通道

n3schb8v  于 2021-08-20  发布在  Java
关注(0)|答案(0)|浏览(245)

我正在尝试制作一个票务机器人,这就是我目前拥有的。现在,我可以让机器人在检测到一个React后创建一个通道,我需要能够让它关闭另一个React的记录单,以及我想添加的其他功能。但是这个React在创建的通道中,所以我不知道如何创建通道id。有人建议我使用齿轮,但不知道从哪里开始。

async def on_raw_reaction_add(payload):
    channel = payload.channel_id
    if channel == 862711339298455563:
        guildid = payload.guild_id
        guild = client.get_guild(guildid)
        channel = guild.get_channel(payload.channel_id)
        message = channel.get_partial_message(payload.message_id)
        emoji = '🎟️'
        member = payload.member

        payloaduserid = payload.user_id
        clientuserid = client.user.id   
        if payloaduserid != clientuserid: 
            await message.remove_reaction(emoji, member)
            category = client.get_channel(861003967000215583)
            channel1 = await guild.create_text_channel(f'ticket {payload.user_id}', category = category )

            ticketembed = discord.Embed(
                title = f'Ticket - {payload.user_id}',
                description = '- If you want to tag the admins please react with :telephone: \n - To report this message please react with   :warning: \n - To close the ticket react this mesaage with   :x:  ',
                color = discord.Color.red())
            ticketembed.set_footer(text = 'All of the conversation will be held in the archives, eventhought a moderator can delete a message in this channel, a copy of it will be held in a location where only the owner can access.')

            user = client.get_user(payload.user_id)
            await channel1.set_permissions(target=user, read_messages=True , send_messages=True)

            ticketembed1 = await channel1.send(embed= ticketembed)

            await ticketembed1.add_reaction('☎️')
            await ticketembed1.add_reaction('⚠️')
            await ticketembed1.add_reaction('❌') 
            await channel1.send(f'{user.mention}', delete_after = 0.1) ```

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题