This repository was archived by the owner on Feb 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
71 lines (59 loc) · 1.75 KB
/
run.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import asyncio
import copy
import datetime
import sys
import time
import logging
import json
from collections import Counter, OrderedDict
import discord
from discord.ext import commands
from discord import errors
client = discord.Client()
# Load settings.
with open("settings.json") as f:
settings = json.load(f)
# Setups logging type and format.
logging.basicConfig (
level = logging.INFO,
style = '{',
datefmt = "%d/%m/%Y %H:%M:%S",
format = "\n{asctime} [{levelname}] {name}:\n{message}"
)
# Bot prefix.
bot = commands.Bot(command_prefix=(settings['prefix']))
# Disable default help command from discord.py.
bot.remove_command('help')
@bot.event
async def on_ready():
# Module list.
modules = (
"moduleHandler",
"help",
"mute",
"tempMute",
"kick",
"ban",
"ping",
"misc",
"fun",
"giveaway",
"report",
"bug",
"suggestion",
"mutedCheck",
"chatFilter",
"errorHandler",
"greeting"
)
# Load modules.
for m in modules:
bot.load_extension("modules.{}".format(m))
# Changes game presence.
await bot.change_presence(game=discord.Game(name=settings['status'], type=settings['rpctype']))
# Prints startup to console.
print("Started watch session as: ID {} ({}#{})".format(bot.user.id, bot.user.name, bot.user.discriminator))
# Announces startup.
announcement_channel = bot.get_channel(settings['announcement_channel'])
await bot.send_message(announcement_channel, "Started watch session as: ID {} ({}#{})".format(bot.user.id, bot.user.name, bot.user.discriminator))
bot.run(settings['token'])