New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chat-transformer

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chat-transformer

Bridge that takes incoming IRC messages and converts them to other formats

  • 0.5.0
  • PyPI
  • Socket score

Maintainers
1

Build Status PyPI version

chat_transformer

Translates incoming IRC messages to OSC, HTTP, or any other output format you need.

Installation

chat_transformer can be installed using pip:

pip install chat_transformer

Set up

You must create a json file that specifies that mapping of IRC messages to output data. The file must contain a JSON object, where each KEY is an IRC command/message, and the VALUE is a JSON object with the parameters for converting the IRC message to OSC commands. For example:

{
    "brightness": {
        "address": "/osc/brightness/",
        "min": 0.0,
        "max": 2.0,
        "delta": 0.1,
        "initial": 1.0,
        "outputs": {
            "osc": {"address": "/video/brightness"},
            "http": {"command_name": "brightness"}
        }
    },
    ....
}

With the above targets data, the following IRC message:

brightness set 0.75

would translate to the following OSC Message:

/osc/brightness 0.75

and the following POST message to the main HTTP target:

{brightness: {"value": 0.75, "min": 0.0, "max": 2.0}}

Usage

chat_transformer can be run as a CLI command. At minimum, you must specify the location of a config file that will hold the various settings necessary for running chat_transformer:

chat_transformer --config /path/to/my/config.json

Or with the shorthand commands:

chat_transformer -c /path/to/my/config.json

Rather than specifying options as command-line arguments, options can instead be set as environment variables:

export CHAT_TRANSFORMER_CONFIG=/path/to/my/config.json
chat_transformer

Command Line Options

ArgumentEnv variable nameDescriptionDefault
-c, --configCHAT_TRANSFORMER_CONFIGfilepath of the config JSON fileconfig.json
-v, --verbosityHow verbose to make the output1 (Info)

Configuration File

The configuration JSON file holds all the necessary settings for running your instance of chat_transformer. At bear minimum it must include an irc key with the server and login information, a commands key with information about the the commands JSON file (which contains the list of active commands to listen for and respond to), and at least one output (osc and http are supported out of the box). Here's an example of a minimal configuration file that's listening to freenode:

{
    "irc": {
        "server": "chat.freenode.net"
    },
    "commands": {
        "filename": "/path/to/my/commands.json"
    },
    "outputs": {
        "osc": {
            "port": 9876
        }
    }
}

Configuration File Ooptions

KeyDescriptionDefault
irc.serverServer address of the IRC ServerNone (Required)
irc.portPort number of the IRC Server6667
irc.nicknameNickname for authnenticating on IRCNone (Required)
irc.passwordPassword for authentication on the IRC server
irc.usernameUsername for authentication on the IRC serverirc.nickname (above)
irc.realnameReal name on on the IRC server
irc.channelIRC channel to join and listen for incoming commands.irc.nickname (above)
commands.filenamePath of the file that holds the IRC commands to listencommands.json
commands.watchReload the commands file when it has changed on diskFalse
commands.watch_intervalTime (in seconds) between checking for file changes60
output.osc.ipIP Address of the OSC target127.0.0.1
output.osc.postPort of the OSC targetNone (Required if OSC is used)
output.http.base_urlURL target to post toNone (Required if HTTP is used)
output.http.jwt_secretJWT secret for using JWT encoding

Commands File Options

KeyDescriptionDefault
minMininum possible value for this command0.0
maxMaximum possible value for this command1.0
deltaAmount to change whenever an INCREMENT or DECREMENT command is received0.05
initialInitial value for this command0.5
outputs.osc.addressOSC Address to which the message should be send
outputs.http.command_newKey to used for the POSTed HTTP data
outputs.http.endpointEndpoint to POST to for this command

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