basic bot setup

This commit is contained in:
Xevion
2021-02-07 05:37:02 -06:00
commit b7d4a810e9
6 changed files with 51 additions and 0 deletions

0
contest/__init__.py Normal file
View File

15
contest/client.py Normal file
View File

@@ -0,0 +1,15 @@
import discord as discord
class ContestClient(discord.Client):
def __init__(self, **options) -> None:
super().__init__(**options)
async def on_message(self) -> None:
pass
async def on_raw_reaction_add(self, payload) -> None:
pass
async def on_raw_reaction_remove(self, payload) -> None:
pass

1
contest/constants.py Normal file
View File

@@ -0,0 +1 @@
DATABASE = 'database.db'

27
contest/db.py Normal file
View File

@@ -0,0 +1,27 @@
import sqlite3
import aiosqlite
from contest import constants
class ContestDatabase(object):
"""
A handler class for a SQLite3 database used by the bot with Async support.
"""
def __init__(self, conn: aiosqlite.Connection) -> None:
self.db = conn
@classmethod
async def create(cls) -> 'ContestDatabase':
"""
Constructs a ContestDatabase object connecting to the default database location with the proper connection settings.
:return: A fully realized ContestDatabase object.
"""
conn = await aiosqlite.connect(constants.DATABASE, detect_types=sqlite3.PARSE_DELCTYPES)
db = ContestDatabase(conn)
await conn.commit()
return db
async def is_setup(self):
pass

7
main.py Normal file
View File

@@ -0,0 +1,7 @@
from contest import client
if __name__ == "__main__":
bot = client.ContestClient()
with open('token.dat', 'r') as file:
bot.run(file.read())

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
discord~=1.0.1