问题描述
我想制作一个带有关闭命令的票务系统。但它不起作用。我确实收到了嵌入消息,但是当我对消息做出反应时,什么也没有发生。我什至没有收到错误。
这是我的代码:
@bot.command(name='Close',aliases=['close'])
async def close(ctx):
if ctx.message.channel.name.startswith('ticket'):
msg = 'The ticket is closed. If you aren\'t done yet react to this message with ?,if you are react with ?️'
embed = discord.Embed(title='Closed ticket',description=msg)
message = await ctx.send(content=None,embed=embed)
await message.add_reaction('?')
await message.add_reaction('?️')
await ctx.message.channel.set_permissions(ctx.author,send_messages=False,read_messages=True)
def check(reaction,user):
return user == ctx.message.author and str(reaction.emoji) in ['?','?️']
reaction,user = await bot.wait_for('reaction_add',check=check)
if reaction.emoji == '?️':
countdown = await ctx.send('**Ticket will be closed in 10 seconds**')
await asyncio.sleep(1)
await countdown.edit(content='**Ticket will be closed in 9 seconds**')
await asyncio.sleep(1)
await countdown.edit(content='**Ticket will be closed in 8 seconds**')
await asyncio.sleep(1)
await countdown.edit(content='**Ticket will be closed in 7 seconds**')
await asyncio.sleep(1)
await countdown.edit(content='**Ticket will be closed in 6 seconds**')
await asyncio.sleep(1)
await countdown.edit(content='**Ticket will be closed in 5 seconds**')
await asyncio.sleep(1)
await countdown.edit(content='**Ticket will be closed in 4 seconds**')
await asyncio.sleep(1)
await countdown.edit(content='**Ticket will be closed in 3 seconds**')
await asyncio.sleep(1)
await countdown.edit(content='**Ticket will be closed in 2 seconds**')
await asyncio.sleep(1)
await countdown.edit(content='**Ticket will be closed in 1 second**')
await asyncio.sleep(1)
await ctx.message.channel.delete()
await user.send('**Ticket is deleted**')
if reaction.emoji == '?':
await ctx.send('**Ticket reopened**')
await ctx.message.channel.set_permissions(user,send_messages=True)
else:
await ctx.send('This isnt a ticket')
我已经尝试了一些我发现的选项,但它们不起作用。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)