Supybot

Published on April 10, 2014.

Supybot é um robô para canais de IRC escrito em Python2 (ainda não é compatível com Python3). Neste post é apresentado como instalá-lo e configurá-lo.

Instalação

Debian:

# apt-get install supybot

Criação

É recomendado que você crie um usuário sem premissões administrativas para rodar o Supybot.

Crie um diretório para armazenar os arquivos do Supybot:

$ mkdir supybot

Utilize o supybot-wizard para criar os arquivos necessários (no exemplo a seguir o robô irá se conectar na rede Freenode). :

$ supybot-wizard
...
Are you an advanced Supybot user? [y/n] (default: n)
...
Where would you like to create these directories? (default: .)
...
What IRC network will you be connecting to? freenode
...
What server would you like to connect to? irc.freenode.net
...
Does this server require connection on a non-standard port? [y/n] (default: n)
...
What nick would you like your bot to use? robo
...
Do you want to set such a password? [y/n] (default: n)
...
Do you want your bot to join some channels when he connects? [y/n] (default: y)
...
What channels? (default: ) #canal-a-ser-utilizado
...
Would you like to look at plugins individually? [y/n] n
...
Would you like to add an owner user for your bot? [y/n]
(default: y)
...
What should the owner's username be? your-irc-nickname
What should the owner's password be?
Re-enter password:
...
Would you like to set the prefix char(s) for your bot? [y/n] (default: y)
...
What would you like your bot's prefix character(s) to be? !
...

Ao finalizar a criação dos arquivos você pode iniciar o robô:

$ supybot nome-do-seu-robo.conf

Provavelmente você vai querer rodar o robô em background e para isso você pode adicionar & no final do comando anterior.

Configuração

O restante da configuração do robô é feita conversando com ele pelo IRC. :

/connect freenode
/query robo

É preciso identificar-se ao robô:

00:00:00 seu-nome | identify seu-nome sua-senha
00:00:00     robo | The operation succeeded.

Para listar os plugins utilize list:

00:00:00 seu-nome | list
00:00:00     robo | Admin, Channel, Config, Misc, Owner, and User

E para listar os comandos de cada plugin utilize list nome-do-plugin:

00:00:00 seu-nome | list Admin
00:00:00     robo | capability add, capability remove, channels, ignore
                  | add, ignore list, ignore remove, join, nick, and part
00:00:00 seu-nome | list Channel
00:00:00     robo | alert, ban add, ban list, ban remove, capability add,
                  | capability list, capability remove, capability set,
                  | capability setdefault, capability unset, cycle,
                  | dehalfop, deop, devoice, disable, enable, halfop,
                  | ignore add, ignore list, ignore remove, invite, kban,
                  | key, kick, limit, lobotomy add, lobotomy list,
                  | lobotomy remove, mode, moderate, nicks, op, unban,
                  | unmoderate, and voice
00:00:00 seu-nome | list Config
00:00:00     robo | channel, config, default, export, help, list, reload,
                  | and search
00:00:00 seu-nome | list Misc
00:00:00     robo | apropos, help, last, list, more, ping, source, tell,
                  | and version
00:00:00 seu-nome | list Owner
00:00:00     robo | announce, defaultcapability, defaultplugin, disable,
                  | enable, flush, ircquote, load, log, quit, reload,
                  | rename, unload, unrename, and upkeep
00:00:00 seu-nome | list User
00:00:00     robo | capabilities, changename, hostmask, hostmask add,
                  | hostmask list, hostmask remove, identify, list,
                  | register, set password, set secure, stats, unidentify,
                  | unregister, username, and whoami

Existe vários plugins nativos que não estão sendo carregados no momento. Para carregar um desses plugins utilize load nome-do-plugin:

00:00:00 seu-nome | load Later
00:00:00     robo | The operation succeeded.
00:00:00 seu-nome | list
00:00:00     robo | Admin, Channel, Config, Later, Misc, Owner, and User

Para obter ajuda sobre algum comando utilize help comando:

00:00:00 seu-nome | help later notes
00:00:00     robo | (later notes [<nick>]) -- If <nick> is given, replies
                  | with what notes are waiting on <nick>, otherwise,
                  | replies with the nicks that have notes waiting for
                  | them.
00:00:00 seu-nome | help later remove
00:00:00     robo | (later remove <nick>) -- Removes the notes waiting on
                  | <nick>.
00:00:00 seu-nome | help later tell
00:00:00     robo | (later tell <nick> <text>) -- Tells <nick> <text> the
                  | next time <nick> is in seen. <nick> can contain
                  | wildcard characters, and the first matching nick will
                  | be given the note.

Ao terminar a configuração desfaça a identificação:

00:00:00 seu-nome | unidentify
00:00:00     robo | The operation succeeded.  If you remain recognized
                  | after giving this command, you're being recognized by
                  | hostmask, rather than by password.  You must remove
                  | whatever hostmask is causing you to be recognized in
                  | order not to be recognized.

Informações adicionais estão disponíveis no Supybot Handbook1.

Referências

Tags: