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
-
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:
- Raidleaders and Admins can add items to the MOTD
- Admins can delete messages
- MOTD items expire and will be automatically removed
- MOTD item expire time can be set by the user.
- MOTD items can be set to never expire.
- Automatically behaves properly for guildbots and raidbots.
- If your bot is a guildbot, MOTD is sent when a buddy logs on.
- If your bot is not a guildbot, MOTD is sent when a player joins the channel.
- Only most resent MOTD item is displayed in chat.
- Other MOTD items are displayed as a click link/text window
- MOTD link displays the time of the most recent MOTD update
- I included a helpfile!
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.
-
Sounds nice, got to test it!
-
Decided I didn't like the output, so I changed it. New version bump. :)
-
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.
-
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 " WHERE expiretime <= " . time()
to the select, would save the if running over all entries.
-
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.
-
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. :)
-
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?".
-
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
-
Generally, you're always suppose to check if the data coming from the database is empty :p
-
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 ;)
-
Eh, I was just noting that apparently it's not common practice around here, as I've had to correct this several times...
-
Added the is_member check.
-
Added the is_member check.
nice thanks :P
-
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 ???
-
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 ;)
-
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:
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.");
}
}
}
}
-
thx that help :)
-
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.
-
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).