Difference between revisions of "IRC:exec aliases"

From SoylentNews
Jump to: navigation, search
(.macro)
Line 279: Line 279:
  
 
==.macro==
 
==.macro==
 +
 +
syntax to add: .macro <trigger> <chanlist> PRIVMSG|INTERNAL <command_template>
 +
syntax to delete: .macro <trigger> -
 +
<chanlist> is comma-separated or * for any
 +
 
Used to set a PRIVMSG or INTERNAL macro.
 
Used to set a PRIVMSG or INTERNAL macro.
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/cmd.php#L128
+
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/cmd.php#L130
  
 
==.relays==
 
==.relays==

Revision as of 08:47, 9 September 2015

IRC:exec

~

~bot

~bucket

~buckets-dump

~buckets-flush

~buckets-list

~buckets-load

~buckets-save

~chart

~cid

~comments

https://soylentnews.org/~crutchy/journal/1098

~count

~count <nick>

~cowsay

~define

~define term

~define-add

~define-add term, meaning

~define-count

~define-delete

~define-list

~define-source-edit

~define-source-param

~define-sources

~deop

~dest-clear

~dest-override

~devoice

~find-first

~find-first <text>

~find-last

~find-last <text>

~first

~first <nick>

~fortune

~g'day

~gday

~header

~header <header> <url>
returns value of header (if found)
fails silently if error occurs or header not found

~header-login

~help

~ignore

~invite

~ircd

~isup

~isup host[:port] (checks connection, returns http status if found)

~join

~join #channel (don't have to be channel op)

~kick

~kill

~killall

~last

~last <nick>

~list

~list (lists available commands)

~list-auth

~list-auth (lists available commands requiring NickServ account authorization)

~location

~location code

~lock

~lock alias (treats all lines entered as being prefixed with alias, channel-specific)

~log

~moo

~op

~part

instruct bot to leave the current channel, or a different channel with optional parameter
syntax: ~part [channel]

~php

~ps

~q

~queue

~queue (returns number of SN submissions in the queue)

~rainbow

~rainbow text

~rehash

~remind

~restart

rofl

~say

~scramble

~sed

~sed on|off
[nick[:|,|>|.] ]s/pattern/replace[/[g]] (similar to SedBot)

~staff

syntax: ~staff meeting
displays meeting info from either the site news slashbox or the board meeting wiki page

~suggest

~tests

~time

Syntax:
~time location
Related commands:
~time-add
~time-del
~location
Developer(s):
crutchy
Sources:
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/time.php
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/time_lib.php

~time-add

~time-del

~title

~translate

~translate tolang text (auto-detects source lang, eg: ~translate en prueba)

~translate-sl

~translate-sl fromlang tolang text (eg: ~translate-sl es en prueba)

~unignore

~unlock

Syntax:
~unlock
Related commands:
~lock
Developers:
crutchy
Sources:
https://github.com/crutchy-/exec-irc-bot/blob/master/irc_lib.php

~up

~users

~voice

~weather

Syntax:
~weather location
Examples:
~weather JFK
~weather vostok, aq
Related commands:
~weather-add
~time-add
Developers:
crutchy
Sources:
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/weather.php
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/weather_lib.php

~weather-add

Syntax: ~weather-add name location
Developer(s): crutchy
Sources:
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/weather.php
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/weather_lib.php
Related commands:
~weather
~time
~time-add
~location
Description:
Enables storing a short name to refer to a longer location description when using the ~weather or ~time commands.
If a name already exists, setting it again will overwrite the existing named location.
Names cannot be deleted at this stage.
A few thousand ICAO and IATA/FAA airport codes have been imported into the codes file thanks to OpenFlights.
<crutchy> ~weather-add crutchy melbourne australia
<exec> code "crutchy" set for location "melbourne australia"

~weather-del

~welcome

~wiki

~x

the "~x" alias allows a bot operator to create and manage scripts from within IRC (dubbed "live scripts")

scripts created using this alias are stored in a bucket by the bot instead of a file

the handler uses php's eval to run live scripts

to prevent anyone from executing arbitrary commands on the bot host, a whois command is issued to verify that the NickServ account of the user of the ~x alias is the bot operator (by settling the userlist parameter of the alias definition line to "@")

the general form of the command is:

   ~x %action% [%param%] [%code%]

in a nutshell the possible actions and params are: "global on|off" (enables or disables all live scripts) "kill" (a shorcut for disabling all live scripts) "enable %script-name%" (enables an individual live script) "disable %script-name%" (disables an individual live script) "delete-script %script-name%" (deletes a live script from memory) "open %script-name%" (opens a live script for editing in the active channel) "close" (closes the currently open live script in the active channel) "code" (outputs a line-numbered code listing of the currently open live script in the active channel) "list" (outputs a listing of available live scripts, and highlights enabled scripts) "replace [L]%line-number% %old-code%|%new-code%" (replaces a line of code in the currently open live script) "delete-line [L]%line-number%" (deletes a line of code in the currently open live script) "insert [L]%line-number% %code%" (inserts a line of code in the currently open live script) "add %code%" (adds a line of code to the currently open live script)

import and export (from/to file) actions are also proposed but not yet implemented.

live scripts have access to common lib functions used by other scripts, and also have direct access to $nick, $dest (channel), $trailing. the privmsg lib function doesn't work for live scripts as the live script handler is triggered internally by the bot using a registered privmsg event handler, so to privmsg the channel that the sender ($nick) is in you simply call pm($dest,"message) instead.

when a new live script is created, it must be enabled before it will run, but once enabled any changes will come into affect immediately.

whilst the code is currently limited to php, it could potentially be adapted to execute code in other languages using their command-line interpreters. it also doesn't have to be limited to code. it could potentially be used to collaborate on lines of non-executing text (such as for collaborative editing of SN submissions). with some tweaks it could be possible to collaborate on code as well, with other users being able to add/edit/delete lines but requiring the operator to re-enable the script for changes to come into effect.

.macro

syntax to add: .macro <trigger> <chanlist> PRIVMSG|INTERNAL <command_template> syntax to delete: .macro <trigger> - <chanlist> is comma-separated or * for any

Used to set a PRIVMSG or INTERNAL macro. https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/cmd.php#L130

.relays

Outputs a list of freenode channel relays currently active. https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/activity.php#L111