This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Need a eggdrop-script for parsing lines from IRC

Help for those learning Tcl or writing their own scripts.
Post Reply
t
tomkay1985
Voice
Posts: 2
Joined: Mon Oct 13, 2014 11:19 am

Need a eggdrop-script for parsing lines from IRC

Post by tomkay1985 »

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
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: Need a eggdrop-script for parsing lines from IRC

Post by willyw »

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: Select all

# 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 ... mands.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.
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.
t
tomkay1985
Voice
Posts: 2
Joined: Mon Oct 13, 2014 11:19 am

Post by tomkay1985 »

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.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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.
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.
... 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.
d
dutch1918
Voice
Posts: 14
Joined: Wed Jul 30, 2014 10:30 am

Post by dutch1918 »

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
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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.
d
dutch1918
Voice
Posts: 14
Joined: Wed Jul 30, 2014 10:30 am

Post by dutch1918 »

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.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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.
Post Reply