From 8718db0da478bf1db1edd4a5ca5e310c9f4a9a39 Mon Sep 17 00:00:00 2001 From: Joshua Liu Date: Thu, 13 Nov 2025 22:53:55 -0500 Subject: feat: got inheritance working, got the on_message working, and got the commands working again, so now all my commands are tucked neatly into a class --- bigresult.py | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'bigresult.py') diff --git a/bigresult.py b/bigresult.py index 285ca5d..8016d76 100644 --- a/bigresult.py +++ b/bigresult.py @@ -5,26 +5,29 @@ import random import threading import time from functools import partial, wraps -from commands.funny import BigCommands +# from commands.funny import BigCommands class BigResultPlus(commands.Bot): - def __init__(self): - intents = discord.Intents.all() - self.client = commands.Bot(intents=intents, command_prefix="!") # This represents our connection with Discord + def __init__(self, intents, command_prefix): + super().__init__(intents=intents, command_prefix=command_prefix) self.snipe_active = False self.COMMANDS = { - "snipe": self.snipe, - "bigresult": self.teach, - "mod": self.mod, - "1984": self.orwell, - "teachmethebigresult": self.teachbigresult, - "ivotedfor": self.voot, + "snipe": BigResultPlus.snipe, + "bigresult": BigResultPlus.teach, + "mod": BigResultPlus.mod, + "1984": BigResultPlus.orwell, + "teachmethebigresult": BigResultPlus.teachbigresult, + "ivotedfor": BigResultPlus.voot, } + # intents = discord.Intents.all() + # self.client = commands.Bot(intents=intents, command_prefix="!") # This represents our connection with Discord def initialize_commands(self): for key in self.COMMANDS: - self.client.command(name=key)(wraps(self.COMMANDS[key])(partial(self.COMMANDS[key], self))) + super().command(name=key)(wraps(self.COMMANDS[key])(partial(self.COMMANDS[key], self))) + + # @client.command(name="snipe") async def snipe(self, ctx): @@ -66,9 +69,7 @@ class BigResultPlus(commands.Bot): await self.send_msg("Hurlo") async def on_message(self, message): - self.state = 0 - roblox = discord.utils.get(self.emojis, name="roblos") - await self.process_commands(message) + # roblox = discord.utils.get(self.client.emojis, name="roblos") fuckyou = message.content.lower() channel_sent = message.channel @@ -86,7 +87,7 @@ class BigResultPlus(commands.Bot): that is run on another thread so we don't get super bad performance hits """ - if message.author == self.user: + if message.author == super().user: return if (random.randint(1, 2000) == 1984): @@ -98,11 +99,11 @@ class BigResultPlus(commands.Bot): return elif ("1984" in fuckyou and "!1984" != fuckyou): - await message.reply("kys ") + await message.reply("kys") return elif ("roblox" in fuckyou or "roblo" in fuckyou or "road blocks" in fuckyou): - await message.add_reaction(roblox) + # await message.add_reaction(roblox) await message.reply( "life is roblox\nhttps://cdn.discordapp.com/attachments/890681829915508806/1066566357694562374/DJ_Khaled.mp4?ex=6728ee13&is=67279c93&hm=7a2c5e3c85d42ee07c420424fc26970f502e941f9d1c45324b42270184a17b65&") return @@ -125,7 +126,7 @@ class BigResultPlus(commands.Bot): return elif ("sex" in fuckyou): - if self.voice_clients is None: + if super().voice_clients is None: return elif ("im gonna redeem" in fuckyou and self.state == 1): @@ -144,6 +145,9 @@ class BigResultPlus(commands.Bot): await message.reply("why do you ask?") return + await super().process_commands(message) + return + async def send_msg(self, msg): - channel = self.get_channel(427176475406630914) + channel = super().get_channel(427176475406630914) await channel.send(msg) -- cgit v1.2.3