egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

add text to database from text on irc

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Sat Jul 28, 2012 8:30 am    Post subject: add text to database from text on irc Reply with quote

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
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 28, 2012 11:52 am    Post subject: Reply with quote

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
View user's profile Send private message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Sat Jul 28, 2012 1:50 pm    Post subject: Reply with quote

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 Smile
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Back to top
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 28, 2012 2:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Sat Jul 28, 2012 2:05 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jul 28, 2012 3:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber