Welcome to Rumpy
Our goal is 'DO NOT REINVENT THE WHEEL'.
Forget about xmpp-related things. Just set your login and password.
Forget about database-related things. Just set your database preferences.
Write logic using ActiveRecord and callback functions.
Rumpy uses 3 configs:
Your bot's database preferences.
Your bot's responces. Append to existing keys more answers and use them like
@lang['someanswer']. There MUST be at least 3 keys:
hello(used when somebody adds bot),
stranger(used when somebody trying to speak with bot without authorization) and
authorized(used when bot gets authorization).
Your bot's jabber account settings.
Look at Examples section to see this configs.
Implement your ActiveRecord models. You have to implement at least one model, for users.
Prepare your database
Your bot's class
You have to mix in your bot's class the
Rumpy uses next instance variables:
Array of your models files.
Path to directory, containing all ruby config files. Default is
Symbol, that stands for main model. For example, if your main model is
User, you have to set
:user. Default is
Location of the file to which pid of detached process will be saved. Default is
NameOfYourBotClass.downcase + '.pid'.
Location of the logfile. Default is
Logging severity threshold. Possible values are the same the logger from standard library has. Default is
Number of old log files to keep, or frequency of rotation (daily, weekly or monthly). Default is
Maximum logfile size. Default is
If you need more accuracy in configuring logger, simply create one. It have to be compatible with standard library's
Name of the bot. Default is name of bot's class.
Optional version of the bot. Default is
Rumpy needs only three methods:
backend_func() -> [[receiver, message]*]
This optional method is running all the time in the loop. Returns array of pairs
parser_func(msg) -> pars_result
This method parses any incoming message and returs results of parsing.
do_func(usermodel, pars_results) -> msg
This method uses results from
parser_func, doing some stuff with model of user, from whom the message was received. Returns the answer to this user.
Hint: empty answer will not be sent.
You can run your bot without detaching:
Or with detaching:
bot = YourBotClassName.new #To start your bot: . bot #To stop it: . bot
Feel free to contact us about any questions related to
Rumpy is released under the MIT license.