BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: Glarawyn on March 07, 2006, 06:27:47 am

Title: Guildbot/Raidbot Message of the Day
Post by: Glarawyn on March 07, 2006, 06:27:47 am
Found myself in need of a Message of the Day.  ;D

Glara-MOTD-1.0.2.zip (http://zibby.isa-geek.net/bebot/Glara-MOTD-1.0.2.zip)

Features:




Usage:

motd
Display MOTD

motd add <message>
Adds message to MOTD with default expire time (7 days)

motd add <num>(h|d|w|m) <message>
Adds <message> to MOTD. Message will expire in <num>(Hours|Days|Weeks|Months)
For the sake of simplicity 1 month = 30 days. Cope.

motd add never <message>
Adds <message> to MOTD. Message will never expire.
(Actually, the message will expire on Sun, 07 Feb 2106 06:28:15 GMT. If this code is stil in use on this date, I'll fix it at the age of 125, and I'll be damn happy to do so.)

motd edit
Displays the MOTD with click links to delete MOTD messages.
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Alreadythere on March 07, 2006, 10:26:09 am
Sounds nice, got to test it!
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Glarawyn on March 09, 2006, 06:40:55 am
Decided I didn't like the output, so I changed it. New version bump. :)
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Glarawyn on March 09, 2006, 07:34:21 am
Found a little bug that made the bot spam the motd to all online org members when it started. Fixed.

Also changed the way the full MOTD in the text window is sorted.
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Alreadythere on March 09, 2006, 10:30:59 am
Two comments:

You should add an is_member check in the buddy function, or the MOTD gets spammed to all people showing up on the buddy list, even if they are there only for an !is check (haven't gotten around to test it, but pretty sure that's the way it works).

And instead of selecting all MOTD entries in the cleanup function, you could just add a
Code: [Select]
" WHERE expiretime <= " . time() to the select, would save the if running over all entries.
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Ainen on March 31, 2006, 04:13:13 pm
You should add an is_member check in the buddy function, or the MOTD gets spammed to all people showing up on the buddy list, even if they are there only for an !is check (haven't gotten around to test it, but pretty sure that's the way it works).

I can confirm this happens. Got a complaint from someone about my bot spamming them with tells and checking the logs found the !is and !whois commands and the tell => out for the MOTD. Not sure if it's a MOTD problem or the temp add to buddylist that should be blamed.
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Glarawyn on April 03, 2006, 05:01:08 pm
I can confirm this happens. Got a complaint from someone about my bot spamming them with tells and checking the logs found the !is and !whois commands and the tell => out for the MOTD. Not sure if it's a MOTD problem or the temp add to buddylist that should be blamed.

As Alreadythere said, I need to add a member check in the buddy sign on/off function so the MOTD doesn't get sent to non members who get added to the buddy list. I just haven't had time. :)
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Ainen on April 04, 2006, 10:29:46 pm
I guess what I was trying to say was "Should the issue be handled in the MOTD module, or should it really be looked at as an issue with commands like is and whois actually adding and removing people to the bot's buddy list when they are processing?".
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Tsuyoi on April 07, 2006, 08:15:42 pm
I don't know if it's standard practice for everyone else, but I wrapped "if (!empty($result))" around the cleanup's foreach loop to prevent spamming of MYSQL errors if the table is empty.  Not a huge problem, just a OCD type thing really :)

- Tsuyoi
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Naturalistic on April 08, 2006, 04:58:09 pm
Generally, you're always suppose to check if the data coming from the database is empty :p
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Zacix on April 10, 2006, 10:45:09 am
Generally, you're always suppose to check if the data coming from the database is empty :p
Generally any variable that receives it's value from another function should be checked if it has the correct value, not just database values ;)
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Tsuyoi on April 10, 2006, 06:24:21 pm
Eh, I was just noting that apparently it's not common practice around here, as I've had to correct this several times...
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Jarras on April 20, 2006, 03:48:49 pm
Added the is_member check.
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Pharexys on April 24, 2006, 12:28:22 pm
Added the is_member check.

nice thanks :P
Title: Re: Guildbot/Raidbot Message of the Day
Post by: neongen on May 15, 2006, 02:08:38 pm
i'm new to host bebot. but think it's going oki  ;D

but i get this all the time ???

Warning: Invalid argument supplied for foreach() in C:\BeBot\modules\MOTD.php on line 493

and that line looks like this

foreach ($result as $motd)

what do i do to stop that Warning ???
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Wolfbiter on May 15, 2006, 03:08:32 pm
Eh, I was just noting that apparently it's not common practice around here, as I've had to correct this several times...

We're (well, bebot) is hobbycoding, thus we take the shortest way from start to finish, checks just take extra time to write ;)
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Xenixa on May 16, 2006, 06:29:28 am
i'm new to host bebot. but think it's going oki  ;D

but i get this all the time ???

Warning: Invalid argument supplied for foreach() in C:\BeBot\modules\MOTD.php on line 493

and that line looks like this

foreach ($result as $motd)

what do i do to stop that Warning ???

Another result of an Empty variable not being checked. Replace the function motd_cleanup() with the following:
Code: [Select]
function motd_cleanup()
    {
        $result = $this -> bot -> db -> select("SELECT id,expiretime FROM motd");
        if (!empty($result)) {
        foreach ($result as $motd) {
            if ($motd[1]-time() <= 0)
            {
                $this -> bot -> db -> query("DELETE FROM motd WHERE id = " . $motd[0] );
                $this -> bot -> log("CRON", "MOTD", "MOTD Item " . $motd[0] . "  removed.");
            }
        }
        }
    }
Title: Re: Guildbot/Raidbot Message of the Day
Post by: neongen on May 18, 2006, 04:03:24 pm
thx that help  :)
Title: Re: Guildbot/Raidbot Message of the Day
Post by: eracet1 on June 11, 2006, 12:54:53 pm
I may of missed it, not very good at coding .
Is there a way to set frequency of how often MOTD sends out the message, such as every 2 min etc.
Title: Re: Guildbot/Raidbot Message of the Day
Post by: Glarawyn on June 12, 2006, 05:15:22 pm
I may of missed it, not very good at coding .
Is there a way to set frequency of how often MOTD sends out the message, such as every 2 min etc.


Nope. The message is sent on logon (in guild mode) or when a user joins the private group (in raid bot mode).
SimplePortal 2.3.7 © 2008-2025, SimplePortal