Skip to content

Commit

Permalink
v0.1.9-b
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamziee committed Apr 2, 2024
1 parent 62a74f1 commit 1c93cba
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 37 deletions.
34 changes: 0 additions & 34 deletions commands/[not done]admin.disabled

This file was deleted.

2 changes: 1 addition & 1 deletion ex_config (change me to config.py).py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIA_VERSION='v0.1.7-b' # Do not change this, it will help with troubleshooting later
MIA_VERSION='v0.1.9-b' # Do not change this, it will help with troubleshooting later

PREFIX = '$' # deprecated, only used for admin and music commands.
OWNER_ID = 496673945211240462 # used for admin commands and ChatAI recognition.
Expand Down
58 changes: 58 additions & 0 deletions mia.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from colorama import Back, Fore, Style
import time
import platform
from cogwatch import watch
try:
import config
except:
Expand Down Expand Up @@ -30,6 +31,7 @@ async def setup_hook(self):
for ext in self.cogslist:
await self.load_extension(ext)

@watch(path=config.COMMANDS_DIRECTORY, preload=True)
async def on_ready(self):
prfx = (Back.BLACK + Fore.GREEN + time.strftime("%H:%M:%S UTC", time.gmtime()) + Back.RESET + Fore.WHITE + Style.BRIGHT)
print(prfx + " Logged in as " + Fore.YELLOW + self.user.name)
Expand All @@ -41,6 +43,62 @@ async def on_ready(self):
await self.change_presence(activity=discord.Game(name=config.STATUS))
print(prfx + " Discord " + Fore.YELLOW + "Presence(s) loaded.")

# Load, Reload and Unload commands
# Load command
@commands.command()
async def load(self, ctx, cog: str):
if ctx.message.author.id == config.OWNER_ID:
try:
await self.load_extension(f"{config.COMMANDS_DIRECTORY}.{cog}")
await ctx.reply(f"Loaded {cog}.py cog.")
except Exception as e:
print(e)
await ctx.reply("Error.")
else:
await ctx.reply("Insufficient permissions! Only the developer(s) can load commands.")

# Reload command
@commands.command()
async def reload(self, ctx, cog: str):
if ctx.message.author.id == config.OWNER_ID:
try:
await self.reload_extension(f"{config.COMMANDS_DIRECTORY}.{cog}")
await ctx.reply(f"Reloaded {cog}.py cog.")
except Exception as e:
print(e)
await ctx.reply("Error.")
else:
await ctx.reply("Insufficient permissions! Only the developer(s) can reload commands.")

# Reload all command
@commands.command()
async def reloadall(self, ctx):
if ctx.message.author.id == config.OWNER_ID:
try:
for ext in self.cogslist:
await self.load_extension(ext)
await ctx.reply("Reloaded all commands.")
except Exception as e:
print(e)
await ctx.reply("Error.")
else:
await ctx.reply("Insufficient permissions! Only the developer(s) can reload commands.")

# Unload command
@commands.command()
async def unload(self, ctx, cog: str):
if ctx.message.author.id == config.OWNER_ID:
try:
await self.unload_extension(f"{config.COMMANDS_DIRECTORY}.{cog}")
await ctx.reply(f"Unloaded {cog}.py cog.")
except Exception as e:
print(e)
await ctx.reply("Error.")
else:
await ctx.reply("Insufficient permissions! Only the developer(s) can unload commands.")

#### #### #### #### ####

client = Client()

client.run(config.TOKEN)
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ discord.py==2.3.2
colorama==0.4.6
PyNaCl==1.5.0
async-timeout==4.0.3
yt_dlp==2023.12.30
yt_dlp==2024.3.10
cogwatch==3.3.1
1 change: 0 additions & 1 deletion todo.txt

This file was deleted.

0 comments on commit 1c93cba

Please sign in to comment.