MySQL Live Status 1.00 STABLE (MBC Base)

By Noutrious on Sep 08, 2011


This is a module for MySQL Bot Core system.
You'll need in case for this to work.

PHP Side for this script:

MySQL Database Structure:

CREATE TABLE `chanstatus` (
  `channel` varchar(50) NOT NULL,
  `nickname` varchar(50) NOT NULL,
  `status` tinyint(6) unsigned NOT NULL,
  `idle` smallint(5) unsigned NOT NULL,
  `address` varchar(100) NOT NULL,
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
; MySQL Bot Core
; Module: Live Status
; Version: 1.00 STABLE
; Author: Nils Putnins (

; - aliases
alias -l m.activity.status return $replace($left($nick($1,$2).pnick,1),~,5,&,4,@,3,$chr(37),2,+,1)
alias -l m.activity {
  if ($prop == sync) {
    var %sql = DELETE FROM `chanstatus` | noop $mysql_query(%m.sql, %sql)
    var %sql = INSERT INTO `chanstatus` (`channel`,`nickname`,`status`,`idle`,`address`) VALUES (?, ?, ?, ?, ?)
    var %channels = $chan(0)
    while %channels {
      var %channel = $chan(%channels), %users = $nick(%channel,0)
      while %users {
        var %user = $nick(%channel,%users)
        noop $mysql_query(%m.sql, %sql, %channel, %user, $m.activity.status(%channel,%user), $nick(%channel,%user).idle, $remove($address(%user,0),*!))
        dec %users
      dec %channels

; - communicating with core
on *:SIGNAL:m.modules:{
  m.modules $+(Live Status,$chr(124),$chr(124),0)
  noop $m.activity().sync


Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.