added funcs

This commit is contained in:
Faiz Ahmed
2021-07-25 14:22:05 -04:00
parent 7c57851f7d
commit ceb8bc32a3
9 changed files with 348 additions and 209 deletions

23
run.py
View File

@@ -4,7 +4,7 @@ from discord.ext import commands, tasks
from discord.utils import get
import asyncio
import sys
from app.header.configparser import switch, Discord_bot_token
from app.bot.helper.confighelper import switch, Discord_bot_token
if switch == 0:
print("Missing Config.")
@@ -15,7 +15,6 @@ intents.members = True
bot = commands.Bot(command_prefix=".", intents = intents)
bot.remove_command('help')
@bot.event
async def on_ready():
print("bot is online.")
@@ -24,22 +23,22 @@ async def on_ready():
@bot.command()
@commands.has_permissions(administrator=True)
async def load(ctx, name):
bot.load_extension(f'Cogs.{name}')
bot.load_extension(f'app.bot.cogs.{name}')
print(f"The {name} cog has been loaded successfully.")
@bot.command()
@commands.has_permissions(administrator=True)
async def unload(ctx, name):
bot.unload_extension(f'Cogs.{name}')
bot.unload_extension(f'app.bot.cogs.{name}')
print(f"The {name} cog has been unloaded successfully.")
@bot.command()
@commands.has_permissions(administrator=True)
async def reload(ctx, name):
bot.unload_extension(f'Cogs.{name}')
bot.load_extension(f'Cogs.{name}')
bot.unload_extension(f'app.bot.cogs.{name}')
bot.load_extension(f'app.bot.cogs.{name}')
print(f"The {name} cog has been reloaded successfully.")
@@ -54,17 +53,17 @@ async def on_message(message):
@bot.command()
@commands.has_permissions(administrator=True)
async def all(ctx):
for filename in os.listdir("Cogs"):
for filename in os.listdir("app/bot/cogs/"):
if filename.endswith('.py'):
bot.unload_extension(f'Cogs.{filename[:-3]}')
for filename in os.listdir("Cogs"):
bot.unload_extension(f'app.bot.cogs.{filename[:-3]}')
for filename in os.listdir("app/bot/cogs/"):
if filename.endswith('.py'):
bot.load_extension(f'Cogs.{filename[:-3]}')
bot.load_extension(f'app.bot.cogs.{filename[:-3]}')
print("All cogs has been reloaded.")
for filename in os.listdir("Cogs"):
for filename in os.listdir("app/bot/cogs/"):
if filename.endswith('.py'):
bot.load_extension(f'Cogs.{filename[:-3]}')
bot.load_extension(f'app.bot.cogs.{filename[:-3]}')
bot.run(Discord_bot_token)