Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
mojon't
Browse files Browse the repository at this point in the history
  • Loading branch information
gingershaped committed Nov 27, 2023
1 parent 65d4eed commit 24e8855
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion vyxalbot2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def run(self):
userDB = UserDB(AsyncIOMotorClient(self.privateConfig["mongoUrl"]), self.privateConfig["database"])

ghApp = GitHubApplication(self.publicConfig, self.privkey, self.privateConfig["appID"], self.privateConfig["account"], self.privateConfig["webhookSecret"])
reactions = Reactions(self.messages)
reactions = Reactions(self.messages, self.privateConfig["chat"]["ignore"])

common = CommonData(
self.statuses,
Expand Down
5 changes: 4 additions & 1 deletion vyxalbot2/reactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
)

class Reactions:
def __init__(self, messages: MessagesType):
def __init__(self, messages: MessagesType, ignore: list[int]):
self.messages = messages
self.ignore = ignore

async def runCommand(self, service: Service, name: str, event: EventInfo, *args):
async for line in service.invokeCommand(name, event, *args):
Expand All @@ -51,6 +52,8 @@ async def onMessage(self, service: Service, event: EventInfo):
if reMatch is not None:
if event.userIdent == event.service.clientIdent and function not in OK_TO_SELF_REPLY:
continue
if event.userIdent in self.ignore:
continue
async for line in getattr(self, function)(service, event, reMatch):
yield line

Expand Down
2 changes: 2 additions & 0 deletions vyxalbot2/services/se/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ async def onMessage(self, room: Room, message: MessageEvent):
)
if message.user_id == self.room.userID:
return
if message.user_id in self.common.privateConfig["chat"]["ignore"]:
return
reactions = [i async for i in self.reactions.onMessage(self, event)]
if len(reactions):
await self.commandRequestSignal.send_async(self, event=event)
Expand Down
1 change: 1 addition & 0 deletions vyxalbot2/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ChatConfigType(TypedDict):
room: int
email: str
password: str
ignore: list[int]

class DiscordConfigType(TypedDict):
token: str
Expand Down

0 comments on commit 24e8855

Please sign in to comment.