| View previous topic :: View next topic |
| Author |
Message |
tomkay1985 Voice
Joined: 13 Oct 2014 Posts: 2
|
Posted: Mon Oct 13, 2014 11:21 am Post subject: Need a eggdrop-script for parsing lines from IRC |
|
|
Hello, dear community!
Since I am not the born programmer, but able to adapt things once I learned them by an example. I am looking for some help in coding a script.
This script should always react, if a specific person in the channel writes a specific word. Then from the same line of this word, i need to extract some data and then write this information in my database which already exists.
Is there any script available already which is able to parse bascially like what I need?
Thanks
Tom |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Thu Oct 16, 2014 9:03 pm Post subject: Re: Need a eggdrop-script for parsing lines from IRC |
|
|
| tomkay1985 wrote: |
Since I am not the born programmer, but able to adapt things once I learned them by an example. I am looking for some help in coding a script.
This script should always react, if a specific person in the channel writes a specific word.
|
| Code: |
# October 16, 2014
# http://forum.egghelp.org/viewtopic.php?t=19807
bind pubm - "#eggdrop *testword*" watch_word
proc watch_word {nick uhost handle chan text} {
if {"$nick" eq "some_nick_here"} {
putserv "privmsg $chan :$text"
}
}
|
Play around with this. It is just for demonstration. Perhaps you can
glean something from it.
You need to edit the channel name, the text to watch for (in this example: *testword*) and the nick to watch for (in this example: some_nick_here )
It will watch one channel, for posts that contain the text you configure.
If a post contains that text, and if it is from the nick you configure, it will then simply repeat the post that contained that text.
Reference:
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html
and text search it for:
bind pubm
and read the short description there.
For general TCL commands, reference:
http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm
You can find the
if
command there.
This is a very simple example script. I hope it strikes you as such.
The point: It is worth your time to learn some basic TCL scripting for Eggdrops.
This:
http://suninet.the-demon.de/
is a nice little course that you might like to do.
It really helps to get you off the ground.
| Quote: |
Then from the same line of this word, i need to extract some data and then write this information in my database which already exists.
Is there any script available already which is able to parse bascially like what I need?
|
Don't know. Need more info from you. The script above will detect posts that you want. After that, you would have to clarify what "some data" is, and you would have to describe this database if we are to proceed further.
I hope this helps.
Do spend some time perusing the links that I've given you. They really help. |
|
| Back to top |
|
 |
tomkay1985 Voice
Joined: 13 Oct 2014 Posts: 2
|
Posted: Fri Oct 24, 2014 10:48 am Post subject: |
|
|
Hi willyw,
Thanks for your reply and your ideas. I now went a different way and created a webcrawler with PHP which simulates an IRC-user, joins the channel and listens to a specific user.
This works quite well so far and I also could directly establish connection with my MySQL DB.
As I am running the script on SSH it actually works like an eggdrop script
However, the only problem I currently have is that the webinterface sometimes is not reacting, so I need to wait for the GUI to be back online and then restart my script.
The maybe 100% solution still would be with the eggdrop. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Fri Oct 24, 2014 11:01 am Post subject: |
|
|
| tomkay1985 wrote: |
Thanks for your reply and your ideas. I now went a different way and created a webcrawler with PHP which simulates an IRC-user, joins the channel and listens to a specific user.
|
That sounds very interesting.
| Quote: |
This works quite well so far and I also could directly establish connection with my MySQL DB.
|
Eggdrop bots can work with mysql too, although I have never pursued it myself.
| Quote: |
... so I need to wait for the GUI to be back online and then restart my script.
The maybe 100% solution still would be with the eggdrop. |
Perhaps.
With a shell script run by crontab, eggdrop can restart automatically, if found to be not running.
Let us know how it goes, and if you need anything.
Best of luck with it. |
|
| Back to top |
|
 |
dutch1918 Voice
Joined: 30 Jul 2014 Posts: 14
|
Posted: Fri Oct 24, 2014 11:31 am Post subject: |
|
|
| I would be interested in a shell script run by crontab and have it ping the bot say every 5 mins and if no response restart the bot |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Fri Oct 24, 2014 12:00 pm Post subject: |
|
|
| dutch1918 wrote: |
...
I would be interested in a shell script run by crontab and have it ping the bot say every 5 mins and if no response restart the bot |
http://www.egghelp.org/setup.htm#botchk
I always just use autobotchk to set it up for me. Works great.
Let us know how you get along with this. |
|
| Back to top |
|
 |
dutch1918 Voice
Joined: 30 Jul 2014 Posts: 14
|
Posted: Fri Oct 24, 2014 6:10 pm Post subject: |
|
|
| yeah I already know about that one however, that only works to automatically restart the bot if the shell it's on reboots or if the bot process is killed for some other reason. I need one that will ping the bot and if no response kill the process and restart the bot. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat Oct 25, 2014 9:27 am Post subject: |
|
|
| dutch1918 wrote: |
....I need one that will ping the bot and if no response kill the process and restart the bot. |
Ah. Ok.
You already have a thread somewhere about this. I didn't realize you were asking for the same thing. |
|
| Back to top |
|
 |
|