Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jarviscore

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jarviscore

A python package for creating Twitch Bots

  • 0.1.1.426
  • PyPI
  • Socket score

Maintainers
1

Jarvis

Build status PyPI version

This is the repository for the JarvisCore framework used to run the Jarvis the twitch bot. You are welcome to use this library to build your own bot for twitch, please note that there is currently minimal documentation which does tend to make things a little tricky.

You are welcome to join the "Looking for Jarvis" Discord server for updates and to join the community.

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")

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc