-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
47 lines (37 loc) · 1.31 KB
/
bot.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
42
43
44
45
46
47
# Import all required packages and variables
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.environ.get("TOKEN")
client = commands.Bot(command_prefix='d!')
# Bot initialized
@client.event
async def on_ready():
print(f'{client.user.name} is ready.')
await client.change_presence(activity=discord.Streaming(name="duck pictures.", url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"))
@commands.is_owner()
@client.command()
async def load(ctx, extension):
"""Loads a cog"""
client.load_extension(f'cogs.{extension}')
@commands.is_owner()
@client.command()
async def unload(ctx, extension):
"""Unloads a cog"""
client.unload_extension(f'cogs.{extension}')
# Cogs
for filename in os.listdir('./cogs/info'):
if filename.endswith('.py'):
client.load_extension(f'cogs.info.{filename[:-3]}')
for filename in os.listdir('./cogs/moderation'):
if filename.endswith('.py'):
client.load_extension(f'cogs.moderation.{filename[:-3]}')
for filename in os.listdir('./cogs/music'):
if filename.endswith('.py'):
client.load_extension(f'cogs.music.{filename[:-3]}')
for filename in os.listdir('./cogs/inventory'):
if filename.endswith('.py'):
client.load_extension(f'cogs.inventory.{filename[:-3]}')
client.run(TOKEN)