A python package for creating Twitch Bots (Nightly Build)
Project description
Jarvis
This is the repository for Jarvis, the twitch bot.
Getting Started
The simplest way to get started is to create a new file, with the basic code below:
from jarviscore.client import Client
jarvis = Client(nick="yourbotsname",
token="yourbotstoken",
channels=["a list", "of channels", "to connect to"])
jarvis.start()
As an alternative, better practice would be to make use of a config file to store your settings and loading them into the bot when you start.
Use the following code for your bot as a starter.
from jarviscore.client import Client
from jarviscore import Settings
setting = Settings()
jarvis = Client(nick=setting.get_setting("nick"),
token=setting.get_setting("token"),
channels=setting.get_setting("channels"))
jarvis.start()
Next, create a file called config.json
and use the following template to get started
{
"name": "yourbotsname",
"token": "yourbotstoken",
"channels": [
"a list", "of channels", "to connect to"
]
}
If you prefer, you may use a config.yaml
file instead.
Custom Modules
You can create your own custom modules and interactions for your bot using the Jarvis Core.
Create a folder called modules
in the same location as your bot file like so,
+-- root
| |-- bot.py
| |-- config.json
| +-- modules
| |-- module1.py
| |-- module2.py
Then, copy the following boiler plate text to get started. This example implements a simple ping module.
Note: All modules need to implement setup()
and teardown()
, both take channel as a parameter.
from jarviscore import Module, Log
from jarviscore import CommandMessage
log = Log("Module:Ping", verbose="log")
class Ping(Module):
def __init__(self, channel):
Module.__init__(self, "Ping")
self.channel = channel
def on_command(self, data: CommandMessage):
if "ping" == data.KEYWORD:
self.channel.send("pong")
def setup(channel):
channel.load_module(Ping(channel))
log.log(f"Loaded Module Ping")
def teardown(channel):
log.log(f"Removed Module Ping")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jarviscore-nightly-0.1.1.203.tar.gz
.
File metadata
- Download URL: jarviscore-nightly-0.1.1.203.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc173d044320066ca88ebd1d7ee49e53b7f071e497e1dba432969f0fc7e9d241 |
|
MD5 | 1a26e0da8828b8eab37fa0175dbfc662 |
|
BLAKE2b-256 | 99024689e8a069d0f58c82dee117909366280769b7832f33ffa5b0c7e539199e |
File details
Details for the file jarviscore_nightly-0.1.1.203-py3-none-any.whl
.
File metadata
- Download URL: jarviscore_nightly-0.1.1.203-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b875f417f86176a2557ae27f0d4700a17e84718b76ea21b238f628276f3cb4e |
|
MD5 | 46ee0290e336e32940d15bc9d6fb96f8 |
|
BLAKE2b-256 | 0e11f5dbac8383cdda363eef44e9b1f6c5f115a0980aae01817c1435c8bde30e |