diff options
author | 2019-05-14 20:03:49 -0400 | |
---|---|---|
committer | 2019-05-14 20:03:49 -0400 | |
commit | 797c36a811cdeee742dac9eb93f929387967bf6a (patch) | |
tree | ee394d3cb477996cdfc888fd29b35440c8281b9c | |
parent | Spooky 8 Ball (#189) (diff) | |
parent | Removed test method I left in by mistake! (diff) |
Merge pull request #211 from RohanRadia/master
#110 Reactions on messages in Projects channel
-rw-r--r-- | bot/constants.py | 2 | ||||
-rw-r--r-- | bot/seasons/evergreen/showprojects.py | 35 |
2 files changed, 37 insertions, 0 deletions
diff --git a/bot/constants.py b/bot/constants.py index bf542daf..67dd9328 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -49,6 +49,8 @@ class Channels(NamedTuple): staff_lounge = 464905259261755392 verification = 352442727016693763 python_discussion = 267624335836053506 + show_your_projects = 303934982764625920 + show_your_projects_discussion = 360148304664723466 class Client(NamedTuple): diff --git a/bot/seasons/evergreen/showprojects.py b/bot/seasons/evergreen/showprojects.py new file mode 100644 index 00000000..d6223690 --- /dev/null +++ b/bot/seasons/evergreen/showprojects.py @@ -0,0 +1,35 @@ +import logging + +from discord.ext import commands + +from bot.constants import Channels + +log = logging.getLogger(__name__) + + +class ShowProjects(commands.Cog): + """Cog that reacts to posts in the #show-your-projects""" + + def __init__(self, bot): + self.bot = bot + self.lastPoster = 0 # Given 0 as the default last poster ID as no user can actually have 0 assigned to them + + @commands.Cog.listener() + async def on_message(self, message): + """Adds reactions to posts in #show-your-projects""" + + reactions = ["\U0001f44d", "\U00002764", "\U0001f440", "\U0001f389", "\U0001f680", "\U00002b50", "\U0001f6a9"] + if (message.channel.id == Channels.show_your_projects + and message.author.bot is False + and message.author.id != self.lastPoster): + for reaction in reactions: + await message.add_reaction(reaction) + + self.lastPoster = message.author.id + + +def setup(bot): + """Show Projects Reaction Cog""" + + bot.add_cog(ShowProjects(bot)) + log.info("ShowProjects cog loaded") |