-
Notifications
You must be signed in to change notification settings - Fork 0
/
voyage.py
41 lines (30 loc) · 1.06 KB
/
voyage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import asyncio
import key
import os
import discord
from discord.ext import commands
import wavelink
intents = discord.Intents.all()
intents.members = True
client = commands.Bot(command_prefix = '.', intents=intents) # prefix for running commands
@client.command()
async def load(ctx, extension):
client.load_extension(f'cogs.{extension}')
await ctx.send("Loaded Cog")
@client.command()
async def unload(ctx, extension):
client.unload_extension(f'cogs.{extension}')
await ctx.send("Unloaded Cog")
async def load_cog():
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
try:
await client.load_extension(f'cogs.{filename[:-3]}')
print(f"Loaded {filename[:-3]}")
# prints out on terminal cog file has been loaded
except Exception as e:
print(f"Failed to load {filename[:-3]}")
# prints out on terminal that the cog file has not been loaded correctly
if __name__ == '__main__':
asyncio.run(load_cog())
client.run(key.BOT_KEY)