vladionescu / keybase-gitea-bot

Based on Keybase's Gitlab bot. Notifications in Keybase Teams for Gitea, using webhooks.
MIT License
3 stars 3 forks source link

Implement hook for mentions in comments #1

Open 0xdeadbeefJERKY opened 4 years ago

0xdeadbeefJERKY commented 4 years ago

Implement webhook that parses the content of a comment (e.g., within Issues, PRs) and identifies Gitea username mentions (e.g., via regex). Additionally, create a mapping between Gitea accounts and their corresponding Keybase accounts, allowing the webhook to specifically ping the user within Keybase that owns the Gitea account being mentioned in the comment.

vladionescu commented 4 years ago

Assuming the Gitea comment contains an @username string, Keybase should automatically make that clickable and a mention as if you typed it yourself in chat.

The problem will be when someone has a different Gitea username from their Keybase username. For instance I'm @vladi on Keybase but @vlad on the local Gitea server.

Since this bot already uses a DB for storing other stuff, we can store a mapping of Gitea<->Keybase usernames and, when the bot sees a Gitea user mentioned it can @ them using their Keybase username.

I'm thinking we can let people opt-in to getting mentioned in chat whenever a certain word appears in a Gitea payload (comment, commit message, etc).

!gitea notifyme <word>

People can use this to ask the bot to mention them whenever a certain word appears. Initially it can be used for the username mapping, but it's just as usable for watching for activity concerning a certain thing, like "infrastructure" or "javascript".

NiorVector commented 3 years ago

Problem solved, the gitea user profile requires a "fullname" in order to be displayed. I recommend all of us using our keybase usernames with the @ symbol. Example: fullname: @malwareunicorn