Mars College Discord Bots Framework
This repository contains code for creating chatbots/utility bots for Mars College, or otherwise.
There are several useful utilities for chat programs, including support for numerous language model API providers, as well as methods for completing text, searching topics, and getting message similarity.
Setup (for development)
python -m virtualenv venv
pip install flit
flit install --deps=all --pth-file
Creating a bot
All bots must be placed in a directory equal to or higher in the file system than the run script (bot.py). It is recommended that you create a folder called bots in the marsbots-core directory, then create additional folders and files in there as needed.
All bots expect three things:
- A JSON settings file
- A Python script containing the bot's code as a Discord.py Cog class
- A .env file to load API keys/settings from
Settings File
The bot's JSON settings file should contain the following:
"name": The name of the bot
"token_env": The name of the environment variable which contains the discord bot token used to run the bot
(Optional) "command_prefix": This will be the prefix used for the bot to respond to commands.
(Optional) "intents": A list of special intents needed. Takes a list, with accepted values "presence" and "members"
Cog File
The bot's main logic should be created as a Discord.py Cog class, and should have a setup function which adds the Cog to the bot.
Env File
This should contain any API keys or sensitive variables you need to use to run the bot. Expected default names for environment variables can be found in the config.py file of Marsbots core.
Running Your Bot
Locally
Bots can be run locally using a command such as the following:
python bot.py ./examples/examplebot/examplebot.json --cog-path=examples.examplebot.examplebot --dotenv-path=.env
Note that the --cog-path flag should be provided using python module syntax, using dots.
Managing several bots with PM2
Several bots can be managed at once using PM2 and a PM2 config file. An example config file is provided in the examples folder for running the example bot using PM2.
Metadata
Release files for marsbots 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| marsbots-0.2.1.tar.gz | 1.3 MB | Without provenance | Details for marsbots-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| marsbots-0.2.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for marsbots-0.2.1-py2.py3-none-any.whl |
Total release size: 1.3 MB
Release files / marsbots-0.2.1.tar.gz
| Download URL | marsbots-0.2.1.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f605390c3f5a65bcd0556f4978a9d4f50de7c50072d33598892b332d7299f7f7
|
|
BLAKE2b-256 checksum How to use checksums |
579322cf8ad2547e04d2f195cd0d8735f72f8b6b038450b1f640a7adfb8fa393
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / marsbots-0.2.1-py2.py3-none-any.whl
| Download URL | marsbots-0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e62b38965e117feeaeb6e444bd50c2e14dffda9ff688de73936345fbda717450
|
|
BLAKE2b-256 checksum How to use checksums |
42726b81c5c0994801fa034696a054806fd90c274724467efba9210fdee04fb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Security for marsbots 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.