-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.py
91 lines (71 loc) · 2.47 KB
/
main.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
"""
STORYTELLER BOT
-------------------------
[2020] Code by Xinverse
NOTICE: The copyrights of the games belong to their respective holders,
unless otherwise specified. This project is an independent adaptation
of commercial board games into Discord bot format; the Developer is not
affiliated with them in any way.
"""
import globvars
import configparser
import botc
import json
import botutils
import discord
from discord.ext import commands
if __name__ == "__main__":
Config = configparser.ConfigParser()
Config.read("config.INI")
TOKEN = Config["secret"]["TOKEN"]
OWNER_ID = Config["user"]["OWNER_ID"]
PREFIX = Config["settings"]["PREFIX"]
globvars.init_client()
globvars.init_master_state()
def command_prefix(bot, message):
if message.guild is None:
return (PREFIX, "")
else:
return PREFIX
# The help command
with open('botutils/bot_text.json') as json_file:
language = json.load(json_file)
help_command = commands.DefaultHelpCommand(
verify_checks = False,
show_hidden = False,
dm_help = None,
dm_help_threshold = 700,
no_category = language["system"]["others_cog"],
command_attrs = {
"brief" : language["doc"]["help"]["brief"],
"help" : language["doc"]["help"]["help"],
"description" : language["doc"]["help"]["description"]
}
)
intents = discord.Intents.default()
intents.members = True
intents.presences = True
# The bot
globvars.client = commands.Bot(
command_prefix = command_prefix,
owner_id = int(OWNER_ID),
case_insensitive = True,
description = "〘 Blood on the Clocktower Storyteller Bot 〙 - by Xinverse#4011",
paginator = commands.Paginator(),
help_command = help_command,
intents = intents
)
globvars.client.add_check(botutils.check_if_not_ignored)
botutils.rate_limit_commands.start()
# Loading game packs
print("===== LOADING GAME PACKS =====")
botc.load_pack(globvars.master_state)
print(globvars.master_state.game_packs)
extensions = ["admin", "gameplay", "miscellaneous", "listeners"]
# Loading command extensions
print("===== LOADING COMMAND EXTENSIONS =====")
for extension in extensions:
globvars.client.load_extension(f"cmd.{extension}")
print(f"> {extension} cog successfully loaded")
print("===== LOGGING IN =====")
globvars.client.run(TOKEN)