aboutsummaryrefslogtreecommitdiffstats
path: root/salvador/commands.py
diff options
context:
space:
mode:
authorAhmed <git@gumx.cc>2026-06-14 01:46:29 +0300
committerAhmed <git@gumx.cc>2026-06-14 01:46:29 +0300
commit5a8d568931d9b23ce0df1265d05259a7012081c9 (patch)
tree4ea19b8bb1763a38246f342f172c285f6579e09b /salvador/commands.py
init: mostly vibed
Diffstat (limited to 'salvador/commands.py')
-rw-r--r--salvador/commands.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/salvador/commands.py b/salvador/commands.py
new file mode 100644
index 0000000..833a953
--- /dev/null
+++ b/salvador/commands.py
@@ -0,0 +1,64 @@
+"""
+Sopel plugin: salvador admin commands
+
+Owner-only commands for managing the bot at runtime.
+
+ !join #channel - join a channel
+ !part [#channel] - leave a channel (defaults to current)
+ !chans - list channels the bot is in
+ !help - show usage
+"""
+
+from sopel import plugin
+
+
+def _is_owner(bot, trigger):
+ return trigger.nick == bot.settings.core.owner
+
+
+@plugin.command("join")
+def cmd_join(bot, trigger):
+ if not _is_owner(bot, trigger):
+ return
+ channel = (trigger.group(2) or "").strip()
+ if not channel.startswith("#"):
+ bot.say("usage: !join #channel")
+ return
+ bot.join(channel)
+
+
+@plugin.command("part")
+def cmd_part(bot, trigger):
+ if not _is_owner(bot, trigger):
+ return
+ channel = (trigger.group(2) or "").strip()
+ if not channel:
+ channel = trigger.sender
+ bot.part(channel)
+
+
+@plugin.command("chans")
+def cmd_chans(bot, trigger):
+ if not _is_owner(bot, trigger):
+ return
+ chans = sorted(str(c) for c in bot.channels)
+ if chans:
+ bot.say("in: " + " ".join(chans))
+ else:
+ bot.say("not in any channels")
+
+
+@plugin.command("help")
+def cmd_help(bot, trigger):
+ lines = [
+ "!draw [<lines>] <url> - render image as mIRC colour art (lines: 4-12, default 6)",
+ ]
+ if _is_owner(bot, trigger):
+ lines += [
+ "!join #channel - join a channel (owner)",
+ "!part [#channel] - leave a channel (owner)",
+ "!chans - list channels the bot is in (owner)",
+ ]
+ lines.append("!help - this message")
+ for line in lines:
+ bot.say(line, trigger.nick)