collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Updated Quotes Module  (Read 6445 times)

0 Members and 1 Guest are viewing this topic.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Updated Quotes Module
« on: July 24, 2006, 09:44:04 pm »
I took Sabkor's Quotes module, 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

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

  • Added Automatic Quote "spam" feature. Will output a random quote to gc|pgroup|both on a set interval if enabled.
  • Changed VARCHAR to TEXT to facilitate searching of quotes
  • Added process_command() to remove redundant code.
  • Added load_settings, change_setting, show_settings to deal with settings related to quote spam.
  • Added cron(), and connect() functions to enable quote spam feature.
  • Modified add_quote() function to use addslashes() instead of str_replace() when inserting into database.
  • Added a FULLTEXT MySQL index to assist with searching the Quotes table.
  • Added upgrade_table() to automatically add the FULLTEXT index to users of previous module versions.
  • Added search_quotes() function that searches the quotes table.

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.
« Last Edit: October 31, 2006, 01:26:51 am by Glarawyn »

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
« Last Edit: July 24, 2006, 11:03:16 pm by jjones666 »

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #2 on: July 25, 2006, 04:30:55 am »
Whoops, thanks :D

Offline Pharexys

  • BeBot Apprentice
  • ***
  • Posts: 117
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #3 on: August 03, 2006, 05:01:30 pm »
good job :D

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #4 on: October 30, 2006, 07:48:48 pm »
Updated to add searching of the quotes table.

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #5 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-

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #6 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.

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #7 on: October 31, 2006, 12:18:34 am »
Fixed, thanks for support (DB engine type was wrong)!

Cheers,

-jj-

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #8 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.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #9 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.)

Offline ghostimage

  • BeBot Rookie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #10 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

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #11 on: January 16, 2007, 10:53:32 pm »
Nice tip, thank you :-)

-jj-

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #12 on: January 17, 2007, 01:49:06 am »
Converted module to use Glara's new module settings plugin for all settings options.

No other changes.

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

-jj-

Offline Ozball

  • BeBot Rookie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Updated Quotes Module
« Reply #13 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?
Slynthia - General and Botmaster of Terminal Velocity - RK1

Offline Malosar

  • BeBot Expert
  • ****
  • Posts: 259
  • Karma: +0/-0
    • http://www.lowerdimension.com
Re: Updated Quotes Module
« Reply #14 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.
Eternalist
General of The Syndicate

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 703
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal