human-internet / discord-bot

Code for a bot that allows user authentication with Discord (i.e. you login with humanID and you get assigned a role of 'authenticated')
1 stars 1 forks source link

[TN-270] Account for cases when the server admin changes the humanID Verified role for a member #118

Closed ccrawford4 closed 3 months ago

ccrawford4 commented 6 months ago

At present, if a server admin changes the role of a member this is not reflected in the Discord-Bot's db. For example: If a server admin removes the humanID verified role from a user then this should un-verify the user (requiring them to verify again) but it doesn't.

Target:

  1. Account for manual verification: a. If a server admin removes the humanID-Verified role for a user - they should be considered un-verified on our end (database) as well b. If a member leaves or is kicked from the server, unverified them from backend database. c. If a server admin adds the humanID-Verified role to a user - this should be reflected in the Discord-Bots db (can't)

Sub-tasks:

  1. git pull the newest updated code from "main" branch.
  2. work on a new branch -> git checkout -b feature/yournameinitial/tn270
  3. Add two functions to account for the upper two cases. tips: Utilize discord.py API: (https://discordpy.readthedocs.io/en/stable/api.html) on_member_update: triggers when member's info(channel username, roles) change. on_member_remove: triggers when a member leaves or is removed from the server
  4. git add related files manually, do not use "git add ." then git commit
  5. git push -u origin feature/yournameinitial/tn270

After you finishing: A. send a screen recording(if applicable) reflect the change to #tech and have Luna and Bastian approve. B. After approval, create a PR, address automated checks & coderabbit concern, get at least one peer code review --> Merge to staging

ccrawford4 commented 6 months ago

@bastian-purrer This should probably be split into separate tickets but I wanted to get your feedback first.

kofimokome commented 6 months ago

First, we need to figure out if Discord provides events for:

  1. When the role of a user changes.
  2. When a user leaves the Discord server
  3. When a user is removed from the Discord server. All we need to do is to subscribe to these events and update the database when they are triggered.
bastian-purrer commented 6 months ago

@ccrawford4 yeah definitely 2 tickets, one for "role of user changes", one for "role is removed". I don't see why your points c and d are needed though. What's the user impact scenario of not doing that?

cc @kofimokome @Lunasocute @kyley422

ccrawford4 commented 6 months ago

@ccrawford4 yeah definitely 2 tickets, one for "role of user changes", one for "role is removed". I don't see why your points c and d are needed though. What's the user impact scenario of not doing that?

cc @kofimokome @Lunasocute @kyley422

I am not following - "user impact scenario of not doing that?" What do you mean? If a user leaves the server they should be considered un-verified. I would imagine its the equivalent of if someone logs out of something - they should be required to log back in. By "leave the server" I mean a user actually removes their account from the server, not just exists discord. Same thing should apply if a server admin manually removes a user.

bastian-purrer commented 6 months ago

If a user leaves the server they should be considered un-verified.

I disagree. We're not the login (that's discord), we're the humanity-check. why do that again?

kyley422 commented 6 months ago

At present if a server admin changes the role of a member this is not reflected in the Discord-Bot's db. For example: If a server admin removes the humanID verified role from a user then this should un-verify the user (requiring them to verify again) but it doesn't.

Steps to improve:

  1. Account for manual verification: a. If a server admin adds the humanID Verified role to a user - this should be reflected in the Discord-Bots db b. If a server admin removes the humanID Verified role for a user - they should be considered un-verified on our end as well

Sub-tasks (thank you kofi):

  1. Find out if Discord provides events for: a. When the role of a user changes.
  2. (If possible): Subscribe to these events and update the database when they are triggered

Re: Kofi's subtasks: All of these are possible, just need to work on connecting the listener in discordbot.py to the database.

Lunasocute commented 4 months ago

First, we need to figure out if Discord provides events for:

  1. When the role of a user changes.
  2. When a user leaves the Discord server
  3. When a user is removed from the Discord server. All we need to do is to subscribe to these events and update the database when they are triggered.

@kofimokome @bastian-purrer

There are functions that can be triggered for these events:

  1. on_member_update: triggers when member's info(channel username, roles) change.
  2. on_member_remove: triggers when a member leaves or is removed from the server
bastian-purrer commented 3 months ago

Status 7/29: @bdonyan & @suganeswar03 - please both submit your solutions by Wednesday. Timeline: Together under @Lunasocute 's leadership to combine so we can merge by EOW

bdonyan commented 3 months ago

submitted my solutions a few hours ago with video demonstration, ready for approval

suganeswar03 commented 3 months ago

Even I have completed the ticket bastian, you can check in our tech group in discord.

On Mon, Jul 29, 2024 at 10:41 PM Bastian Purrer @.***> wrote:

Status 7/29: @bdonyan https://github.com/bdonyan & @suganeswar03 https://github.com/suganeswar03 - please both submit your solutions by Wednesday. Timeline: Together under @Lunasocute https://github.com/Lunasocute 's leadership to combine so we can merge by EOW

— Reply to this email directly, view it on GitHub https://github.com/human-internet/discord-bot/issues/118#issuecomment-2256468834, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGDPZ33KGE7WOWGGT7BZFRLZOZZTPAVCNFSM6AAAAABGXR25KGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJWGQ3DQOBTGQ . You are receiving this because you were mentioned.Message ID: @.***>

bastian-purrer commented 3 months ago

@Lunasocute Live by end of the week