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 July 24, 2006, 09:44:04 pm

Title: Updated Quotes Module
Post by: Glarawyn on July 24, 2006, 09:44:04 pm
I took Sabkor's Quotes module (http://bebot.link/index.php/topic,247.0.html), and implemeted most (if not all, I don't remember) of the fixes mentioned, plus added some extra functionality.

Download: Quotes_1.5.1.zip (http://zibby.isa-geek.net/bebot/Quotes/Quotes_1.5.1.zip)

Also I made some other changes and added some functionality. :)


To configure the quote spammer, /tell yourbot !quotes set. Everything can be configured through the settings window.

To search the quotes, just do !quotes <search string>. If there is only one result, the quote will just be displayed. If there are multiple results, you will get a text window with the results and a 72 character preview of the quote.
Title: Re: Updated Quotes Module
Post by: jjones666 on July 24, 2006, 11:01:05 pm
http://zibby.isa-geek.net/bebot/Quotes/Quotes_1.0.1.zip

-jj-
Title: Re: Updated Quotes Module
Post by: Glarawyn on July 25, 2006, 04:30:55 am
Whoops, thanks :D
Title: Re: Updated Quotes Module
Post by: Pharexys on August 03, 2006, 05:01:30 pm
good job :D
Title: Re: Updated Quotes Module
Post by: Glarawyn on October 30, 2006, 07:48:48 pm
Updated to add searching of the quotes table.
Title: Re: Updated Quotes Module
Post by: jjones666 on October 30, 2006, 11:04:23 pm
Have following error:-

ERROR 1214 (HY000): The used table type doesn't support FULLTEXT indexes

id(int,11,not null)
quote(text,null)
contributor(varchar(15),null)

Cheers,

-jj-
Title: Re: Updated Quotes Module
Post by: Glarawyn on October 30, 2006, 11:32:32 pm
Have following error:-

ERROR 1214 (HY000): The used table type doesn't support FULLTEXT indexes


Do you have MySQL configured to use a storage engine besides MyISAM by default? That's the only cause I can come up with unless you're running a version of earlier than 3.23.23. :)

You could try:
mysqldump -u user -p dbname --tables quotes > quotes-backup.sql
(Always backup your data when you're about to do something that could destroy your data.)
ALTER TABLE quotes ENGINE = MYISAM;
ALTER TABLE quotes ADD FULLTEXT(quote,contributor);

Otherwise around L253 you can find where I'm switching between doing a LIKE query (for a search term of 1 to 3 characters.) and a FULLTEXT search. If you remove the FULLTEXT search SQL you can stick to just a LIKE query, but you'll loose the flexibility and reverence sorting that comes with a FULLTEXT index search.
Title: Re: Updated Quotes Module
Post by: jjones666 on October 31, 2006, 12:18:34 am
Fixed, thanks for support (DB engine type was wrong)!

Cheers,

-jj-
Title: Re: Updated Quotes Module
Post by: Glarawyn on October 31, 2006, 01:27:54 am
Updated again. Found and fixed a typo, also changed full text searching to bolean mode. You can now (optionally) use the boolean operators from http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html in your searches.
Title: Re: Updated Quotes Module
Post by: Glarawyn on November 01, 2006, 10:46:01 pm
Forgot to mention that you can also show only the quotes submitted by a character by doing !quotes by <character> (!quotes by Glarawyn.)
Title: Re: Updated Quotes Module
Post by: ghostimage on January 16, 2007, 10:58:54 am
Even with the table set correctly to MyISAM I still got the same error as JJ. To fix this issue in a default installation of MySQL 5 on the MS Windows OS you need to go to:

c:\program files\mysql\mysql server 5.0\    and edit the my.ini file and change the line:

"default-storage-engine=innodb"
to
"default-storage-engine=myisam"

Then restart the mysql service.

Cheers  :D
Title: Re: Updated Quotes Module
Post by: jjones666 on January 16, 2007, 10:53:32 pm
Nice tip, thank you :-)

-jj-
Title: Re: Updated Quotes Module
Post by: jjones666 on January 17, 2007, 01:49:06 am
Converted module to use Glara's new module settings plugin (http://bebot.link/index.php/topic,607.0.html) for all settings options.

No other changes.

http://www.jjones.co.uk/files/quotes.php

-jj-
Title: Re: Updated Quotes Module
Post by: Ozball on February 27, 2007, 04:00:24 pm
Getting

Fatal error: Cannot use string offset as an array in F:\Tvbot\Bebot_v0.2.11\modules\quotes.php on line 210

Any ideas?
Title: Re: Updated Quotes Module
Post by: Malosar on February 27, 2007, 08:55:30 pm
You might get that in php5 if you don't have any quotes in your db. If you don't, add one then try.
Title: Re: Updated Quotes Module
Post by: Glarawyn on February 27, 2007, 09:14:07 pm
You might get that in php5 if you don't have any quotes in your db. If you don't, add one then try.

Looking at the code, the only way you could get this message is if you tried to delete a quote when you had no quotes in the database.

Possible Fix: Replace Lines 206-210 with the following code:
Code: [Select]
} else {
         $res = $this -> bot -> db -> select("SELECT id FROM quotes ORDER BY id DESC");
         if (empty($res))
         {
             $out = " No quotes exisit in the database.";
         }
         else
         {
             $out = " (Highest quote ID is " . $res[0][0] . ".)";
         }
         $reply = "Quote with id of " . $qnum . " not found. (Highest quote ID is " . $out . ".)";
      }
Title: Re: Updated Quotes Module
Post by: Malosar on February 27, 2007, 10:14:44 pm
If he was using your original quotes module yes. But I assumed he was referring to JJ's updated version posted just before, which 210 refers to this section:

Code: [Select]
function send_quote($qnum)
{
$strquote = "";
if($qnum == -1)
{
$num = $this -> bot -> db -> select("SELECT id FROM quotes ORDER BY id DESC");
$result = $this -> bot -> db -> select("SELECT * FROM quotes");
           
if($num[0][0] > 0) <--- line 210
Title: Re: Updated Quotes Module
Post by: jjones666 on February 27, 2007, 10:37:15 pm
Yah, i'd suspect its due to auto spam being turned on by default and no quotes in db with php5.

-jj-
Title: Re: Updated Quotes Module
Post by: Ozball on February 28, 2007, 03:13:53 am
I'll try it again but i thought I'd turned autospam off (it was the first thing i thought might be a problem).

and yes it was the updated one from JJ


EDIT: Ok tested it seems to be that it is the no quotes in the DB problem. But tried useing !settings quotes auto off (using the page from !settings quotes) to turn off the spam... and it continued to spam.
Title: Re: Updated Quotes Module
Post by: jjones666 on February 28, 2007, 08:05:04 am
Try changing line 210 from:
if($num[0][0] > 0)
To:
if (!empty($num))

This SHOULD fix the string offset crash (PHP5 h8).

I tried the !settings and it works perfectly fine here - please make sure you are using the last Module Settings plugin (2.03) at the following link:

http://bebot.link/index.php/topic,607.0.html

Please let me know outcome and I'll update the plugin after work.  I'll also set it to default to spam off for new users.

Cheers,

-jj-
Title: Re: Updated Quotes Module
Post by: Ozball on March 10, 2007, 09:07:25 pm
Sorry for the late reply.

Also I'm using the lates Settings module. When I put the quotes module back in (took out the _) the spam is set to off(probably left over from last time it was in) and is still spamming..

With the changes to the php file you suggested... I get "[Terminal Velocity] Tvbot: No quotes exist. Add some!" in org chat for the spam. and !quotes works ok (in both tells and gc).

So looks like the only problem atm is the spamming when its set to not spam.
SimplePortal 2.3.7 © 2008-2024, SimplePortal