General Usage

ZenIRCBot API

class zenircbot_api.ZenIRCBot(host='localhost', port=6379, db=0)

Instantiates a new ZenIRCBot API object.

Parameters:
  • host (string) – Redis hostname (default: ‘localhost’)
  • port (integer) – Redis port (default: 6379)
  • db (integer) – Redis DB number (default: 0)
Returns:

ZenIRCBot instance

Takes Redis server parameters to use for instantiating Redis clients.

get_redis_client()

Get redis client using values from instantiation time.

register_commands(service, commands)
Parameters:
  • script (string) – The script with extension that you are registering.
  • commands (list) – A list of objects with name and description attributes used to reply to a commands query.

This will notify all admin_spew_channels of the script coming online when the script registers itself. It will also setup a subscription to the ‘out’ channel that listens for ‘commands’ to be sent to the bot and responds with the list of script, command name, and command description for all registered scripts.

send_action(to, message)

Sends an “ACTION” message to the specified channel(s)

Parameters:
  • to – A list or a string, if it is a list it will send to all the people or channels listed.
  • message (string) – The message to send.

This is a helper so you don’t have to handle the JSON or the envelope yourself.

send_admin_message(message)
Parameters:message (string) – The message to send.

This is a helper function that sends the message to all of the channels defined in admin_spew_channels.

send_privmsg(to, message)

Sends a message to the specified channel(s)

Parameters:
  • to – A list or a string, if it is a list it will send to all the people or channels listed.
  • message (string) – The message to send.

This is a helper so you don’t have to handle the JSON or the envelope yourself.

zenircbot_api.load_config(name)

Loads a JSON file and returns an object.

Parameters:name (string) – The JSON file to load.
Returns:An native object with the contents of the JSON file.

This is a helper so you don’t have to do the file IO and JSON parsing yourself.

Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.