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: Quotes!  (Read 14200 times)

0 Members and 2 Guests are viewing this topic.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Quotes!
« on: July 27, 2007, 09:04:55 pm »
Module Name:
Return of the Quotes module, by Sabkor and Glarawyn!

Current Module Version:
2.0.1

Module Type:
Custom Module (Not Core)

Module Description:
We all say stupid things, and everyone wants to immortalize them.



Download:
Quotes 2.0.1

Changes from v2.0.0 to v2.0.1:
  • Fixed typo on line 363.
Changes from v1.5.0 to v2.0.0:
  • Updated for BeBot 0.4
  • Force use of MyISAM for Quotes table. (For search index)
  • Quotes table can is shared between bots.
  • Using Settings module instead of internal settings.
  • Change addslashes() to mysql_real_escape_string()
« Last Edit: August 02, 2007, 07:16:48 pm by Glarawyn »

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Quotes!
« Reply #1 on: July 27, 2007, 09:15:38 pm »
Importing your Quotes from BeBot 0.2 to BeBot 0.4

  • 1: Backup your existing quotes table:
    # mysqldump --add-drop-table <olddatabase> --tables quotes -u <username> -p > quotes.sql
  • 2: If you will be using the same database, drop your existing quotes table.
    # mysql -u <user> -p <olddatabase>
    mysql> DROP TABLE quotes;
  • 3: Start your bot with the quotes module loaded.
  • 4: Restore your quotes!
    # mysql -u <user> -p <newdatabase> < quotes.sql
  • 5: (Optional) Update the botname for your restored quotes.
    # mysql -u <user> -p <olddatabase>
    mysql> UPDATE quotes SET botname = 'Botname' WHERE botname = 'Import';

That's it, you're done.

Offline Dracutza

  • BeBot Apprentice
  • ***
  • Posts: 126
  • Karma: +0/-0
Re: Quotes!
« Reply #2 on: July 28, 2007, 03:37:46 am »
line 363...

         
Code: [Select]
$inside = "Quotes Matching ".$searchterm.": \n\n";);
should be
         
Code: [Select]
$inside = "Quotes Matching ".$searchterm.": \n\n";   ?

« Last Edit: July 28, 2007, 03:40:57 am by Dracutza »

Offline Newsworthy

  • BeBot User
  • **
  • Posts: 27
  • Karma: +0/-0
Re: Quotes!
« Reply #3 on: July 29, 2007, 12:54:37 pm »
[29-Jul-2007 20:48:58] PHP Parse error:  syntax error, unexpected ')' in C:\Bebot\custom\modules\Quotes.php on line 363

Makes me a sad panda :(

EDIT: Didn't read Dracutza's line properly. Good show old bean ;) Now works beautifully
« Last Edit: July 29, 2007, 01:17:14 pm by Newsworthy »

Offline Dracutza

  • BeBot Apprentice
  • ***
  • Posts: 126
  • Karma: +0/-0
Re: Quotes!
« Reply #4 on: July 30, 2007, 05:50:53 pm »
While I don't know what the properly function mod is supposed to do, making my edit appears to break the search function if there are 2+ quotes with the same search phrase.

For example, !search Tziganca, when there is just one quote with Tziganca, works as intended.
/tell bot !search Tziganca
bot: Blah blah Tziganca

However, when there are two quotes with Tziganca, the bot give a blank reply
/tell bot !search Tziganca
bot:

So while that edit does enable the mof to run, I don't know if it's the proper edit to make it work.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Quotes!
« Reply #5 on: July 30, 2007, 06:06:32 pm »
I haven't been able to reproduce the issue Dracutza is reporting. Updated version without the typo posted.

Offline Dracutza

  • BeBot Apprentice
  • ***
  • Posts: 126
  • Karma: +0/-0
Re: Quotes!
« Reply #6 on: July 31, 2007, 03:59:11 am »
works pretty nice, thanks

Offline Newsworthy

  • BeBot User
  • **
  • Posts: 27
  • Karma: +0/-0
Re: Quotes!
« Reply #7 on: September 02, 2007, 03:54:13 pm »
Hey, just noticed an issue that surfaced... I've deleted a few quotes from my database because they were kinda lame... But I noticed that the hole where the quote was remains empty.

This seems to screw the counting process. We have over 40 quotes, yet, it seems only recognize numbers 1-4 when searching for a quote ID. (#5 was one of the ones deleted).

Also, I'll add a quote, and it says its #41. However, when I do !quotes 41, it shows a completely different quote.

Any thoughts? :)

Offline Newsworthy

  • BeBot User
  • **
  • Posts: 27
  • Karma: +0/-0
Re: Quotes!
« Reply #8 on: September 13, 2007, 02:14:35 am »
Bump

Also, any new quotes that are added all appear as being #41.

Offline Vhab

  • Contributor
  • *******
  • Posts: 180
  • Karma: +0/-0
    • VhaBot Forum
Re: Quotes!
« Reply #9 on: September 14, 2007, 09:25:13 am »
This is because the quote numbering relies on mysql's "auto increment" feature and it simply works that way. Fixing your "issue" would require working around default features of mysql, which imo, would be somewhat of a waste.

Offline Ebag333

  • Contributor
  • *******
  • Posts: 134
  • Karma: +0/-0
Re: Quotes!
« Reply #10 on: September 14, 2007, 02:21:15 pm »
I think what he means is that since 41 is missing, all new quotes list themselves as 41.

So you have:

37
38
39

41
41
41
41

(That's just what I'm guessing he means, since I haven't played with it myself.)

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: Quotes!
« Reply #11 on: September 14, 2007, 03:27:13 pm »
41 is missing because someone deleted it, and since it uses auto increment, there wont be a 41 again.
Too many toons.

Offline Newsworthy

  • BeBot User
  • **
  • Posts: 27
  • Karma: +0/-0
Re: Quotes!
« Reply #12 on: September 14, 2007, 04:16:30 pm »
So, what can I do? Do I need to go into the database and reorder them?

Offline Blueeagle

  • Omnipotent
  • BeBot Hero
  • ******
  • Posts: 323
  • Karma: +0/-0
Re: Quotes!
« Reply #13 on: September 14, 2007, 04:23:08 pm »
How are you getting the numbers. The ID-field is set as auto-increment in the database table so it must be an error with the way you get the IDs.
The only problem that can't be solved by adding another wrapper is having too many wrappers.

Offline Blueeagle

  • Omnipotent
  • BeBot Hero
  • ******
  • Posts: 323
  • Karma: +0/-0
Re: Quotes!
« Reply #14 on: September 14, 2007, 04:27:06 pm »
Having looked at the file linked in the first post I've got a suspicion that function add_quote() might be the cause of alement.

This _might_ be fixed by

Code: [Select]
function add_quote($strquote, $name)
{ // Start function add_quote()
$strquote = mysql_real_escape_string($strquote);
$name = mysql_real_escape_string($name);
$sql = "INSERT INTO #___quotes (quote, contributor, botname) ";
$sql .= "VALUES ('".$strquote."','".$name."','".$this -> bot -> botname."')";
$this -> bot -> db -> query($sql);
    /*
$sql = "SELECT id FROM #___quotes ORDER BY id DESC";
$num = $this -> bot -> db -> select($sql);
    */
    $num = mysql_insert_id($this -> bot -> CONN);
$strmsg = "Thank you, your quote has been added as id #" . $num;
return $strmsg;         
} // End function add_quote()

Do note that I don't use this module myself and with the limited debug information this is to be concidere guesswork.
The only problem that can't be solved by adding another wrapper is having too many wrappers.

 

* 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: 523
  • 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