BaboucheOne / BuggyBot

Simply a customs agent
5 stars 1 forks source link

Register bug #121

Open BaboucheOne opened 1 month ago

BaboucheOne commented 1 month ago

When a new user enter the discord and type the command !register 111111111. See logs below:

2024-07-29 11:16:41,771 - BuggyBotLogger - INFO - {"version": 2, "method": "register", "message": "Exécution de la commande par a_mystery_user"}
2024-07-29 11:16:41,772 - BuggyBotLogger - INFO - {"version": 2, "method": "register_student", "message": "Réception de la requête RegisterStudentRequest(111111111, 223525355096933401)"}
2024-07-29 11:16:41,975 - BuggyBotLogger - INFO - {"version": 2, "method": "find_student_by_ni", "message": "L'étudiant Student(111111111, Clemou, DuPain, B-IFT, False, -1) a bien été ajouté à la cache."}
2024-07-29 11:16:42,180 - BuggyBotLogger - INFO - {"version": 2, "method": "update_student", "message": "NI(111111111) a bien été marqué comme sale."}
2024-07-29 11:16:42,385 - BuggyBotLogger - INFO - {"version": 2, "method": "register_student", "message": "L'étudiant NI(111111111) DiscordUserId(223525355096933401) a bien été enregistré."}
2024-07-29 11:16:42,578 - BuggyBotLogger - INFO - {"version": 2, "method": "find_student_by_ni", "message": "L'étudiant Student(111111111, Clemou, DuPain, B-IFT, False, 223525355096933401) a bien été ajouté à la cache."}
Task exception was never retrieved
future: <Task finished name='Task-26' coro=<DiscordService.__add_member_roles() done, defined at /buggybot/bot/application/discord/discord_service.py:120> exception=AttributeError("'NoneType' object has no attribute 'add_roles'")>
Traceback (most recent call last):
  File "/buggybot/bot/application/discord/discord_service.py", line 122, in __add_member_roles
    await member.add_roles(role)
AttributeError: 'NoneType' object has no attribute 'add_roles'
Task exception was never retrieved
future: <Task finished name='Task-27' coro=<DiscordService.__set_member_nick_name() done, defined at /buggybot/bot/application/discord/discord_service.py:100> exception=AttributeError("'NoneType' object has no attribute 'edit'")>
Traceback (most recent call last):
  File "/buggybot/bot/application/discord/discord_service.py", line 102, in __set_member_nick_name
    await member.edit(nick=nickname)
AttributeError: 'NoneType' object has no attribute 'edit'
2024-07-29 11:16:43,027 - BuggyBotLogger - INFO - {"version": 2, "method": "register", "message": "La commande a été exécutée avec succès."}
BaboucheOne commented 1 month ago

After inspection, this bug is frequent when the user try to register but the SERVER_ID is not set on the correct server. For example, the bot is currently running on my test server that means that if a user try to register, I can't get it's info because he's not my on test server.

Maybe we should create / user a decorator that check if the current user in currently on the server before acception his request,