Compare commits

..

No commits in common. "7a0022cb595b2b13d1c04ceab0442c37a308e51a" and "c1a80f5497c2b865a78c7a1fe4e323cb6eb9e343" have entirely different histories.

7 changed files with 5 additions and 44 deletions

View File

@ -1,8 +0,0 @@
.git
__pycache__/
*.pyc
.env
settings.conf
data.json
data.json.bak
example/

View File

@ -30,10 +30,6 @@ class DataManager:
'user_cards': [],
'pirates_list_posts': [],
'spicepay_prefs': [],
'nick_verified': [],
'nick_claim_pending': [],
'nick_reviews': [],
'rr_msg_channels': [],
}
self._save(default)
return default

View File

@ -15,7 +15,7 @@ services:
# Persist your JSON data here
- shaiwatcher-data:/app/data
# Bind your server-side settings.conf into the container
- /opt/shaiwatcher/settings.conf:/app/settings.conf:ro
- /opt/shaiwatcher/settings.conf:/app/settings.conf
volumes:
shaiwatcher-data:

View File

@ -1,24 +0,0 @@
# Accept/approve emoji set used across the bot.
# Works for both unicode and custom server emoji.
# Unicode emoji that should count as "accept"
ACCEPT_UNICODE = {"", "🫡", "❤️"}
# Custom emoji short names that should count as "accept"
# Add names (not the <:name:id> literal) for any server emoji you want.
ACCEPT_CUSTOM_NAMES = {"diverOK"}
def is_accept(emoji) -> bool:
"""
Return True if the given emoji should count as an 'accept' reaction.
Compatible with Reaction.emoji and RawReactionActionEvent.emoji.
"""
try:
# unicode path
if str(emoji) in ACCEPT_UNICODE:
return True
# custom emoji path (has a .name)
name = getattr(emoji, "name", None)
return name in ACCEPT_CUSTOM_NAMES
except Exception:
return False

View File

@ -6,7 +6,6 @@ from discord.ext import commands
from discord import app_commands
from mod_perms import is_moderator_userid
from modules.common.emoji_accept import is_accept
CHECK = '' # approved/verified
CROSS = '' # reject / no
@ -173,7 +172,7 @@ class NickNudgeCog(commands.Cog):
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
# 1) Handle DM nudge confirmations (user reacts ✅ in DM)
if payload.guild_id is None and is_accept(payload.emoji) and payload.user_id != self.bot.user.id:
if payload.guild_id is None and str(payload.emoji) in ACCEPT and payload.user_id != self.bot.user.id:
entry = next((m for m in self.bot.data_manager.get('nick_dm_map') if m['message_id'] == payload.message_id), None)
if not entry:
return

View File

@ -1,6 +1,5 @@
import discord
from discord.ext import commands
from modules.common.emoji_accept import is_accept
CHECKMARK = ''
ACCEPT = {CHECKMARK, '🫡'}
@ -111,7 +110,7 @@ class ReactionRoleCog(commands.Cog):
# ---- listeners ----
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
if not payload.guild_id or not is_accept(payload.emoji):
if str(payload.emoji) not in ACCEPT or not payload.guild_id:
return
guild = self.bot.get_guild(payload.guild_id)
member = await self._get_member(guild, payload.user_id)
@ -158,7 +157,7 @@ class ReactionRoleCog(commands.Cog):
@commands.Cog.listener()
async def on_raw_reaction_remove(self, payload: discord.RawReactionActionEvent):
if not payload.guild_id or not is_accept(payload.emoji):
if str(payload.emoji) not in ACCEPT or not payload.guild_id:
return
guild = self.bot.get_guild(payload.guild_id)
member = await self._get_member(guild, payload.user_id)

View File

@ -3,7 +3,6 @@ import time
from typing import Optional, Set, Tuple
import discord
from discord.ext import commands
from modules.common.emoji_accept import is_accept
CHECK = '' # verified
CROSS = '' # not done
@ -271,7 +270,7 @@ class UserCardsCog(commands.Cog):
if not message:
return ids
for rxn in message.reactions:
if is_accept(rxn.emoji):
if str(rxn.emoji) in ACCEPT: # <-- was == CHECK
async for u in rxn.users(limit=None):
if not u.bot:
ids.add(u.id)