[英]SyntaxError || Discord.py || Line 18 of code
我正在創建預售票系統,但我在第 18 行遇到問題,它給了我一個語法錯誤。 請在您的 IDE 中嘗試並幫助我
@bot.event
async def on_raw_reaction_add(payload):
if payload.member.id != bot.user.id and payload.emoji== u"\U0001F3AB":
msg_id, channel_id, category_id= bot.ticket_configs[payload.guild_id]
if payload.message_id == msg_id:
guild= bot.get_guild(payload.guild_id)
for category in guild.categories:
if category.id == category_id:
break
channel = guild.get_channel(channel_id)
ticket_num= 1 if len(category.channels) == 0 else int(category.channels.split("-")[-1]) + 1
ticket_channel= await category.create_text_channel(f"Ticket {ticket_num}", topic= f"Channel for ticket number {ticket_num}.", permission_synced= True)
await ticket_channel.set_permissions(payload.member, read_messages= True, send_messages= True)
message= await channel.fetch_message(msg_id)
await message.remove_reaction(payload.emoji, payload.member)
await ticket_channel.send(f"{payload.member.mention} Thank You! for creating this ticket staff will contact you soon. Type **-close** to close the ticket.")
try:
await bot.wait_for("message", check=lamda m: m.channel== ticket_channel and m.author== payload.member and m.content == "-close", timeout= 3600)
except asyncio.TimeoutError:
await ticket_channel.delete()
else:
await ticket_channel.deleted()
你有一個錯字在線
await bot.wait_for("message", check=lamda m: m.channel== ticket_channel and m.author== payload.member and m.content == "-close", timeout= 3600)
應該是lam b da,即
await bot.wait_for(
"message",
check=lambda m: m.channel == ticket_channel and m.author == payload.member and m.content == "-close",
timeout=3600,
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.