From 7f53ebb621385b613eea88a18b14cdbc81446e55 Mon Sep 17 00:00:00 2001 From: Skordy Date: Thu, 9 Jul 2026 17:59:06 -0700 Subject: [PATCH] Added azmsh_welcome to repo --- README.md | 2 ++ azmsh_welcome/__init__.py | 4 ++++ azmsh_welcome/azmsh_welcome.py | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 azmsh_welcome/__init__.py create mode 100644 azmsh_welcome/azmsh_welcome.py diff --git a/README.md b/README.md index 0b55437..5381de1 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Once the bot is installed, run the following command in Discord: |----------|-------------|--------------| | **mqttbridge** | Bridge between MQTT and Discord for Meshtastic devices | • Real-time MQTT integration
• Node discovery & management
• Message bridging to Discord
• Telemetry & position tracking
• Traceroute visualization
• Node ownership system
• Administrative controls | | **strikes** | Comprehensive strike, warning, and note tracking system for server moderation | • Three case types: strikes, warnings, and mod notes
• Per-member Discord threads for case discussion
• Auto-updating anchor embed with case totals
• Configurable auto-actions (kick / ban) at strike thresholds
• DM notifications to actioned members
• Full case history with pagination
• Add, view, and remove individual cases | +| **azmsh_welcome** | Automated Welcome messages. | Simply welcomes new members in the welcome channel. | ## Installation per Cog @@ -23,4 +24,5 @@ For example: ``` [p]cog install Meshtastic-Cogs mqttbridge [p]cog install Meshtastic-Cogs strikes +[p]cog install Meshtastic-Cogs azmsh_welcome ``` \ No newline at end of file diff --git a/azmsh_welcome/__init__.py b/azmsh_welcome/__init__.py new file mode 100644 index 0000000..ce70a77 --- /dev/null +++ b/azmsh_welcome/__init__.py @@ -0,0 +1,4 @@ +from .azmsh_welcome import Welcome + +async def setup(bot): + await bot.add_cog(Welcome(bot)) \ No newline at end of file diff --git a/azmsh_welcome/azmsh_welcome.py b/azmsh_welcome/azmsh_welcome.py new file mode 100644 index 0000000..1c6ccd0 --- /dev/null +++ b/azmsh_welcome/azmsh_welcome.py @@ -0,0 +1,33 @@ +from redbot.core import commands, Config +import discord + +class Welcome(commands.Cog): + """Welcome members after onboarding, with duplicate protection.""" + + def __init__(self, bot): + self.bot = bot + # In-memory cache to track welcomed users this session + self._welcomed_users = set() + # Hardcoded welcome channel ID + self.welcome_channel_id = 1270468564633255936 + + @commands.Cog.listener() + async def on_member_update(self, before: discord.Member, after: discord.Member): + # Check if the member just finished onboarding + if before.pending and not after.pending: + if after.id in self._welcomed_users: + return # Already welcomed + + guild = after.guild + channel = guild.get_channel(self.welcome_channel_id) + if channel is None: + return + + # Mark the user as welcomed + self._welcomed_users.add(after.id) + + await channel.send( + f"🎉 Welcome to **{guild.name}**, {after.mention}!\n" + "We're excited to have you here! Please check out <#1274440386827255849> and <#1380219375620980828>.\n\n" + "Got some nodes already on the mesh? Link them to your Discord! <#1393444182047064084>" + ) \ No newline at end of file