Skip to content

Commit 54420cd

Browse files
committed
Add simple moderation honeypot channel feature to the 'pgc' extension
1 parent 3df413d commit 54420cd

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

pcbot/exts/pgc_activity.py renamed to pcbot/exts/pgc.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,16 @@
9191
}
9292

9393

94-
class PGCActivityCog(BaseExtensionCog, name="pgc-activity"):
95-
def __init__(self, bot: BotT, theme_color: int | discord.Color = 0) -> None:
94+
class PGCCog(BaseExtensionCog, name="pgc"):
95+
def __init__(
96+
self,
97+
bot: BotT,
98+
theme_color: int | discord.Color = 0,
99+
honeypot_channel_id: int | None = None,
100+
) -> None:
96101
super().__init__(bot, theme_color)
102+
self.honeypot_channel_id = honeypot_channel_id
103+
self.honeypot_victims = set()
97104

98105
@commands.Cog.listener()
99106
async def on_ready(self):
@@ -136,6 +143,17 @@ async def on_message(self, message: discord.Message):
136143
):
137144
return
138145

146+
if message.channel.id == self.honeypot_channel_id:
147+
await message.guild.ban(
148+
message.author, reason="Fell into snake pit", delete_message_days=1
149+
)
150+
151+
if message.author.id not in self.honeypot_victims:
152+
self.honeypot_victims.add(message.author.id)
153+
await message.guild.unban(message.author, reason="Second chance")
154+
else:
155+
self.honeypot_victims.remove(message.author.id)
156+
139157
if message.type == discord.MessageType.premium_guild_tier_1:
140158
await message.channel.send(
141159
"LETS GO 🎉 ! Thanks for boosting us to **LEVEL 1** "
@@ -191,5 +209,5 @@ async def on_member_join(self, member: discord.Member):
191209

192210

193211
@snakecore.commands.decorators.with_config_kwargs
194-
async def setup(bot: BotT):
195-
await bot.add_cog(PGCActivityCog(bot))
212+
async def setup(bot: BotT, honeypot_channel_id: int | None = None) -> None:
213+
await bot.add_cog(PGCCog(bot, honeypot_channel_id=honeypot_channel_id))

0 commit comments

Comments
 (0)