From 8d8761a79d5a13bd06a4e739fcb10473800effad Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Mon, 13 Jul 2026 14:00:56 -0700 Subject: [PATCH] feat(bot): add manual-share cog forwarding channel messages to #inbox --- bot/chorus_bot/cogs/__init__.py | 0 bot/chorus_bot/cogs/manual_share.py | 42 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 bot/chorus_bot/cogs/__init__.py create mode 100644 bot/chorus_bot/cogs/manual_share.py diff --git a/bot/chorus_bot/cogs/__init__.py b/bot/chorus_bot/cogs/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bot/chorus_bot/cogs/manual_share.py b/bot/chorus_bot/cogs/manual_share.py new file mode 100644 index 0000000..6323f82 --- /dev/null +++ b/bot/chorus_bot/cogs/manual_share.py @@ -0,0 +1,42 @@ +import discord +from discord.ext import commands +from chorus_bot.modality_map import modality_for_channel +from chorus_bot.ping import build_ping_embed + + +class ManualShareCog(commands.Cog): + """Watches per-modality channels; forwards any new message as a ping in #inbox.""" + + def __init__(self, bot: commands.Bot, config): + self.bot = bot + self.config = config + + @commands.Cog.listener() + async def on_message(self, message: discord.Message): + if message.author.bot: + return + if message.channel.id == self.config.inbox_channel_id: + return # inbox itself is not a source channel + + modality = modality_for_channel(message.channel.name) + if modality is None: + return + + content = message.content or "(attachment only — see original message)" + snippet = content if len(content) <= 120 else content[:117] + "..." + + embed = build_ping_embed( + modality=modality, + sender_id=None, + snippet=snippet, + raw_content=content, + captured_at=message.created_at, + ) + + inbox = self.bot.get_channel(self.config.inbox_channel_id) + role_mention = f"<@&{self.config.triage_role_id}>" + await inbox.send(content=role_mention, embed=embed) + + +async def setup(bot: commands.Bot, config): + await bot.add_cog(ManualShareCog(bot, config))