IRC:exec aliases: Difference between revisions

From SoylentNews
Jump to navigation Jump to search
m (added some aliases)
 
(36 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[IRC:exec]]
[[IRC:exec]]


==join==
a link to exec's main wiki page will be output if any user types "exec: help" in a channel where the bot resides<br>
join #channel (don't have to be channel op)


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


==part==
==~bot==
~part (bot leaves channel)


==list==
==~bucket==
~list (lists available commands)


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


==define==
==~buckets-flush==
 
==~buckets-list==
 
==~buckets-load==
 
==~buckets-save==
 
==~chart==
 
==~cid==
 
==~comments==
https://soylentnews.org/~crutchy/journal/1098
 
==~count==
~count &lt;nick&gt;
 
==~cowsay==
 
==~define==
~define term
~define term


==define-add==
==~define-add==
~define-add term, meaning
~define-add term, meaning


==isup==
==~define-count==
 
==~define-delete==
 
==~define-list==
 
==~define-source-edit==
 
==~define-source-param==
 
==~define-sources==
 
==~deop==
 
==~dest-clear==
 
==~dest-override==
 
==~devoice==
 
==~find-first==
~find-first &lt;text&gt;
 
==~find-last==
~find-last &lt;text&gt;
 
==~first==
~first &lt;nick&gt;
 
==~fortune==
 
==~g'day==
 
==~gday==
 
==~header==
~header &lt;header&gt; &lt;url&gt;<br>
returns value of header (if found)<br>
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)
~isup host[:port] (checks connection, returns http status if found)


==rainbow==
==~join==
~join #channel (don't have to be channel op)
 
==~kick==
 
syntax: ~kick %nick%<br>
kicks %nick% from the channel. admin-only command
 
==~kill==
 
syntax: ~kill %pid%<br>
kills process run by exec with process id %pid%<br>
admin-only command<br>
only works for processes run by exec. processes outside exec aren't affected by this command
 
==~killall==
 
kills all processes being run by the bot at the time. admin-only command
 
==~last==
~last &lt;nick&gt;
 
==~link==
 
syntax to search: ~link %search%, set: ~link %id% %content%, delete: ~link %id% -
 
can't use pipe (|) char, %id% can't contain spaces, but %content% can, %search% is a regexp pattern
 
will return a list of one or more %id% => %content% if %search% matches either %id% or %content%
 
==~links==
 
alias of ~link
 
==~list==
syntax: ~list<br>
lists available commands that don't require elevated privs
 
==~list-auth==
syntax: ~list-auth<br>
lists available commands requiring nickserv authentication
 
==~location==
~location %name%<br>
returns the location associated with the specified name
 
==~lock==
syntax: ~lock %alias%<br>
treats all lines entered as being prefixed with alias, channel-specific<br>
see also: ~unlock
 
==~lockdown==
syntax: ~lockdown<br>
admins-only<br>
bot must be op<br>
MODE $dest +ntipm
 
==~log==
 
syntax: ~log param=value ...<br>
returns data from chromas' logging website<br>
refer to http://chromas.0x.no/s/soylent_log.php for more info
 
==~moo==
 
apt-get moo
 
==~op==
 
syntax: ~op [%nick%]<br>
admin-only command<br>
%nick% is optional<br>
if %nick% isn't specified, will op the calling admin<br>
if %nick% is supplied, will op the specified %nick%<br>
bot must be op in channel
 
==~openthepodbaydoors==
 
fortune -s -o
 
==~part==
instruct bot to leave the current channel, or a different channel with optional parameter<br />
syntax: ~part [channel]
 
==~php==
 
==~ps==
 
==~q==
 
==~queue==
~queue (returns number of SN submissions in the queue)
 
==~rainbow==
~rainbow text
~rainbow text


==translate==
==~rehash==
 
==~remind==
 
==~restart==
 
==rofl==
 
==~rps==
 
infinite asynchronous play-by-irc rock/paper/scissors<br>
syntax: ~rps [ranks|r|p|s]<br>
rankings: http://ix.io/nAz<br>
handicap = losses/wins/turns*rounds*100<br>
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/rps.php
 
==~say==
 
==~scramble==
 
==~sed==
~sed on|off<br>
[nick[:|,|&gt;|.] ]s/pattern/replace[/[g]] (similar to SedBot)
 
==~seen==
 
==~staff==
syntax: ~staff meeting<br>
displays meeting info from either the site news slashbox or the board meeting wiki page
 
==~submit==
 
==~suggest==
 
==~tell==
 
==~tests==
 
==~time==
Syntax: ~time location<br />
Related commands: ~time-add ~time-del ~location<br />
Developer(s): crutchy<br />
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 tolang text (auto-detects source lang, eg: ~translate en prueba)


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


==time==
==~unignore==
~time location
 
==~unlock==
Syntax: ~unlock<br>
Related commands: ~lock<br>
Developers: crutchy<br>
Sources: https://github.com/crutchy-/exec-irc-bot/blob/master/irc_lib.php
 
==~up==


==weather==
==~users==


Syntax: ~weather location
syntax: ~users %command% %subject%<br>
admin-only command<br>
where %command% is one of:<br>
===nicks===
%subject% is the channel that you want to get a listing of nicks for
===channels===
%subject% is the nick that you want to get a list of channels for
===all-channels===
%subject% not applicable for this command<br>
returns a listing of all channels that stored users are members of
===count===
%subject% is the channel that you want the user count of
===data===
%subject% is the nick that you want to return stored data for
===account===
%subject% is the nick that you want to find out the nickserv account of


Developer(s): [[User:Crutchy|crutchy]]
==~voice==


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


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


===Usage examples===
==~weather-del==


<source lang="dot">
==~welcome==
<crutchy> ~weather
<exec> IRC WEATHER INFORMATION BOT
<exec>  usage: "~weather location" (visit http://wiki.soylentnews.org/wiki/IRC:exec#Weather_script for more info)
<exec>  data courtesy of the APRS Citizen Weather Observer Program (CWOP) @ http://weather.gladstonefamily.net/
<exec>  by crutchy: https://github.com/crutchy-/test/blob/master/scripts/weather.php
</source>


<source lang="dot">
==~wiki==
<crutchy> ~weather JFK
<exec> Weather for Brooklyn, NY US at 2014-04-14 03:36:00 (UTC) ~ 0.8 hrs ago:
<exec>    temperature = 66°F (18.9°C)    dewpoint = 56.3°F (13.5°C)
<exec>    barometric pressure = 1017.3 mb ~ change of 0 mb over past 0.2 hrs    relative humdity = 71%
<exec>    wind speed = 1 mph (1.6 km/h)    wind direction = 336°
</source>


<source lang="dot">
==~x==
<kobach> ~weather vostok, aq
<exec> Weather for Vostok Station (RUS), -, Antarctica (the territory South of 60 deg S) at 2014-04-14 12:00:00 (UTC) ~ 0.8 hrs ago:
<exec>    temperature = -83.7°F (-64.3°C)    dewpoint = -90.9°F (-68.3°C)
<exec>    barometric pressure = 948.9 mb ~ change of 1.6 mb over past 6 hrs    relative humdity = 57%
<exec>    wind speed = 10 mph (16 km/h)    wind direction = 200°
</source>


<source lang="dot">
the "~x" alias allows a bot operator to create and manage scripts from within IRC (dubbed "live scripts")
<crutchy> ~weather crutchy
<exec> Weather for Melbourne Regional Office, VIC, Australia at 2014-04-14 11:00:00 (UTC) ~ 0.8 hrs ago:
<exec>    temperature = 60.4°F (15.8°C)    dewpoint = 50.2°F (10.1°C)
<exec>    barometric pressure = 1023.5 mb ~ change of -1.4 mb over past 3 hrs    relative humdity = 68%
<exec>    wind speed = (no data)   wind direction = 0°
</source>


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


Syntax: ~weather-add name location
the handler uses php's eval to run live scripts


Developer(s): [[User:Crutchy|crutchy]]
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 "@")


Source:
the general form of the command is:
* 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:
    ~x %action% [%param%] [%code%]
* [[IRC:exec_aliases#weather|~weather]]
* [[IRC:exec_aliases#weather|~weather]]


Description:
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)


Enables storing a short name to refer to a longer location description when using the [[IRC:exec_aliases#weather|~weather]] or [[IRC:exec_aliases#time|~time]] commands.
import and export (from/to file) actions are also proposed but not yet implemented.


If a name already exists, setting it again will overwrite the existing named location.
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.


Names cannot be deleted at this stage.
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.


A few thousand ICAO and IATA/FAA airport codes have been imported into the codes file thanks to [["http://openflights.org/data.html"|OpenFlights]].
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.


==queue==
==!isr==
~queue (returns number of SN submissions in the queue)
In Soviet Russia, x2 x1s YOU!
 
==.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


==lock==
==.relays==
~lock alias|~unlock (treats all lines entered as being prefixed with alias, channel-specific)
Outputs a list of freenode channel relays currently active.
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/activity.php#L111


==location==
==systemctl==
~location code
syntax: systemctl %subject%<br>
tries to do %subject% and fails


[[Category:IRC]]
[[Category:IRC]]
[[Category:IRC:exec]]
[[Category:IRC:exec]]

Latest revision as of 11:37, 23 January 2016

IRC:exec

a link to exec's main wiki page will be output if any user types "exec: help" in a channel where the bot resides

~

~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

syntax: ~kick %nick%
kicks %nick% from the channel. admin-only command

~kill

syntax: ~kill %pid%
kills process run by exec with process id %pid%
admin-only command
only works for processes run by exec. processes outside exec aren't affected by this command

~killall

kills all processes being run by the bot at the time. admin-only command

~last

~last <nick>

~link

syntax to search: ~link %search%, set: ~link %id% %content%, delete: ~link %id% -

can't use pipe (|) char, %id% can't contain spaces, but %content% can, %search% is a regexp pattern

will return a list of one or more %id% => %content% if %search% matches either %id% or %content%

~links

alias of ~link

~list

syntax: ~list
lists available commands that don't require elevated privs

~list-auth

syntax: ~list-auth
lists available commands requiring nickserv authentication

~location

~location %name%
returns the location associated with the specified name

~lock

syntax: ~lock %alias%
treats all lines entered as being prefixed with alias, channel-specific
see also: ~unlock

~lockdown

syntax: ~lockdown
admins-only
bot must be op
MODE $dest +ntipm

~log

syntax: ~log param=value ...
returns data from chromas' logging website
refer to http://chromas.0x.no/s/soylent_log.php for more info

~moo

apt-get moo

~op

syntax: ~op [%nick%]
admin-only command
%nick% is optional
if %nick% isn't specified, will op the calling admin
if %nick% is supplied, will op the specified %nick%
bot must be op in channel

~openthepodbaydoors

fortune -s -o

~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

~rps

infinite asynchronous play-by-irc rock/paper/scissors
syntax: ~rps [ranks|r|p|s]
rankings: http://ix.io/nAz
handicap = losses/wins/turns*rounds*100
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/rps.php

~say

~scramble

~sed

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

~seen

~staff

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

~submit

~suggest

~tell

~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

syntax: ~users %command% %subject%
admin-only command
where %command% is one of:

nicks

%subject% is the channel that you want to get a listing of nicks for

channels

%subject% is the nick that you want to get a list of channels for

all-channels

%subject% not applicable for this command
returns a listing of all channels that stored users are members of

count

%subject% is the channel that you want the user count of

data

%subject% is the nick that you want to return stored data for

account

%subject% is the nick that you want to find out the nickserv account of

~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.

!isr

In Soviet Russia, x2 x1s YOU!

.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

systemctl

syntax: systemctl %subject%
tries to do %subject% and fails