Browse Source

add commands and sock usage to README

Xuu 7 months ago
parent
commit
a29cba7d72
3 changed files with 40 additions and 3 deletions
  1. 37 0
      README.md
  2. 1 1
      VERSION
  3. 2 2
      cmd/skillet/skillet.go

+ 37 - 0
README.md

@@ -81,3 +81,40 @@ timeout = 30
 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.
+
+```sh
+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.
+
+```sh
+# 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
+```

+ 1 - 1
VERSION

@@ -1 +1 @@
-0.5.20
+0.5.21

+ 2 - 2
cmd/skillet/skillet.go

@@ -58,7 +58,7 @@ func run(ctx context.Context) {
 
 	CMD := viper.GetString("irc.cmd.run")
 	OPTS := viper.GetStringMapString("irc.opts")
-	CMDTIMEOUT := time.Duration(viper.GetInt64("irc.cmd.timeout")) * time.Second
+	TIMEOUT := time.Duration(viper.GetInt64("irc.cmd.timeout")) * time.Second
 
 	cfg := irc.NewConfig(NICK)
 
@@ -161,7 +161,7 @@ func run(ctx context.Context) {
 			hook := CMD
 			args := []string{line.Nick, line.Ident + "@" + line.Host, line.Target(), "", line.Text()}
 
-			ctx, cancel := context.WithTimeout(ctx, CMDTIMEOUT)
+			ctx, cancel := context.WithTimeout(ctx, TIMEOUT)
 			defer cancel()
 
 			cmd := exec.CommandContext(ctx, hook, args...)