I finished a initial version of a bot_log.module.

What it does:
* logs everything to {bot_log}
* displays logs at bot/page.
* Filter logs display by channel and page (no UI for this yet, it's bot/page/channel/pagenumber)
* AND it implements the 'seen foo' command:
- matches 'seen foo' and respond with the last message sent by foo.
- phrases like "seen foo? seen bar" or "hey bot, when have you seen foo? I'd really like to know this" work all.
- Does NOT react to all sentences that have 'seen' in it.
- Does only react if either the 'seen foo' is followed by a questionmark or if the message is ending after the construct

It's living in my sandbox atm: http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/frando/bot_log/

But of course you can just include it to the main bot if you want. If time permits, I'll add some more stuff to it, e.g. a better "Browse logs" page and some settings.

and hey,
this whole bot idea is really amazing ;)

Comments

Frando’s picture

Lots of updates:
- added theme function for log page
- added stylesheet for log page
- added ability to filter logs by channel and date
- added correct pager implentation
- improved regex for 'seen ..' irc command
- added settings form
- added search function

Code ist in my sandbox. http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/frando/bot_log/

morbus iff’s picture

This will be the next thing I integrate into the bot package - thanks for your work on it!

ChrisKennedy’s picture

Glad to see this has already been implemented :).

The one thing I see missing is an expiration date for entries so that the database is eventually pruned. This would be a settings entry and hook_cron() implementation to remove expired log entries. This value could be set to a week or two by default, and could also have an unlimited or "don't prune" option.

Frando’s picture

I updated the code in my sandbox significantly yesterday evening.

bot_log.module now
* logs channel messages, queries to the bot, actions, joins, parts, kicks and topic changes
* provides a log page
* all logs are searchable (via the normal search interface)
* in the settings, you can set up which channels and which types of messages shall be logged
* in the settings, you can specify a period of time after which log entries that are older should be deleted (via cron run)

Everything is working for me so far, but still, this is beta code - it could need some more testing..

Frando’s picture

Oh, and it needs a patch to bot.module to be able to log the bot's responses: http://drupal.org/node/105923

The "seen" command was removed for now. I'll make a seperate module out of this, but it will use the bot_log database table for it.

NeoID’s picture

Version: » 5.x-1.x-dev
Category: task » feature

Would be cool to use ajax with this module and get the same "fade" effect on new messages as most shoutboxes have :)
Anyway, a great and usefull module...

morbus iff’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.