diff --git a/alternatingcaps.py b/alternatingcaps.py index 9f9eae6..fce4b86 100644 --- a/alternatingcaps.py +++ b/alternatingcaps.py @@ -4,13 +4,13 @@ class AlternatingCaps(Plugin): - last_message = None + last_messages = {} @event.on(EventType.ROOM_MESSAGE) async def message_handler(self, evt: MessageEvent) -> None: - self.last_message = evt.content.body + self.last_messages[evt.room_id] = evt.content.body @command.new() async def altcaps(self, evt: MessageEvent) -> None: - if self.last_message: - await evt.respond("".join([c.upper() if i % 2 else c.lower() for i, c in enumerate(self.last_message)])) + if evt.room_id in self.last_messages: + await evt.respond("".join([c.upper() if i % 2 else c.lower() for i, c in enumerate(self.last_messages[evt.room_id])])) diff --git a/maubot.yaml b/maubot.yaml index 892434a..965d64e 100644 --- a/maubot.yaml +++ b/maubot.yaml @@ -2,7 +2,7 @@ id: pl.rom4nik.maubot.alternatingcaps # A PEP 440 compliant version string. -version: 0.1.0 +version: 0.1.1 # The SPDX license identifier for the plugin. https://spdx.org/licenses/ # Optional, assumes all rights reserved if omitted.