Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions cogs/counting.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ async def _reaction_worker(self) -> None:
try:
try:
await message.add_reaction(emoji)
except Exception:
except Exception as e:
#retry
print(f"Failed to add da reaction {emoji} with da error : {e}")
pass
try:
await asyncio.sleep(0.35)
Expand Down Expand Up @@ -266,7 +268,7 @@ async def _remove_bot_reactions(
await msg.remove_reaction("🏆", self.bot.user)
except Exception:
pass

async def _mark_highscore_message(
self,
message: discord.Message,
Expand All @@ -280,19 +282,23 @@ async def _mark_highscore_message(
if not message.guild or not isinstance(message.channel, discord.TextChannel):
return

guild_id = message.guild.id

guild_id = message.guild.id

# Only add the trophy here.
# The ✅ reaction is added for all valid counts in the main handler;
# adding it again here causes extra API calls and rate limits.

self._enqueue_reaction(message, "🏆")


# Track the latest highscore/tie message ID for bookkeeping.
# (We no longer remove reactions from older messages.)
await self._set_active_highscore_message_id(guild_id, message.id)

# Record history only if it is a NEW record
if new_count > previous_high_score:
#Fix here: adding condition to capture ties too
if new_count >= previous_high_score:
async with aiosqlite.connect(DB_PATH, timeout=30.0) as db:
await db.execute(
"""
Expand Down Expand Up @@ -624,6 +630,10 @@ async def on_message(self, message):
# Side effects after commit to avoid duplicate reactions on retries.
self._enqueue_reaction(message, "✅")

if(next_count % 100 == 0):
self._enqueue_reaction(message, "💯")
await message.channel.send(f"Server Milestone reached! Reached: **{next_count}** ", delete_after = 10);

# Count down active automatic-save cooldowns on each valid count (best-effort).
try:
await self._decrement_save_cooldowns(message.guild.id)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh damm spotting a fully Human written PR nowadays is rare, good @MGoradeCodes Approved!

Expand Down
Loading