From 20150278b3072a90bb1dcc5928ee5501f53a4fc4 Mon Sep 17 00:00:00 2001 From: fred777 Date: Wed, 27 May 2026 10:33:26 +0200 Subject: [PATCH] DEFAULT_BOT_CODE: add usage example for bot_globals --- .../src/components/settings/SettingsFanoutSection.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/src/components/settings/SettingsFanoutSection.tsx b/frontend/src/components/settings/SettingsFanoutSection.tsx index 9d96532..2dc3323 100644 --- a/frontend/src/components/settings/SettingsFanoutSection.tsx +++ b/frontend/src/components/settings/SettingsFanoutSection.tsx @@ -103,6 +103,15 @@ const DEFAULT_BOT_CODE = `def bot(**kwargs) -> str | list[str] | None: # Don't reply to our own outgoing messages if is_outgoing: return None + + # If you want to make use of persistant data between calls to this function, + # you can put that data into the global _bot_globals dictionary, e.g.: + # + # bot_globals = globals()["_bot_globals"] + # if not "known_sender_names" in bot_globals: + # bot_globals["known_sender_names"] = set() + # + # bot_globals["known_sender_names"].add(sender_name) # Example: Only respond in #bot channel to "!pling" command if channel_name == "#bot" and "!pling" in message_text.lower():