From 16a3ff9c6f4a5a7a55b8486131bf430d4c7a34ed Mon Sep 17 00:00:00 2001 From: Wilbur Jaywright Date: Sat, 4 May 2024 12:26:30 -0400 Subject: [PATCH] Initial beta release - Fixed ExclusiveChatCommand having no target - Updated message getting for Cocorum v1.0.0-beta - Added use of Cocorum reporting deleted messages --- pyproject.toml | 6 +++--- src/rumchat_actor/__init__.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5b33e00..fb1b971 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "rumchat_actor" -version = "0.1.0" +version = "1.0.0" keywords = ["rumble", "chat", "livestream", "bot"] authors = [ { name="Wilbur Jaywright", email="zargulthewizard@outlook.com" }, @@ -13,14 +13,14 @@ description = "Automatically interact with your Rumble livestream chats." readme = "README.md" requires-python = ">=3.8" dependencies = [ - "cocorum", + "cocorum>=1.0.0", "selenium", ] classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: GNU Affero General Public License v3", "Operating System :: OS Independent", - "Development Status :: 3 - Alpha", + "Development Status :: 4 - Beta", ] [project.urls] diff --git a/src/rumchat_actor/__init__.py b/src/rumchat_actor/__init__.py index 1842003..ea451de 100644 --- a/src/rumchat_actor/__init__.py +++ b/src/rumchat_actor/__init__.py @@ -93,7 +93,7 @@ def __init__(self, name, actor, cooldown = BROWSER_ACTION_DELAY, amount_cents = allowed_badges: Badges which must be borne to use the command at all whitelist_badges: Badges which if borne give the user free-of-charge command access target: The function(message, actor) to call on successful command usage. Defaults to self.run""" - super().__init__(name, actor, cooldown = BROWSER_ACTION_DELAY, amount_cents = 0, whitelist_badges = ["moderator"], target = None) + super().__init__(name, actor, cooldown = BROWSER_ACTION_DELAY, amount_cents = 0, whitelist_badges = ["moderator"], target = target) #Admin can always call any command self.allowed_badges = ["admin"] + allowed_badges @@ -197,7 +197,7 @@ def __init__(self, stream_id = None, init_message = "Hello, Rumble world!", prof self.send_message(init_message) #Wait until we get that message - while (m := self.ssechat.next_chat_message()).user.username != self.username: + while (m := self.ssechat.get_message()).user.username != self.username: pass assert "moderator" in m.user.badges or "admin" in m.user.badges, "Actor cannot function without being a moderator" @@ -357,7 +357,7 @@ def __process_message(self, message): return for action in self.message_actions: - if not action(message, self): #The message got deleted by an action + if message.message_id in self.ssechat.deleted_message_ids or not action(message, self): #The message got deleted, possibly by this action return self.__run_if_command(message) @@ -365,7 +365,7 @@ def __process_message(self, message): def mainloop(self): """Run the actor forever""" while self.keep_running: - m = self.ssechat.next_chat_message() + m = self.ssechat.get_message() if not m: #Chat has closed self.keep_running = False return