From 344c72857f1af1a7199a679c38f7c851ff4e081d Mon Sep 17 00:00:00 2001 From: Lu Baumann Date: Mon, 31 Oct 2022 01:30:30 +0100 Subject: [PATCH] information message concept --- main.py | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 753f0bb..4f83809 100644 --- a/main.py +++ b/main.py @@ -5,22 +5,44 @@ from dotenv import load_dotenv BOT_NAME = "Dumb Bitch" -def start_computer(): - pass +class ComputerManager: + def __init__(self): + pass + + def start_computer(self): + print("Starting Computer") class MyClient(discord.Client): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.computer_manager = ComputerManager() + self.information_message = None + + async def send_information_message(self, channel: discord.TextChannel): + self.information_message = await channel.send( + "Placeholder message for server information\n" + "react with :arrow_forward: to start the server" + ) + await self.information_message.add_reaction("▶") + async def on_ready(self): print(f"Logged on as {self.user}.") async def on_message(self, message): - print(f"Message from {message.author}: {message.content}") if message.author == self.user: return - if message.content == "hello": - await message.channel.send(f"Hey {message.author}") - if message.content == "goodbye": - await message.channel.send(f"Goodbye {message.author}") + print(f"Message from {message.author}: {message.content}") + if message.content == "!information_message": + await self.send_information_message(message.channel) + + async def on_reaction_add(self, reaction, user): + if user == self.user: + return + print(f"User {user} reacted to message {reaction.message.id} with {reaction}") + if reaction.message == self.information_message: + if reaction.emoji == "▶": + self.computer_manager.start_computer() if __name__ == "__main__":