Internet Relay SHell
Both IRC and Unix shells share a line-oriented, text-based interface. Many IRC bots follow the pattern of invoking commands and passing arguments, but do not allow for composition of commands. The Unix shell (through pipes and redirection) makes composition of commands and filters simple.
Thus irsh hopes to achieve the same, but in the restricted context of an IRC channel, and with the reuse of as many Unix utilities as possible (with only slight interface modifications).
The bot’s core is written in Python3 and requires no non-standard libraries.
The rest of the bot is intended to be written in Unix shell, specifically fish, and in general the core commands require only core utilities.
The bot identifies commands with a prefix (typically
$), and then
shlex python module to tokenize the input. The rest works
as you expect from any Unix shell, with piping, and output redirection
(to simplify permissions only append is allowed).
Filenames are restricted to alphanumeric characters, and IRC channels are used as “directories” (with the channel where the command originated being considered the current working directory), allowing for each channel to have its own namespace, while still allowing use of files across channels through absolute pathnames.
For example, in a network with two channels,
if we append to a file in
<stringy> $echo this is in #one >> one <stringy> $cat one <fish> this is in #one
And then we want to access it from
<stringy> $cat one <fish> cat: var/root/#two/one: No such file or directory <stringy> $cat /#one/one <fish> this is in #one
We can simply use an absolute path.
You will also notice that the error message fish gave for a missing file
var/root, which is where fish stores files, relative to where it is
started. The most important component in the resolution of filenames is the
lib/path which takes the context of the pathname (i.e. the current
channel) and crafts a real path to the actual file in
var/root. This prevents
users from escaping the