Add ignored_users config option

This commit is contained in:
ckie 2022-07-19 18:49:52 +03:00
parent feb1a37e11
commit bb01ecdecf
No known key found for this signature in database
GPG key ID: 13E79449C0525215
3 changed files with 6 additions and 1 deletions

View file

@ -29,6 +29,8 @@ templates:
default_flags:
- ignorecase
ignored_users: []
antispam:
room:
max: 1

View file

@ -91,7 +91,9 @@ class ReactBot(Plugin):
@event.on(EventType.ROOM_MESSAGE)
async def event_handler(self, evt: MessageEvent) -> None:
if evt.sender == self.client.mxid or evt.content.msgtype not in self.allowed_msgtypes:
ignored_mxids = self.config["ignored_users"]
ignored_mxids.append(self.client.mxid)
if evt.sender in ignored_mxids or evt.content.msgtype not in self.allowed_msgtypes:
return
for name, rule in self.config.rules.items():
match = rule.match(evt)

View file

@ -37,6 +37,7 @@ class Config(BaseProxyConfig):
helper.copy("rules")
helper.copy("templates")
helper.copy("default_flags")
helper.copy("ignored_users")
helper.copy("antispam.user.max")
helper.copy("antispam.user.delay")
helper.copy("antispam.room.max")