aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/showprojects.py
diff options
context:
space:
mode:
authorGravatar Eivind Teig <[email protected]>2020-04-02 14:39:24 +0200
committerGravatar GitHub <[email protected]>2020-04-02 14:39:24 +0200
commitd77a2bbc50305d05371197f4cfe3354cfca4c627 (patch)
treebe1eed54972d9843f66114311f93b68b579046ac /bot/exts/evergreen/showprojects.py
parentMerge pull request #382 from ks129/game-fuzzy (diff)
parentMerge master: adjust `Space` cog location (diff)
Merge pull request #329 from python-discord/seasonal-purge
Deseasonify: Make all cogs available year-round, and manage only branding by season.
Diffstat (limited to 'bot/exts/evergreen/showprojects.py')
-rw-r--r--bot/exts/evergreen/showprojects.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/bot/exts/evergreen/showprojects.py b/bot/exts/evergreen/showprojects.py
new file mode 100644
index 00000000..328a7aa5
--- /dev/null
+++ b/bot/exts/evergreen/showprojects.py
@@ -0,0 +1,33 @@
+import logging
+
+from discord import Message
+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: commands.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: Message) -> None:
+ """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: commands.Bot) -> None:
+ """Show Projects Reaction Cog."""
+ bot.add_cog(ShowProjects(bot))