This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
feat: ✨ trigger the bot by mentioning it #81
Draft
HarHarLinks
wants to merge
17
commits into
imbev:master
Choose a base branch
from
HarHarLinks:call-by-mention
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
33776ba
add bot trigger: mention
HarHarLinks d6a3a34
fix api.args() for mentions
HarHarLinks e73f24b
Fix messagemath.mention.
2d63cbe
Refactor messagematch.command
57147ec
docs: 📝 Add match.mention() docs
HarHarLinks 9a2e924
refactor MessageMatch.mention()
HarHarLinks 809186e
refactor command() into mention()
HarHarLinks c2414d3
add tests for mention()
HarHarLinks 25c8ce8
add comments to mention related class privates
HarHarLinks 45599af
fix None exception in args
HarHarLinks 3a5d621
correctly strip mention from command
HarHarLinks 6b8a0d9
fix command() list index out of range
HarHarLinks 2e380d5
refactor: :recycle: Refactor MessageMatch class
deecc36
Fix errors introduced by commit 2e380d53
cbd843d
test: :white_check_mark: Fix messagematch tests
708eb2b
Enable failing tests
a2bde24
refactor: :recycle: Change order of if statements to improve readabil…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems to be required to reliably load
self.room.own_user_id
andself.room.users
which may be empty otherwise from testing. I hope there is a better way to do it than just syncing everything.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does self.room.own_user_id follow the structure of @username:homeserver ? If so, it would not be neccesary to do anything with self.room.users to obtain it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.room
is aDict[str, MatrixUser]
.MatrixUser
containsdisplay_name
anddisambiguated_name
which we need formention()
matchesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this https://matrix-nio.readthedocs.io/en/latest/nio.html#nio.rooms.MatrixRoom.user_name is good enough instead? I don't think so as it does the same: if room members haven't been synced yet, it just fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we need the user_id, then whoami should solve that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 57-63 of api.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the user id not be stored in bot.async_client.user_id ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would. the issue is more about getting the displayname though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think doing a full sync is actually ok if we enable storage in this PR (store is needed for #79)
https://github.com/poljar/matrix-nio/blob/a4fb83fd515568e269646d2111dc68e17cc251c6/nio/client/async_client.py#L368-L380
then only the very first time would be a "big" sync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is acceptable.