-
Notifications
You must be signed in to change notification settings - Fork 0
/
kzbot.py
49 lines (33 loc) · 981 Bytes
/
kzbot.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
48
49
"""KZ Discord BOT
This module contains the core functionality of the bot.
"""
import os
import time
import discord
import yaml
from discord.ext import commands
with open('config.yml') as file:
config = yaml.safe_load(file)
bot = commands.Bot(command_prefix=config['bot']['prefix'])
@bot.event
async def on_ready():
print('Logged in as:')
print('--------------')
print(f'BOT: {bot.user.name}')
print(f'ID: {bot.user.id}')
print('-----------------------\n')
bot.uptime = time.time()
bot.message_count = 0
bot.messages_sent = 0
bot.mentions_count = 0
def main():
for file in os.listdir('cogs'):
if file.endswith('.py'):
extension = file[:-3]
try:
bot.load_extension(f'cogs.{extension}')
except discord.DiscordException:
print(f'[ERROR] Failed to load extension {extension}.py')
if __name__ == '__main__':
main()
bot.run(config['bot']['token'])