Discord.pyで、投票機能を作りたいです。
サイトやいろいろ調べてみたのですが、解決策がわからず教えていただきたいです。
発生している問題・エラーメッセージ
Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\orang\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) File "C:\Users\orang\OneDrive\デスクトップ\ソマリの尻尾\test.py", line 21, in on_message target_reaction = await client.wait_for(message=msg) TypeError: wait_for() got an unexpected keyword argument 'message'
該当のソースコード
Python
1@client.event 2async def on_message(message): 3 """メンバー募集 (.rect@数字)""" 4 if message.content.startswith(".rect"): 5 mcount = int(message.content[6:len(message.content)]) 6 text= "あと{}人 募集中\n" 7 revmsg = text.format(mcount) 8 frelist = [] 9 msg = await message.channel.send(revmsg) 10 11 await msg.add_reaction("✅") 12 await msg.add_reaction("⬅") 13 await msg.add_reaction('✖') 14 15 while len(frelist) < int(message.content[6:len(message.content)]): 16 target_reaction = await client.wait_for(message=msg) 17 if target_reaction.user != msg.author: 18 if target_reaction.reaction.emoji == "✅": 19 if target_reaction.user.name in frelist: 20 frelist.remove(target_reaction.user.name) 21 mcount += 1 22 await client.edit_message(msg, text.format(mcount) + 23 '\n'.join(frelist)) 24 25 else: 26 pass 27 28 elif target_reaction.reaction.emoji == "⬅": 29 if target_reaction.user.name in frelist: 30 pass 31 32 else: 33 frelist.append(target_reaction.user.name) 34 mcount = mcount - 1 35 await client.edit_message(msg, text.format(mcount) + 36 '\n'.join(frelist)) 37 38 39 elif target_reaction.reaction.emoji == '✖': 40 await client.edit_message(msg, '募集終了\n'+ '\n'.join(frelist)) 41 await client.unpin_message(msg) 42 break 43 await client.remove_reaction(msg, target_reaction.reaction.emoji, target_reaction.user) 44 45 else: 46 await client.edit_message(msg, '募集終了\n'+ '\n'.join(frelist))
一部しか出してないの全く気づきませんでした。
指摘ありがとうございます