From 8897408184d2ee057f86108e25fba39afa076e3d Mon Sep 17 00:00:00 2001 From: fanyx Date: Fri, 13 Nov 2020 01:49:39 +0100 Subject: [PATCH] Setup and Config Structure --- .gitignore | 1 + config.ini | 8 ++++++++ main.py | 21 +++++++++++++++++++++ requirements.txt | 6 ++++++ src/commands/__init__.py | 0 src/database/__init__.py | 0 6 files changed, 36 insertions(+) create mode 100644 .gitignore create mode 100644 config.ini create mode 100644 main.py create mode 100644 requirements.txt create mode 100644 src/commands/__init__.py create mode 100644 src/database/__init__.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ceb386 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +venv diff --git a/config.ini b/config.ini new file mode 100644 index 0000000..0c74834 --- /dev/null +++ b/config.ini @@ -0,0 +1,8 @@ +[AUTH] +token = + +[BOT] +name = + +[DEBUG] +loglevel = WARNING \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..7f06489 --- /dev/null +++ b/main.py @@ -0,0 +1,21 @@ +from configparser import ConfigParser +import logging +from discord import Client +import sys + +# read config at default location +# ./config.ini +config = ConfigParser() +try: + config.read_file(open("config.ini")) +except FileNotFoundError: + logging.critical("Unable to locate the configuration file.") + sys.exit(1) + +# spawn discord client instance +# init token from config +bot = Client() +token = config['AUTH']['token'] + +if __name__ == "__main__": + bot.run() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..1bcb522 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +# Discord API Wrapper +discord.py == 1.5.1 +# Database ORM +peewee == 3.14.0 +# Language detection +langdetect == 1.0.8 \ No newline at end of file diff --git a/src/commands/__init__.py b/src/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/database/__init__.py b/src/database/__init__.py new file mode 100644 index 0000000..e69de29