salt.engines.ircbot

IRC Bot engine

New in version 2017.7.0.

Example Configuration

engines:
  - ircbot:
      nick: <nick>
      username: <username>
      password: <password>
      host: chat.freenode.net
      port: 7000
      channels:
        - salt-test
        - '##something'
      use_ssl: True
      use_sasl: True
      disable_query: True
      allow_hosts:
        - salt/engineer/.*
      allow_nicks:
        - gtmanfred

Available commands on irc are:

ping

return pong

echo <stuff>

return <stuff> targeted at the user who sent the commands

event <tag> [<extra>, <data>]

fire event on the master or minion event stream with the tag salt/engines/ircbot/<tag> and a data object with a list of everything else sent in the message

Example of usage

08:33:57 @gtmanfred > !ping
08:33:57   gtmanbot > gtmanfred: pong
08:34:02 @gtmanfred > !echo ping
08:34:02   gtmanbot > ping
08:34:17 @gtmanfred > !event test/tag/ircbot irc is useful
08:34:17   gtmanbot > gtmanfred: TaDa!
[DEBUG   ] Sending event: tag = salt/engines/ircbot/test/tag/ircbot; data = {'_stamp': '2016-11-28T14:34:16.633623', 'data': ['irc', 'is', 'useful']}
class salt.engines.ircbot.Event(source, code, line)
property code

Alias for field number 1

property line

Alias for field number 2

property source

Alias for field number 0

class salt.engines.ircbot.IRCClient(nick, host, port=6667, username=None, password=None, channels=None, use_ssl=False, use_sasl=False, char='!', allow_hosts=False, allow_nicks=False, disable_query=True)
join_channel(channel)
on_closed()
on_connect()
read_messages()
send_message(line)
class salt.engines.ircbot.PrivEvent(source, nick, user, host, code, channel, command, line)
property channel

Alias for field number 5

property code

Alias for field number 4

property command

Alias for field number 6

property host

Alias for field number 3

property line

Alias for field number 7

property nick

Alias for field number 1

property source

Alias for field number 0

property user

Alias for field number 2

salt.engines.ircbot.start(nick, host, port=6667, username=None, password=None, channels=None, use_ssl=False, use_sasl=False, char='!', allow_hosts=False, allow_nicks=False, disable_query=True)

IRC Bot for interacting with salt.

nick

Nickname of the connected Bot.

host

irc server (example - chat.freenode.net).

port

irc port. Default: 6667

password

password for authenticating. If not provided, user will not authenticate on the irc server.

channels

channels to join.

use_ssl

connect to server using ssl. Default: False

use_sasl

authenticate using sasl, instead of messaging NickServ. Default: False

Note

This will allow the bot user to be fully authenticated before joining any channels

char

command character to look for. Default: !

allow_hosts

hostmasks allowed to use commands on the bot. Default: False True to allow all False to allow none List of regexes to allow matching

allow_nicks

Nicks that are allowed to use commands on the bot. Default: False True to allow all False to allow none List of regexes to allow matching

disable_query

Disable commands from being sent through private queries. Require they be sent to a channel, so that all communication can be controlled by access to the channel. Default: True

Warning

Unauthenticated Access to event stream

This engine sends events calls to the event stream without authenticating them in salt. Authentication will need to be configured and enforced on the irc server or enforced in the irc channel. The engine only accepts commands from channels, so non authenticated users could be banned or quieted in the channel.

/mode +q $~a # quiet all users who are not authenticated /mode +r # do not allow unauthenticated users into the channel

It would also be possible to add a password to the irc channel, or only allow invited users to join.