This is an old revision of the document!
IRC howtos, freenode.net #labka channel, IRSSI magic & scripts, SECRETARY <3
Total basics of IRSSI and screen
* ssh yourself to Darkstar [exLabka Shell] : 193.84.207.21
ssh USERNAME@193.84.207.21
screen -U irssi /connect chat.freenode.net /nick your_nick /save /j #labka [ /wc ] - closing chat window [j #labka_secret] - connect to other chat room [/help any_command - will give you help for commands, it is accepting tab as Linux command line]
ctrl+p or n - switching between chat windows [rooms] - ala alt+tab ctrl + number [or qwerty when over 10] - switching to direct number of window [/window list will show you which window is which #]
screen -list - will give you list of all screens opened and running screen -rdU - will switch you to reattached screen window
inside screen:
screen is accepting ctrl + a [something] ctrl + a + d - detach screen [reattach by screen -rdU from command line] ctrl + a + c - create new screen window ctrl + a + a - rotate between screen windows [again like alt+tab]
Nice howtos: * http://www.antonfagerberg.com/blog/my-perfect-irssi-setup/
* https://quadpoint.org/articles/irssi/
* moar about screen: http://aperiodic.net/screen/quick_reference
SECRETARY BOT : How does it work
- you need running IRSSI instance and your bot is just one IRSSI identity, best is to run single instance of IRSSI in screen somewhere
- configuration of bot is done by IRSSI, so you want have it named, connect somewhere… IRSSI is your friend
- repository papalala will show you how to get data from IRC and return it back to IRC
- in case you are going to test, please do not test your progress on #labka channel, create your own
Where to test existing instances
IRC Chat: #labka on freenode (just enter a nickname, connect and chat)
Existing instances info
Overdrive
https://github.com/Over23/Irssi_scripts actual functionality of Secretary bot on #labka channel:
!spoj "jizdni rad -- from -- to" pro ostatni jizdni rady e.g. `spoj vlak -- from -- to !btc [x] - btc day average, czk-usd, [Xczk = Ybtc] !decide A -- B - will return you A or B, kind of random !skladiste - funny example how to query web page !csfd what film - CSFD.cz query !labka rss - show last 3 updates of this wiki !banka Secretary: whatever - hailobot will return you pseudo Alice bot answer
Peterbay
repo for IRSSI scripts: https://github.com/peterbay/Irssi-Scripts actual fucntionality by pbbot on #labka channel:
`csfd what film - CSFD.cz query `dpo A -- B - public transport query, from A to B `labka rss - will give you updates of Labka page `wiki what - will return wikipedia query to you `spoj from -- to == Ostrava `spoj "jizdni rad -- from -- to" pro ostatni jizdni rady e.g. `spoj vlak -- from -- to `banka - parse Labka bank account
NonBOT commands
/alias ToDo /exec echo "$0-" >> ~/ToDo.txt - add something to file, called as /ToDo whatever /alias ToDol /exec cat ~/ToDo.txt - read that file, called as /ToDol /alias ToDod /exec grep -v "$0" ~/ToDo.txt > ~/ToDo.tmp && mv ~/ToDo.tmp ~/ToDo.txt - delete $0 from ~/ToDo.txt /alias Idea /exec echo "$0-" >> ~/Idea_irssi_note.txt - add something to file, called as /Idea whatever /alias Ideal /exec cat ~/Idea_irssi_note.txt - read that file, called as /Ideal /alias Random /exec dd if=/dev/urandom bs=1 count=23 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev /alias MOTD /exec cat /home/share/irssi_motd_news.txt - news for all to add and remove manually, will be shown at 9:00 and 23:59
Cron
- script used for this command set is : https://scripts.irssi.org/scripts/cron.pl
# Short help/usage: # /jobadd hour minute day_of_month month day_of_week command # Possibile switches for jobadd: # -disabled # -server <tag> # -<number> # /jobs [-v] # /jobdel [-finished] | job_number # /jobdisable job_number # /jobenable job_number # /jobssave # /jobsload # # Examples of usage: # /jobadd 17 45 * * * /echo This will be executed at 17:45 # /jobadd -5 17 45 * * * /echo The same as above but only 5 times # /jobadd * 05 * * * /echo Execute this every hour 5 minutes after the hour # /jobadd */6 0 * * * /echo Execute at 0:0, 6:0, 12:0, 18:0 # /jobadd * */30,45 * * * /echo Execute every hour at 00, 30, 45 minute # /jobadd * 1-15/5 * * * /echo at 1,6,11
Actually used cron on #labka channels
01:03:22 -!- Irssi: Current Jobs: 01:03:22 -!- Irssi: 0) -server freenode 23 59 * * * /msg #labka `banka 01:03:22 -!- Irssi: 1) -server freenode 23 59 * * * /msg #labka !labka rss 01:03:22 -!- Irssi: 2) -server freenode 12 00 * * * /msg #labka !labka rss 01:03:22 -!- Irssi: 3) -server freenode 12 00 * * * /msg #labka `banka 01:03:22 -!- Irssi: 4) -server freenode 23 58 * * * /exec fortune -s | tr -d '\012\015\011'; 01:03:22 -!- Irssi: 5) -server freenode 01 00 28 04 * /topic #labka Labka.cz : Hackerspace Ostrava : Remember Shoah 01:03:22 -!- Irssi: 6) -server freenode 23 59 04 11 * /topic #labka Labka.cz : Hackerspace Ostrava : remember remember the 5th of november 01:03:22 -!- Irssi: 7) -server freenode * * 23 6 * /topic #labka Labka.cz : Hackerspace Ostrava : Happy Birthday Alan Turing & Johannes Gutenberg 01:03:22 -!- Irssi: End of List
ToDo
- find a way how to query day events based on date and potentially Google Doodle
IRSII
Notes [to remove and so]
- add complete dependences to git for easy deploy
- write parser for IDOS
Wiky parser
deploy this according Pasky howto
20:00:25 < pasky_> jo, http://rover.ms.mff.cuni.cz/~pasky/rss/
20:00:53 < pasky_> konkr. ./rssfeed.sh ./rssfeed-brmlab.pl brmwiki brmlab.cz \#brmlab 1 http://brmlab.cz/feed.php?view=pages http://soup.brmlab.cz/rss/original »brmwiki.log 2>&1 &
JendaBot
Exectute command PERL
- by Veverak, Base48 : https://bpaste.net/show/e1143148fbbb
my $sourcedir = dirname(__FILE__)."/foh"; { local $CWD = $sourcedir; my @CMD = ("fop", "-c", "fop-config.xml", "-xml", $xml,"-xsl", "report-pdf.xsl", "-pdf", $pdf); my $string = join(' ', @CMD); $RT::Logger->debug("Executing command: ", $string ); my ($err, $out); IPC::Run::run( \@CMD, '>', \$out, '2>', \$err ); my @lines = split /\n/, $out; foreach my $line (@lines) { $RT::Logger->info("FOP STDOUT: ".$line); } my @erlines = split /\n/, $err; foreach my $erline (@erlines) { $RT::Logger->warning("FOP STDERR: ".$erline); } if ( $? == -1 ) { $m->out("command failed: $!\n"); return (0, "", ""); } else { if( $? >> 8 != 0 ) { $m->out("command exited with value ", $? >> 8); return (0, "", ""); } } }
Usefull commands on freenode.net
* http://little418.com/2012/01/adding-ops-to-your-new-freenode-channel.html
## identify registered nick /msg NickServ identify PWD ## give nick OP ad hoc on channel /msg ChanServ OP #CHaNNel NICK
* http://little418.com/2012/01/adding-ops-to-your-new-freenode-channel.html
## give nic op and auto-op /msg chanserv flags #CHANnEL NICK +Oo ## list flags of channel /msg chanserv flags #CHANnEL
## allow external messages to channel, use when configuring GitHub bot [repo, settings, webHooks] /msg ChanServ set #CHANNELNAME mlock -nc
screen
screen -U #to understand UTF-8 create new window C-a c change to last-visited active window C-a C-a (commonly used to flip-flop between two windows)
cpan / cpanm
* install cpanm
curl -L http://cpanmin.us | perl - --sudo App::cpanminus cpanm Hailo.pm
channel modes
/msg ChanServ set #CHANNELNAME mlock -nc