Skip to content

Silari/DBContext

Repository files navigation

DBContext

A discord.py based bot with module loading functions - aka contexts. Currently, this bot allows for announcing for Picarto.TV, Twitch.TV, and Piczel.TV streams on discord servers. Each is configured independently, allowing for each type to occupy their own channel with their own options if desired. A template is provided to create new contexts. Essentially, each module handles any command that uses the module name - ie. any command starting with picarto is given to the picartocontext module to handle. The dbcontext module manages the client instance, and provides a persistent data storage location which is saved periodically to dbcontext.bin via pickling.

Modules should be simple, easy to use, and not require excessive permissions. This is not an administration bot, and does not need any permissions beyond reading, writing, and editing messages, embedding in messages, adding reactions and emojis, and adding mentions to messages. This is little more than what the average user has by default. It also asks for role management permissions to add/remove the role permitting users to use the bot, but is not required.

Prerequisites

If you simply wish to add the current instance of dbcontext to your server, check the instructions on the project wiki.

If you wish to run your own instance, you must use Python 3.6 or 3.7, and have installed discord.py version 1.3.3. Typically, this can be done easily via pip.

Linux/OS X

python3 -m pip install -U discord.py

Windows

py -3 -m pip install -U discord.py

Installation

You will need the main dbcontext.py file, basecontext.py, and the three class files (picartoclass.py, twitchclass.py, and piczelclass.py) in the same directory. You will also need the apitoken.py file, and edit it to include your api tokens for Discord and twitch. Running the dbcontext.py file will start the bot.

If you wish to write your own context module, see templatecontext.py or templateclass.py for a basic framework example. The three current contexts also make for good examples of subclassing basecontext - they share a large portion of their code, with most differences in a few helper functions that deal with the slight changes in how their APIs function. Picartoclass in particular shows how little new code one needs to add over basecontext to create a functional module.

Links

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A discord.py based bot with module loading functions - aka contexts

Topics

Resources

License

Stars

Watchers

Forks

Languages