| View previous topic :: View next topic |
| Author |
Message |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Sat Jul 28, 2012 8:30 am Post subject: add text to database from text on irc |
|
|
Hey!
How do i get tcl to add specific text to database if it has i unique ending
Note: there is no trigger "!"
like :
| Code: | some.text.here-endning1
some.text.here-endning2 |
_________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Jul 28, 2012 11:52 am Post subject: |
|
|
I'll try my best to interpret your query, but to be honest, I'm not even sure I'm remotely close to what you are really asking about...
1). You'd like some action to be triggered if a spoken line of text (in a channel or private msg?) ends with a certain word?
2). You'd like some action to be triggered if a spoken line of text (in a channel or private msg?), whose last word is not yet present in some kind of database;
2:a). An SQL-database such as MySQL, PostgreSQL, MSQL, etc.
2:b). A simple Tcl-list or dict.
2:c). A textfile on the filesystem (using some format like csv).
3). ?? _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Sat Jul 28, 2012 1:50 pm Post subject: |
|
|
1). You'd like some action to be triggered if a spoken line of text (in a channel or private msg?) ends with a certain word?
- Channel
2). You'd like some action to be triggered if a spoken line of text (in a channel or private msg?), whose last word is not yet present in some kind of database :
- Yes action on the ending off a text like : -html / -php (just example)
2:a). An SQL-database such as MySQL, PostgreSQL, MSQL, etc.
- Mysql (have mysqltcl
2:b). A simple Tcl-list or dict.
- What ? dont understand
I have replied to the questions as good as i could  _________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Jul 28, 2012 2:01 pm Post subject: |
|
|
So it's interpretaton 2:a then...
Use the pubm-binding to catch all channel chatter.
Extract the last word; possibly using split/lindex or regexp patterns?
Build an SQL-query using this word somewhat similar to this:
| Code: | | set query "SELECT COUNT(*) FROM `database`.`table` WHERE `table`.`field` = '[mysql::escape $varHoldingTheWord]'" |
Execute the query and fetch the result.
If the result is larger then 0, there is atleast one match already present in the database, otherwise there was no matches. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Sat Jul 28, 2012 2:05 pm Post subject: |
|
|
Thanks for the reply!
Well you almost right (or i miss guided you, sorry)
The text thats written on channel should be stored in database, with a giving ending from a switch or some kind...
hope this clear it a little better _________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Jul 28, 2012 3:22 pm Post subject: |
|
|
Thus, if the result mentioned in my previous post is 0, issue a new SQL-query with an INSERT command.
But honestly, given the number of posts/threads regarding mysql queries, I figured you had that part covered already. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|