| View previous topic :: View next topic |
| Author |
Message |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Aug 21, 2008 12:00 am Post subject: |
|
|
| holycrap wrote: | Cool, can't thank you enough!
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.
 |
| Quote: | <speechles> i wonder if test123 is here or there or anywhere
<sp33chy> TEST123 is away: this is an away test for egghelp
<speechles> do any of you guys know if that test123 guy is away or anything?
<sp33chy> TEST123 is away: this is an away test for egghelp
<speechles> hey atest123
<speechles> is there anybody heretest123 that can answer a question?
<speechles> test123
<sp33chy> TEST123 is away: this is an away test for egghelp |
| Code: | # Fully Automated Away Detection by speechles
# Egghelp version v1.0 - tested and working.. yay!!
# Donate to slennox @ egghelp.org if you like this script!
# Fully automatic, you configure nothing.
# The script will decide based upon the length of the nicklist
# or the length of user input on which to scan with, it will
# use whichever is shorter which makes it faster, enjoy.
# 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 which list is shorter, nicklist or text length
# and use that to scan for similarity and issue the whois
proc checkcriteria {nick uhost hand chan text} {
if {![channel get $chan checknames]} { return }
set ::checkchan $chan
set ::checknick ""
if {[llength [chanlist $chan]] < [llength [split $text]]} {
foreach n [chanlist $chan] {
if {[lsearch [split [string tolower $text]] [string tolower $n]] != -1} {
if {[string equal [string length $n] [string length [lindex [split $text] [lsearch [split [string tolower $text]] [string tolower $n]]]]]} {
set ::checknick $n
break
}
}
}
} else {
foreach n [split $text] {
# the join and split are used to emulate the behavior
# of the -nocase switch which isn't allowed during lsearch
# you can't string tolower a list, hence the join and split ;)
if {[lsearch [split [string tolower [join [chanlist $chan]]]] [string tolower $n]] != -1} {
set ::checknick $n
break
}
}
}
if {[string length $::checknick] > 0 && [onchan $::checknick $chan]} {
putserv "WHOIS $::checknick"
}
}
# 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 range [join [lrange [split $text] 2 end]] 1 end]"
set ::checknick ""
}
putlog "Fully Automated Away Detection loaded." |
Here it is how you envisioned it. You configure nothing. The script will decide based on the length of the nicklist or length of text entered which to scan with. This will make it faster. It also is case insensitive as you can see in the example above. It also is smart enough not to react when the nickname is embedded as part of another word as shown in the examples above. This script should be more to your liking. Hope it doesn't lag your bot too badly
Remember, to enable it, get on your bots partyline and .chanset #yourchan +checknames
Note: On actually using the script often, I've found it doesn't really lag the bot one bit even running in channels containing thousands of nicknames. It's instantaneous response and even faster than the other code I posted. _________________ speechles' eggdrop tcl archive
Last edited by speechles on Mon Sep 01, 2008 12:44 am; edited 3 times in total |
|
| Back to top |
|
 |
holycrap Op
Joined: 21 Jan 2008 Posts: 152
|
Posted: Mon Oct 20, 2008 7:10 pm Post subject: |
|
|
Hi,
It's not a major issue but I noticed this if you set:
/away :)
The colon does not show if it's at the "beginning" or the "end" of the away message. It does show in between though.
Anyway to fix this?
I've tried removing
from the line below, but it didn't fix it. It made it worst and show : every time.
| Code: |
[join [lrange [split $text] 2 end]] ":"]"
|
Thank You! |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Mon Oct 20, 2008 8:52 pm Post subject: |
|
|
| holycrap wrote: | Hi,
It's not a major issue but I noticed this if you set:
/away
The colon does not show if it's at the "beginning" or the "end" of the away message. It does show in between though.
Anyway to fix this?
I've tried removing
from the line below, but it didn't fix it. It made it worst and show : every time.
| Code: |
[join [lrange [split $text] 2 end]] ":"]"
|
Thank You! |
That actually was corrected awhile ago in the above code.. but here is the single line to change | Code: | | putserv "privmsg $::checkchan :[lindex [split $text] 1] is away: [string range [join [lrange [split $text] 2 end]] 1 end]" |
_________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
holycrap Op
Joined: 21 Jan 2008 Posts: 152
|
Posted: Mon Oct 20, 2008 9:50 pm Post subject: |
|
|
Hmm... It didn't really fixed it.
User: /away :)
Will show. User is away: )
It's still missing a colon in front. Shouldn't it be: User is away: :)
I guess what I'm asking is... I'm trying to get the colon to appear in front of the away message if I type /away :) as of now it will only show ) missing the the :
Thanks |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Mon Oct 20, 2008 10:33 pm Post subject: |
|
|
| holycrap wrote: | Hmm... It didn't really fixed it.
User: /away
Will show. User is away: )
It's still missing a colon in front. Shouldn't it be: User is away:
I guess what I'm asking is... I'm trying to get the colon to appear in front of the away message if I type /away as of now it will only show ) missing the the :
Thanks |
The way it works on irc, is that : delineates your message in the raw read reply the bot receives { nick:away message here }. It doesn't see :) as happy face (depends entirely on your irc client), the bot then sees this as an away message of ")" { nick:) } quite frankly, since all away messages have colons preceeding. But if you want this displayed change to: | Code: | | putserv "privmsg $::checkchan :[lindex [split $text] 1] is away [join [lrange [split $text] 2 end]]" |
Conversely, you don't have to change a thing, and just set yourself /away ::) and that would also work (depends once again, on the irc client used to set the away message). _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
holycrap Op
Joined: 21 Jan 2008 Posts: 152
|
Posted: Mon Oct 20, 2008 11:36 pm Post subject: |
|
|
Cool, it works now. I was using v1.1 in the archive. The code is a bit different from the one above. I'm using the one below. I hope it works the same(efficiency of the script).
Thank you once again!
| Code: |
# Fully Automated Away Detection by speechles
# Egghelp version v1.1 - tested and working.. yay!!
# Donate to slennox @ egghelp.org if you like this script!
# Fully automatic, you configure nothing.
# The script will decide based upon the length of the nicklist
# or the length of user input on which to scan with, it will
# use whichever is shorter which makes it faster, enjoy.
# MAKE SURE TO .chanset #yourchan +checkaway
# afterwards the script will function in #yourchan
# revision history
# v1.1 - now fully automated, no more checklist
# v1.0 - scripted using checklist user sets in config.
# SCRIPT begins
# initialize the global variables
variable checknick ""
variable checkchan ""
# flag to control behavior per channel
setudef flag checkaway
# 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] +checkaway] == -1} { return }
set ::checkchan $chan
set ::checknick ""
if {[llength [chanlist $chan]] < [llength [split $text]]} {
foreach n [chanlist $chan] {
if {[lsearch [split [string tolower $text]] [string tolower $n]] != -1} {
if {[string equal [string length $n] [string length [lindex [split $text] [lsearch [split [string tolower $text]] [string tolower $n]]]]]} {
set ::checknick $n
break
}
}
}
} else {
foreach n [split $text] {
if {[lsearch [split [string tolower [join [chanlist $chan]]]] [string tolower $n]] != -1} {
set ::checknick $n
break
}
}
}
if {[string length $::checknick] > 0 && [onchan $::checknick $chan]} {
putserv "WHOIS $::checknick"
}
}
# 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 range [join [lrange [split $text] 2 end]] 1 end]"
set ::checknick ""
}
putlog "*.Automated Away Detection v1.1* Loaded"
|
|
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Fri Nov 07, 2008 10:36 pm Post subject: |
|
|
| Code: | # Fully Automated Away Detection by speechles
# Egghelp version v1.3 - tested and working.. yay!!
# Donate to slennox @ egghelp.org if you like this script!
# Fully automatic, you configure nothing.
# The script will decide based upon the length of the nicklist
# or the length of user input on which to scan with, it will
# use whichever is shorter which makes it faster, enjoy.
# MAKE SURE TO .chanset #yourchan +checkaway
# afterwards the script will function in #yourchan
# revision history
# v1.3 - added idle time duration to the away message reply
# v1.2 - now wont react if that nickname is away and
# mentions their own nickname in channel. This prevents
# public away messages, etc from making this script
# spam channels.
# v1.1 - now fully automated, no more checklist
# v1.0 - scripted using checklist user sets in config.
# SCRIPT begins: there is no config this is 100% automatic.
# -------------
# initialize the global variables
variable checknick ""
variable checkchan ""
# flag to control behavior per channel
setudef flag checkaway
# bind to raw reply concerning away status of whois
bind RAW -|- 301 checkaway
# bind to everything said in channel
bind pubm -|- * checkcriteria
# check which token to whois phrased from 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] +checkaway] == -1} { return }
set ::checkchan $chan
set ::checknick ""
if {[llength [chanlist $chan]] < [llength [split $text]]} {
foreach n [chanlist $chan] {
if {[lsearch [split [string tolower $text]] [string tolower $n]] != -1} {
if {[string equal [string length $n] [string length [lindex [split $text] [lsearch [split [string tolower $text]] [string tolower $n]]]]]} {
set ::checknick $n
break
}
}
}
} else {
foreach n [split $text] {
if {[lsearch [split [string tolower [join [chanlist $chan]]]] [string tolower $n]] != -1} {
set ::checknick $n
break
}
}
}
if {[string length $::checknick] && ![string equal -nocase $n $nick] && [onchan $::checknick $chan]} {
putserv "WHOIS $::checknick"
}
}
# 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 range [join [lrange [split $text] 2 end]] 1 end] (idle: [duration [expr {[getchanidle $::checknick $::checkchan] * 60}]])"
set ::checknick ""
}
putlog "Automated away detection has been loaded." |
| Quote: | <speechles> where you at tweek?
<sp33chy> tweek is away: is away: (Auto-Away after 10 mins) [BX-MsgLog Off] (idle: 31 minutes)
<speechles> how about you norman, you around?
<sp33chy> norman is away: offline, leave a msg!!! (idle: 6 days 11 hours 50 minutes) |
Updated the script a bit to help eliminate some problems and added in a new feature. If the person away mentions their own nickname, say a public away message, the script before would've spammed they were away which is redundant. This won't happen now, the person who is away can no longer type their own nick and watch the bot reply their status. Also added idle time duration to show up along with the away message. This helps determine how long the person might have been away.. For those using this script, it has also been uploaded to the archive. Enjoy and have a fun
Edit: corrected script above for problem mentioned below  _________________ speechles' eggdrop tcl archive
Last edited by speechles on Sat Nov 08, 2008 2:46 pm; edited 1 time in total |
|
| Back to top |
|
 |
holycrap Op
Joined: 21 Jan 2008 Posts: 152
|
Posted: Sat Nov 08, 2008 2:17 pm Post subject: |
|
|
| Quote: | | If the person away mentions their own nickname, say a public away message, the script before would've spammed they were away which is redundant. |
This version of the script is nick case sensitive. If your nick is "Java" and you type "java" it will still read the away message.
 |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat Nov 08, 2008 2:45 pm Post subject: |
|
|
my bad.. lmao.. | Code: | | if {[string length $::checknick] && ![string equal $n $nick] && [onchan $::checknick $chan]} { |
Change that to look like below and solved, I forgot the -nocase.. | Code: | | if {[string length $::checknick] && ![string equal -nocase $n $nick] && [onchan $::checknick $chan]} { |
_________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
deadweasel Voice
Joined: 01 Jan 2009 Posts: 1
|
Posted: Thu Jan 01, 2009 8:29 pm Post subject: |
|
|
I'm currently trying to get this little bad boy running with my own bot, but I can't set the channel mode specified.
Neither of these work:
.chanset #channame +checkaway
.chanset #channame +checknames
Both return "invalid mode". Of course, the bot is unresponsive when I am set to away.
What am I missing here? |
|
| Back to top |
|
 |
lenooxx Voice
Joined: 24 Mar 2009 Posts: 27 Location: Hungarian
|
Posted: Thu Mar 26, 2009 3:42 pm Post subject: hi |
|
|
i got same problem
Error trying to set +checknames for #***, invalid mode.
what happend? :S |
|
| Back to top |
|
 |
c0re Voice
Joined: 18 Jan 2009 Posts: 16
|
Posted: Fri Mar 27, 2009 2:10 pm Post subject: |
|
|
omg the bot keep whoising people
isnt there any other way? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat Nov 14, 2009 12:48 pm Post subject: |
|
|
This fixes a slight problem the automated away had detecting nicknames placed up against punctuation.
<nick> hey guy are you there?
if the nickname "guy" was in the channel, and set to away, the script works.
<nick> hey guy, are you there?
The script would fail, it will look for "guy,". The new version will not, it has a list of punctuation you can alter and these will be stripped before comparing to nicknames. New version will look for "guy" correctly in these instances.
Enjoy and have a fun.
| Code: | # Fully Automated Away Detection by speechles
# Egghelp version v1.4 - tested and working.. yay!!
# Donate to slennox @ egghelp.org if you like this script!
# Fully automatic, you configure nothing.
# The script will decide based upon the length of the nicklist
# or the length of user input on which to scan with, it will
# use whichever is shorter which makes it faster, enjoy.
# MAKE SURE TO .chanset #yourchan +checkaway
# afterwards the script will function in #yourchan
# revision history
# v1.4 - added a single config option to enter characters
# that need to be stripped from text that are
# placed up against nicknames.
# v1.3 - added idle time duration to the away message reply
# v1.2 - now wont react if that nickname is away and
# mentions their own nickname in channel. This prevents
# public away messages, etc from making this script
# spam channels.
# v1.1 - now fully automated, no more checklist
# v1.0 - scripted using checklist user sets in config.
# set the characters you wish to strip when prefixed or
# appended to nicknames
# ----
variable auto_strip ":;,.?"
# SCRIPT begins: there is no config this is 100% automatic.
# -------------
# initialize the global variables
variable checknick ""
variable checkchan ""
# flag to control behavior per channel
setudef flag checkaway
# bind to raw reply concerning away status of whois
bind RAW -|- 301 checkaway
# bind to everything said in channel
bind pubm -|- * checkcriteria
# check which token to whois phrased from 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] +checkaway] == -1} { return }
set ::checkchan $chan
set ::checknick ""
if {[llength [chanlist $chan]] < [llength [split $text]]} {
foreach n [chanlist $chan] {
if {[lsearch [split [string tolower $text]] "*[string tolower $n]*"] != -1} {
if {[string equal [string length $n] [string length [string trim [lindex [split $text] [lsearch [split [string tolower $text]] [string tolower $n]]] $::auto_strip]]]} {
set ::checknick $n
break
}
}
}
} else {
foreach n [split $text] {
if {[lsearch [split [string tolower [join [chanlist $chan]]]] [string trim [string tolower $n] $::auto_strip]] != -1} {
set ::checknick [string trim $n $::auto_strip]
break
}
}
}
if {[string length $::checknick] && ![string equal -nocase $n $nick] && [onchan $::checknick $chan]} {
putserv "WHOIS $::checknick"
}
}
# 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 range [join [lrange [split $text] 2 end]] 1 end] (idle: [duration [expr {[getchanidle $::checknick $::checkchan] * 60}]])"
set ::checknick ""
}
putlog "Automated away detection v1.4 has been loaded." |
_________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
|