Oggi vorrei presentarvi un nuovo amico elettronico che, ogni tanto, ci farà compagnia in chat, specialmente nelle giornate di torneo e relativi sorteggi.
Il nostro amico si chiama
elvishbot e, come il nome suggerisce, è un bot IRC. In qualche modo, rappresenta il successore spirituale di Minosse, adatto anche per l'uso su network internazionali (per questo funziona in inglese) e con alcuni miglioramenti.

Il codice sorgente di elvishbot
è disponibile su GitHub, è scritto in Python e richiede il client
WeeChat per funzionare; in altre parole, ho usato WeeChat come fosse un framework. Molti dei miglioramenti rispetto a Minosse, quali l'antiflood, la possibilità di farlo entrare in più canali e il supporto alle connessioni SSL, derivano proprio dall'uso di questo client.
Il bot risponde alla sintassi
<nome bot>: <comando>; nel mio caso,
<nome bot> corrisponde a elvishbot (che ho opportunamente registrato come nick), ma per le istanze usate dagli altri utenti
<nome bot> corrisponde al nick col quale lo hanno fatto entrare nel canale - ciò evita le collisioni che si sono verificate in passato tra Raelbot e Draco, ad esempio (entrambi usavano ! come prefisso dei comandi - almeno questo ho capito leggendo i vecchi post). Questi sono i comandi attualmente supportati, e potete rivederli con il comando
elvishbot: help:
help: shows this message
about: infos about me
coin: tosses a coin
server: prints the address of the Italian server
dice <n>: throws a n-sided dice, if n is not supplied throws a six-sided dice
rps <choice>: plays a game of rock, paper, scissors (replace <choice> with one of them)
This bot can also handle two lists (each of them can contain up to 99 items), called 'A' and 'B'. These are the related commands:
list clear <optional list>: deletes the content of the supplied list; if no list is specified, deletes the content of both lists
list show: shows the content of both lists, assigning an index to each element
list add <list> <items>: adds the specified items, separated by commas, to the specified list
list remove <list> <items>: removes the specified items, separated by commas, from the specified list
list extract <list>: returns and removes one item from the specified list
list makepairs: associates each item from list A with one element from list B; both lists must have the same number of items
list makepairs <list>: if the number of items of the specified list is even, creates pairs with the elements of said list
list pair: extracts a pair of elements, picking one element from each list if both contain at least one element, otherwise picks both elements from the same list
list pop <list> <index>: removes the item matching the specified index from the specified list; to see the indexes, use the 'list show' command
Qualora ne abbiate bisogno nel canale, vi consiglio di inviarmi un messaggio privato in anticipo, in modo da potermi organizzare, visto che non sempre ho il tempo di venire in chat.

Si accettano consigli, suggerimenti, opinioni, richieste...