-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnyxexample.py
More file actions
28 lines (24 loc) · 1022 Bytes
/
nyxexample.py
File metadata and controls
28 lines (24 loc) · 1022 Bytes
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
"""
This is a simple file that can run Nyx. It will take the token from the
info.nyx (or whatever config) file and use it to start your Discord bot up.
The name of the folder where cogs are stored can be specified here as well.
"""
from configparser import ConfigParser
from nyxbot import NyxBot, NyxGuild, NyxUser
nyx_cog_folder = "cogs" # The folder where cogs will be searched for.
nyx_config_file = "info.nyx" # The name of the config file used.
nyx = NyxBot()
nyx.add_cog(NyxGuild(nyx))
nyx.add_cog(NyxUser(nyx))
nyx.load_cogs(nyx_cog_folder) # Get cogs from specified folder.
nyx_config = ConfigParser()
nyx_config.read(nyx_config_file)
# If the file doesn't exist ConfigParser will just read empty.
if "Settings" not in nyx_config:
print("Settings not found. Configure your " +
nyx_config_file + " file.")
elif "Token" not in nyx_config["Settings"]:
print("Token setting not found. Configure your " +
nyx_config_file + " file.")
else:
nyx.run(nyx_config["Settings"]["Token"])