summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Liu <joshua.liu@sourceobby.com>2025-11-09 16:39:11 -0500
committerJoshua Liu <joshua.liu@sourceobby.com>2025-11-09 16:39:11 -0500
commit657bc1e7bda53938da4c2d3c1a4fdf0a815b3404 (patch)
tree4679f88d0a9e6076b8d28ae853cdaa254b77b244
parentfecffeb0013a26867ed445d476b076667a3090f2 (diff)
feat: reworked to avoid a circular import and to move all commands into the class
-rw-r--r--bigresult.py31
-rw-r--r--main.py6
2 files changed, 25 insertions, 12 deletions
diff --git a/bigresult.py b/bigresult.py
index fbd3dd6..285ca5d 100644
--- a/bigresult.py
+++ b/bigresult.py
@@ -4,32 +4,45 @@ from discord.ext import commands
import random
import threading
import time
-from main import client
+from functools import partial, wraps
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
self.snipe_active = False
- pass
-
- @client.command(name="snipe")
+ self.COMMANDS = {
+ "snipe": self.snipe,
+ "bigresult": self.teach,
+ "mod": self.mod,
+ "1984": self.orwell,
+ "teachmethebigresult": self.teachbigresult,
+ "ivotedfor": self.voot,
+ }
+
+ def initialize_commands(self):
+ for key in self.COMMANDS:
+ self.client.command(name=key)(wraps(self.COMMANDS[key])(partial(self.COMMANDS[key], self)))
+
+ # @client.command(name="snipe")
async def snipe(self, ctx):
await ctx.reply("watch yourself")
self.snipe_active = True
pass
- @client.command(name="bigresult")
+ # @client.command(name="bigresult")
async def teach(self, ctx):
await ctx.reply(
"https://cdn.discordapp.com/attachments/427176475406630914/1302392181448900649/image.png?ex=6727f2bd&is=6726a13d&hm=6092f4fba06412feac26a16a6900bf6e6122d66506f60bfcc0bc7101ecede4db&")
- @client.command(name="mod")
+ # @client.command(name="mod")
async def mod(self, ctx):
await ctx.reply(
">>> *pees in ur ass*\nI am a bot and this action was performed automatically. Please contact the moderators of this server if you have any questions or concerns.")
- @client.command(name="1984")
+ # @client.command(name="1984")
async def orwell(self, ctx):
if (random.randint(1, 5) == 2):
await ctx.reply(f">>> {ctx.author} has been warned: \n\nBad word usage")
@@ -37,11 +50,11 @@ class BigResultPlus(commands.Bot):
await ctx.reply(
"https://media.discordapp.net/attachments/865417026519957526/866575047459209236/video0-1-1.mov?ex=672d0e27&is=672bbca7&hm=3c80837685cb800ad817855b6463e4e1875dc009c6fc4540eff749c7387c4241&")
- @client.command(name="teachmethebigresult")
+ # @client.command(name="teachmethebigresult")
async def teachbigresult(self, ctx):
await ctx.reply("take b36 with Nick Cheng. join the 'Big Result' club")
- @client.command(name="ivotedfor")
+ # @client.command(name="ivotedfor")
async def voot(self, ctx):
if (random.randint(1, 2) == 2):
await ctx.reply("Donald trump sweeep")
diff --git a/main.py b/main.py
index 4c3e312..b84f91d 100644
--- a/main.py
+++ b/main.py
@@ -8,8 +8,8 @@ from discord.ext import commands
dotenv.load_dotenv()
TOKEN = os.getenv('TOKEN')
-intents = discord.Intents.all()
+bot = BigResultPlus()
+bot.initialize_commands()
+bot.run(TOKEN)
-client = BigResultPlus(intents=intents, command_prefix="!") # This represents our connection with Discord
-client.run(TOKEN) # This actually starts our bot