From aee189ac3f4d750aa457c90c8d31be318c049f70 Mon Sep 17 00:00:00 2001 From: dnns01 <mail@dnns01.de> Date: Tue, 10 Nov 2020 23:14:11 +0100 Subject: [PATCH] Adde functionality to send in suggestions for a story for the advent calendar --- christmas_cog.py | 22 ++++++++++++++++++++++ fernuni_bot.py | 3 +++ 2 files changed, 25 insertions(+) create mode 100644 christmas_cog.py diff --git a/christmas_cog.py b/christmas_cog.py new file mode 100644 index 0000000..88c6927 --- /dev/null +++ b/christmas_cog.py @@ -0,0 +1,22 @@ +import os + +from discord.ext import commands + +import utils + + +class ChristmasCog(commands.Cog): + def __init__(self, bot): + self.bot = bot + self.channel_id = int(os.getenv("DISCORD_ADVENT_CALENDAR_CHANNEL")) + + @commands.command("story") + @commands.check(utils.is_mod) + async def cmd_update_welcome(self, ctx, *args): + channel = await self.bot.fetch_channel(self.channel_id) + message = f"Einreichung von <@!{ctx.author.id}>:\n" + + for arg in args: + message += f"{arg} " + + await channel.send(message) diff --git a/fernuni_bot.py b/fernuni_bot.py index 1a7c93b..743d4a4 100644 --- a/fernuni_bot.py +++ b/fernuni_bot.py @@ -8,6 +8,7 @@ from dotenv import load_dotenv # from welcome_cog import WelcomeCog import utils from appointments_cog import AppointmentsCog +from christmas_cog import ChristmasCog from poll_cog import PollCog from roles_cog import RolesCog from text_commands_cog import TextCommandsCog @@ -34,12 +35,14 @@ text_commands_cog = TextCommandsCog(bot) tops_cog = TopsCog(bot) roles_cog = RolesCog(bot) welcome_cog = WelcomeCog(bot) +christmas_cog = ChristmasCog(bot) bot.add_cog(appointments_cog) bot.add_cog(text_commands_cog) bot.add_cog(poll_cog) bot.add_cog(tops_cog) bot.add_cog(roles_cog) bot.add_cog(welcome_cog) +bot.add_cog(christmas_cog) # bot.add_cog(welcome_cog) -- GitLab