Skip to content

Commit 9ae0358

Browse files
Merge pull request #117 from LewisProjects/development
fix duplicate starboard messages
2 parents 059c492 + 5b1660e commit 9ae0358

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

cogs/Starboard.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,23 @@ async def on_raw_reaction_add(self, payload):
2222
):
2323
return
2424
message = await channel.fetch_message(payload.message_id)
25-
starboard_channel = message.guild.get_channel(
26-
self.starboard_channel_id
27-
)
28-
if (
29-
payload.emoji.name == self.star_emoji
30-
and not channel == starboard_channel
31-
):
25+
starboard_channel = message.guild.get_channel(self.starboard_channel_id)
26+
if payload.emoji.name == self.star_emoji and not channel == starboard_channel:
3227
for reaction in message.reactions:
3328
if (
3429
reaction.emoji == self.star_emoji
3530
and reaction.count == self.num_of_stars
3631
):
32+
channel_history = await starboard_channel.history(
33+
limit=100
34+
).flatten()
35+
for msg in channel_history:
36+
if msg.embeds:
37+
if (
38+
msg.embeds[0].description.split("\n\n")[0]
39+
== message.content
40+
):
41+
return
3742
embed = disnake.Embed(
3843
description=f"{message.content}\n\n**[Jump to message]({message.jump_url})**",
3944
color=disnake.Color.gold(),

cogs/Stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async def cmdstats(self, inter):
7676
key_iterator = iter(sortdict.keys())
7777
emby = disnake.Embed(
7878
title=f"{self.bot.user.display_name} command Stats",
79-
description=f"{total_commands_ran} Commands ran in total.\n",
79+
description=f"{total_commands_ran} Commands ran in total.\nUpdated hourly.",
8080
color=self.bot.config.colors.white,
8181
)
8282
if len(cmdsran) < 2:

0 commit comments

Comments
 (0)