aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RohanRadia <[email protected]>2019-05-13 14:53:58 +0100
committerGravatar RohanRadia <[email protected]>2019-05-13 14:53:58 +0100
commitb1fb0a451c90984c0be96894b3cd1b0f0551fecf (patch)
tree498b68c50ffb43d56b8bb037c72f874e41aa9f4d
parentMerge pull request #2 from python-discord/master (diff)
Created showprojects cog to add reactions to all messages in the show your projects channel.
-rw-r--r--bot/seasons/evergreen/showprojects.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/bot/seasons/evergreen/showprojects.py b/bot/seasons/evergreen/showprojects.py
new file mode 100644
index 00000000..018bf461
--- /dev/null
+++ b/bot/seasons/evergreen/showprojects.py
@@ -0,0 +1,34 @@
+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.id != 528937022996611082 \
+ 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")