Cross-server successor of ruibot - IRC bot.
To configure and start this bot:
- Copy
servers.sample.yamltoservers.yamland enter valid config there (see below) - Configure cmdchar on
cmd/core.rb
This bot is cross-server. So each root entry in this file - hash which describes how to connect to server.
Required options:
enabled- iffalse, launcher will not start bot for this server.host- address of serverport- port of serveruser- your usernamenick- your nicknamepass- your password (do not provide if no pass)use_pass- disable if you are not using passautoowner- this will make entered hostmask owner while generating databaseautojoin- bot will autojoin channels in this array
Sample config:
freenode:
enabled: true
host: irc.freenode.net
port: 6667
user: ruibot
nick: PhotonBot
rname: Yet another bot. Written in ruby. Now multiservered and multithreaded.
pass: <hidden>
use_pass: true
autojoin:
- "#PhotonBot"
autoowner: "unaffiliated/handicraftsman"- To add new command, use
oncmd(/regex/, delay, perm) do |m, data| ... end #.delayis optional argument. Default value -0(in seconds). Use it when you need to set delay for command. Same withperm(sets permission-level for command), but to use it you should also providedelayargument. - To add help entry, use
CmdHelp.new "part", "name", "syntax", "description" - Don't forget to load all your command-files in
/cmd/loader.rb
You always have access to all databases:
- To access server-native database, use
$dbs[m.bot.name] - To access other database, use
$dbs["servername"]More help about DB-access can be found here
m has next properties:
bot- bot-class of this messagesender_raw- raw sender-name. Looks likenick!user@hosttarget- message target. It is channel-name or your nickname (if it's PM)nick- sender's nicknameuser- sender's usernamehost- sender's hostnamesendto- if message was sent to channel, it is channel name. If it's PM - sender's nickname.mhas next methods:reply(msg)- replies to sender with given message
More info about data can be found here
:name, :user, :nick, :rname, :pass, :use_pass, :host, :port, :autojoin, :autoowner
m.bot has next properties:
name- name of current serveruser- bot's usernamenick- bot's nicknamername- bot's realnamepass- bot's passworduse_pass- is password enabled?host- server-addressport- server-portautojoin- array of channels which bot will join when connectedautoowner- read abovem.bothas next methods:write(raw)- writes given message directly to socketinspect- puts bot-info into string and returns it