Skip to content

Commit

Permalink
Merge pull request #8 from jagg3127/master
Browse files Browse the repository at this point in the history
cog update
  • Loading branch information
LilbabxJJ-1 authored Jun 2, 2023
2 parents 7906aa3 + 3cd95de commit 9b5d5be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Aoipy/Classes/AoiPyClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
from Aoipy.tools import FunctionHandler
from .CommandHandler import load_commands
import asyncio

global TotalFuncs
global bots
global all_commands


class Aoipy(discord.Client):
# Global variables
global bots
global all_commands

def __init__(self, prefix, case_insensitive, intents: tuple, activity, help_command, load_command_dir):
# Global variables
global bots
global all_commands

# Initialize Start class
self.prefix = prefix
Expand Down Expand Up @@ -66,6 +70,7 @@ def AoipyClient(prefix: str, case_insensitive: bool = False, intents: tuple = ("
# Global variables
global bots
global TotalFuncs
global all_commands

# Initialize FunctionHandler and register functions
Functions = FunctionHandler()
Expand Down
11 changes: 8 additions & 3 deletions Aoipy/Classes/Cogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class Aoicogs:
def Cogs(self, Cog_Group, Name, Code):
from Aoipy.Classes.AoiPyClient import bots
from Aoipy.Classes.AoiPyClient import bots, all_commands

class main_bod:
def __init__(self, bot):
Expand All @@ -20,5 +20,10 @@ async def go(self, ctx, *args, Code=Code):

await findBracketPairs(finalCode, TotalFuncs, Context)

COGS = type(Cog_Group, (commands.Cog,), {'__init__': main_bod.__init__, 'go': main_bod.go})
asyncio.run(bots.add_cog(COGS(bots)))
if Cog_Group in all_commands:
bots.remove_cog(Cog_Group)
all_commands[Cog_Group][f"go{len(all_commands[Cog_Group])}"]=main_bod.go
else:
all_commands[Cog_Group] = {'__init__': main_bod.__init__, 'go': main_bod.go}
COGS = type(Cog_Group, (commands.Cog,), all_commands[Cog_Group])
bots.add_cog(COGS(bots))

0 comments on commit 9b5d5be

Please sign in to comment.