This is an old revision of the document!


Project to upgrade IRC bot

Project owner: Overdrive
Interested: peterbay, dave@page
Related: Best IRC Logs
License: Uveďte původ-Zachovejte licenci CC BY-SA

secretary.jpg

  • 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
# 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]

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 &

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, "", "");
        }
    }
}

* http://little418.com/2012/01/adding-ops-to-your-new-freenode-channel.html

 /msg NickServ identify pwd
 /msg ChanServ OP #chan­nel nick
 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)
 

* install cpanm

 curl -L http://cpanmin.us | perl - --sudo App::cpanminus
 cpanm Hailo.pm
 
/msg ChanServ set #CHANNELNAME mlock -nc
  • project/irc/secretary.1478439518.txt.gz
  • Last modified: 2016/11/06 14:38
  • by over23