Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if a message gets more than 5 of any reaction, not just stars, it will now be added to the starboard #191

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions bot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ class Config:
starboard_channel: int = int(
getenv("DISCOX_STARBOARD_CHANNEL", "0")
) # starboard channel
welcome_channel: int = int(
getenv("SERVER_WELCOME_CHANNEL", "1056171331059732541")
) # welcome channel
minecraft_url: str = getenv("MINECRAFT_URL", "minecraft.virbos.xyz")
minecraft_port: int = getenv("MINECRAFT_PORT", 25565)

Expand Down
8 changes: 5 additions & 3 deletions bot/events/on_raw_reaction_add.py
Copy link
Contributor

Choose a reason for hiding this comment

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

the entire purpose of starboard is keeping track of star reactions on message and NOT any reactions

Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ async def starboard(self, payload: discord.RawReactionActionEvent) -> None:
IMAGE_REGEX = "http(s)?:([\/|.|\w|\s]|-)*\.(?:jpg|gif|png|jpeg)(\?(.[^\s]*))?"
REACTION = "⭐"
starboard = await self.bot.fetch_channel(Config.starboard_channel)
if payload.emoji.name != REACTION:
# if payload.emoji.name != REACTION:
# return
if payload.channel_id == Config.welcome_channel:
return
channelObj = await self.bot.fetch_channel(payload.channel_id)
messageObj = await channelObj.fetch_message(payload.message_id)
if messageObj.author.id == self.bot.user.id:
return
for reaction in messageObj.reactions:
if reaction.emoji != REACTION:
continue
# if reaction.emoji != REACTION:
# continue
if reaction.count >= 5:
already = await self.db.raw_exec_select(
"SELECT message_id FROM starboard WHERE message_id = ?",
Expand Down