Development > Coding and development discussion

Function to cleanup Raidbot Roster

(1/1)

Khalem:
This is just a quick and dirty function i wrote to cleanup the roster on a raidbot. It can be improved as you currently have to depend on the echo from the whois function in the bot output to catch some deleted characters (this can be automated now of course, but i just needed a quick way)

It also populates the Whoiscache with all members as a side effect

--- Code: ---<?php
        function update_whois($name)
        {
                $result = $this -> bot -> db -> select("SELECT id, nickname FROM members");
                for ($i = 0; $i < count($result); $i++)
                {
                        $oldid = $result[$i][0];
                        $oldname = $result[$i][1];
                        $tempid = $this -> bot -> aoc -> get_uid ($oldname);

                        if ($tempid != $oldid )
                        {
                                $this -> bot -> send_tell($name, "$oldname ($oldid) seems to have been rerolled to $tempid");
                        }
                        else
                        {
                               $this -> bot -> whois($oldname);
                        }
                }
        }
?>

--- End code ---

Navigation

[0] Message Index

Go to full version