No Description

Xuu 8731506a00 update build script 10 months ago
cmd a29cba7d72 add commands and sock usage to README 10 months ago
debian df8f998c92 fixes for version 2 years ago
shell d829b58096 add README and LICENSE 10 months ago
vendor 45529e8f47 updates 1 year ago
.generated 7c8f17875b update generated 3 years ago
.gitignore 6dd2053188 simplify shell structure 10 months ago
.gitmodules 9eca3811ae initial commit 3 years ago
LICENSE d829b58096 add README and LICENSE 10 months ago
Makefile 8731506a00 update build script 10 months ago
README.md a29cba7d72 add commands and sock usage to README 10 months ago
VERSION a29cba7d72 add commands and sock usage to README 10 months ago
go.mod 6dd2053188 simplify shell structure 10 months ago
go.sum 6dd2053188 simplify shell structure 10 months ago

README.md

Skillet IRC Bot

Skillet runs commands on shell and returns the output. It also supports control through UNIX sockets.

Install

go get -U sour.is/x/skillet

create script directory

wget https://git.sour.is/attachments/67c5c7f8-3997-4796-b9b5-8fb8e2d8401e -O shell.tgz
tar xvJf shell.tgz

Config

Skillet can be configured by command args, environment vars, or a config.toml file.

Usage:
  skillet version
  skillet [-v  | -vv] connect [-u <UnixSocket>]

Options:
  -v                                             Log info to console.
  -vv                                            Log debug to console.
  -c <ConfigDir>, --config=<ConfigDir>           Set Config Directory.
  -u <UnixSocket>                                Listen for commands on unix socket.
  --tls                                          Enable TLS
  --tls-cert <cert>                              Use TLS Cert
  --tls-key <key>                                Use TLS Key

Config:
  The config file is read from the following locations:
    - <ConfigDir>
    - /etc/opt/sour.is/skillet/
    - Working Directory

Environ variables

Variable Notes
SKILLET_IRC_TLS enable TLS connection
SKILLET_IRC_TLSCERT Use TLS Client Cert
SKILLET_IRC_TLSKEY Use TLS Client Cert Key
SKILLET_IRC_HOST Hostname and port to connect (ex. irc.host:6669)
SKILLET_IRC_NICK Bot Nick to use
SKILLET_IRC_CHAN Default channel to join (default: #skillet)
SKILLET_IRC_PASS (optional) Password to authenticate with host
SKILLET_IRC_OPER Nick of super user (default: none)
SKILLET_IRC_UNIX (optional) Listen on socket (ex. /tmp/skillet.sock)
SKILLET_IRC_CMDTIMEOUT (optional) Timeout for shell commands (default: 30 seconds)

Config File

[irc]
# config for connecting to server here.
host = "localhost:6669"
chan = "#skillet"
nick = "skillet"
# pass = "secret password"
# oper = "somenick"
# unix = "/tmp/skillet.sock"

[irc.cmd]
run = "./run"
timeout = 30

[irc.opts]
# config to pass to shell here.

Running

cd shell
skillet

Sending Commands to socket

writing to the socket can be done with netcat -U. By default the text you send will be noticed to the home chan a line at a time.

echo "hello world!" | nc -U /tmp/skillet.sock

Special Commands

Command modifiers can be used to make skillet do things. They are done by placing a +CMD TARGET on a line by itsself. where CMD is an IRC command. (PRIVMSG, NOTICE, JOIN, PART, INVITE, QUIT, RAW). These commands can be sent to the socket or returned from scripts.

# Join a channel (or list of channels)
echo "+JOIN #channel #channel2" | nc -U /tmp/skillet.sock

# Part a channel (or list of channels)
echo "+PART #channel #channel2" | nc -U /tmp/skillet.sock

# Invite a user to a channel
echo "+INVITE somenick #channel" | nc -U /tmp/skillet.sock

# Private message a user.
echo "+PRIVMSG somenick\nhey this is a message!" | nc -U /tmp/skillet.sock

# Notice to a channel.
echo "+NOTICE #channel\nhey this is a message!" | nc -U /tmp/skillet.sock

# Quit and shutdown skillet.
echo "+QUIT quit message" | nc -U /tmp/skillet.sock

# Send RAW command to server
echo "+RAW KNOCK #channel" | nc -U /tmp/skillet.sock