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.

Fully Automated Away Detection [SOLVED]

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Fully Automated Away Detection [SOLVED]

Post by holycrap »

Hi everyone,

In IRC you can set away message with "/away <message>".

For example if I set my away message then if someone mentioned my nick the bot will message the channel or notice the user whom mentioned the nick with my away message.

Something like this:

holycrap: /away I'm out.

*User1 joins.
User1: hey holycrap
Bot: holycrap is away: I'm out

And if I did not set /away status the bot will do nothing. I want everyone to be able to use this not just the bot's owner. Mainly it will work for everyone if they are set away.
Last edited by holycrap on Thu May 07, 2009 11:10 am, edited 4 times in total.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

** snipped, no longer relevant, use code provided below **
This may work, it may not. It's untested and yours to have for free. If you feel like donating money donate it to slennox. If the script doesn't work, post the problems your having. Enjoy.. ;)
<nick> hey there everybody, what's up?
<bot> There is away: Doing stuff not related at all to irc.
<nick> hello everyone in the channel!
<bot> Everyone is away: Does anyone even read these messages?
That can happen, but only if there are nicks in your channel using There and Everyone and both those nicks are away with those messages. The script replaces %nick with the wildcard symbol * when matching. The problem is if you want to match just "hey nick", as two words, this method will do that but will also match for anything using "hey nick" even "hey nick what are you doing this thursday?". Both of those will match using this script because nick is evaluated as a wildcard, and since it ends what we are checking for, it will end matching anything after it. Your asking the eggdrop to self distinguish which words are nicknames within the context of an entire sentence, which it just cannot do without being told how. This is the best approach to doing something like you desire using a check list.

Edit: Corrected problem with code, it now works.. haw. This should behave much like the AI settings within gseen module as it uses exactly the same structure:

Code: Select all

# this setting configures on which sentences your bot should
# attempt to do an ai-seen. Each of them is a simple wildcard
# mask. Set this to "" if you want to deactivate ai-seens or
# create more precise masks if the bots reacts too often.
set ai-seen-binds {
  "${nick}*seen*"
  "${botnet-nick}*seen*"
  "${nick}*gesehen*"
  "${botnet-nick}*gesehen*"
}
This script can be made to work identical, with the added checking of llength against each entry if it doesn't start or end with a wildcard (*). If you get lots of mismatches reported in channel it can be modified to add this later...
Last edited by speechles on Sun Aug 17, 2008 4:35 pm, edited 5 times in total.
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Your asking the eggdrop to self distinguish which words are nicknames within the context of an entire sentence, which it just cannot do without being told how.
Yes, that was what I was looking for.

I've seen most of your work, speechles, I know you can find a way to make this work. I would be very greatful if you can. And where do i go to donate to "slennox"?

Oh, the script didn't run, it had some errors.

Thanks for all your time!

:D
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

holycrap wrote:
Your asking the eggdrop to self distinguish which words are nicknames within the context of an entire sentence, which it just cannot do without being told how.
Yes, that was what I was looking for.

I've seen most of your work, speechles, I know you can find a way to make this work. I would be very greatful if you can. And where do i go to donate to "slennox"?

Oh, the script didn't run, it had some errors.

Thanks for all your time!

:D
What are the errors? Can't help get rid of them without knowing what they are...
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Code: Select all

[01:32] invalid command name "}"
    while executing
"} "
    (file "script1/away.tcl" line 42)
    invoked from within
"source script1/away.tcl"
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

Post by Nor7on »

change:

Code: Select all

        if {[onchan $::checknick $chan]}
to

Code: Select all

if {[onchan $::checknick $chan]} {
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Code: Select all

[02:35] missing close-brace
    while executing
"proc check:away {from key text} {
   if {![string match -nocase [lindex [split $text] 1] $::checknick] { return }
   putserv "privmsg $::checkchan :..."
    (file "script1/Away.tcl" line 47)
    invoked from within
"source script1/Away.tcl"
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Fixed both those, um, problems..:oops: Retry the original code in full above.
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Scripts loads... but the bot doesn't do anything.

:oops:
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

holycrap wrote:Scripts loads... but the bot doesn't do anything.

:oops:
guess it doesn't like those colons in the proc names.
http://ereader.kiczek.com/autoaway.tcl for downloading or copy the code below.

Code: Select all

# Automated Away Detection by speechles
# Egghelp version v1.0 - tested and working.. yay!!
# Donate to slennox @ egghelp.org if you like this script!

# CONFIG begins
# set your sentence triggers below. You MUST use %nick
# somewhere in each line. This setting configures on which
# sentences your bot should attempt to do an ai away. Each
# of them is a simple wildcard mask. Create more precise
# masks if the bot reacts too often.
variable checklist {
 "hey %nick"
 "hello %nick"
 "%nick are you there?"
}

# SCRIPT begins
# initialize the global variables
variable checknick ""
variable checkchan ""

# flag to control behavior per channel
setudef flag checknames

# bind to raw reply concerning away status of whois
bind RAW  -|-  301 checkaway

# bind to everything said in channel
bind pubm -|- * checkcriteria

# check checklist against user input
# if we have a match, discern which token to evaluate as nick
# and if they are indeed on the channel issue a whois request
proc checkcriteria {nick uhost hand chan text} {
   if {[lsearch -exact [channel info $chan] +checknames] == -1} { return }
   set ::checkchan $chan
   foreach entry $::checklist {
      if {[string match -nocase [string map {"%nick" "*"} $entry] $text]} {
         set ::checknick [lindex [split $text] [lsearch -exact [split $entry] "%nick"]]
         if {[onchan $::checknick $chan]} {
            putserv "WHOIS $::checknick"
         }
         break
      }
   }
}

# interpret the whois request and make sure the nick requested matches
# the whois reply we are searching for. If the person is not away, a 301
# will not be sent, and the whois will be ignored as per requested.
proc checkaway {from key text} {
   if {![string match -nocase [lindex [split $text] 1] $::checknick]} { return }
   putserv "privmsg $::checkchan :[lindex [split $text] 1] is away: [string trim [join [lrange [split $text] 2 end]] ":"]"
   set ::checknick ""
}

putlog "Automated away detection loaded."
Try this.
<test123> /away this is an away test for egghelp
<speechles> tESt123 are you there?
<sp33chy> test123 is away: this is an away test for egghelp
<speechles> hey TEST123 are you here?
<sp33chy> test123 is away: this is an away test for egghelp
Tested and fully working, if you have any questions feel free to ask. Notice the script is not case sensitive, and will correct the nickname in it's reply to the proper case when reporting.
To make it work you simply .chanset #yourchan +checknames in dcc partyline for each channel. Enjoy... :wink:
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Do I have to do something extra? Or maybe the server that i'm running disabled something that prevented it to function? Cause the bot is not doing anything still.

:roll:
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

holycrap wrote:Do I have to do something extra? Or maybe the server that i'm running disabled something that prevented it to function? Cause the bot is not doing anything still.

:roll:
Assuming you have already .chanset #yourchan +checknames I'm stumped why it doesn't work. Message me on irc.efnet.net, because it works perfectly there. speechles @ efnet.
<speechles> hey freymor where are ya?
<sp33chy> Freymor is away: offline, leave a msg!!!
<speechles> hello cyberfoxx you dead?
<sp33chy> CyberFoxx is away: Auto Away
<speechles> |shadow| are you there?
<sp33chy> |Shadow| is away: Sleeping
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Cool, it works now! :D Didn't have .chanset #yourchan +checknames, that's why it didn't work.

So, it's not possible to make the bot distinguish within the context of a sentence which is a nick? It would be very cool if you can get this to work! Please? :D

This seems very limited... that the bot only reply on those triggers.

Ok.. gonna go to donate now. :)
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

holycrap wrote:Cool, it works now! :D Didn't have .chanset #yourchan +checknames, that's why it didn't work.

So, it's not possible to make the bot distinguish within the context of a sentence which is a nick? It would be very cool if you can get this to work! Please? :D

This seems very limited... that the bot only reply on those triggers.

Ok.. gonna go to donate now. :)
It is limited, because having the bot check every single word within every single line said against the nick list would seriously drain the resources of your bot and slow it down to a crawl. You can add as many triggers as you want with as many different phrases as you need to compensate. This is exactly how the ai-seen within the gseen module works.

If you want, I can add the ability for it to use wildcarding more effectively.
"%nick are you there" - for this %nick will become a *, meaning anything before it will be interpreted, this may not be what you want entirely. I can make it so that this will be interpreted as a 4 word sentence. Replacing %nick with * and checking the sentence is 4 words. If you start or begin the entry with a * it would mean the length check isn't needed and would match an occurrence anywhere in the sentence.

I'll whip up an example of what I mean later to show you ;)
h
holycrap
Op
Posts: 152
Joined: Mon Jan 21, 2008 11:19 pm

Post by holycrap »

Cool, can't thank you enough! :D

Anything that will make it works better are welcome.

I don't have that many nick in my channel, don't know if checking every word will slow the bot down or not.

:)
Post Reply