| View previous topic :: View next topic |
| Author |
Message |
edu Voice
Joined: 29 Oct 2006 Posts: 31
|
Posted: Wed Jan 24, 2007 5:49 am Post subject: hostname -> nickname |
|
|
Hi
I have a little problem ...
| Code: |
set edu(bot_host) "*!*@bot.users.undernet.org"
|
After I've setted that variable I want to find if that 'hostname' is on the channel where the bot is running. I want to switch the hostname into the host's nickname , ex:
If nickname "eggie" has hostname "*!*@bot.users.undernet.org", I want to 'show' that nickname
Thanks _________________ Seek the truth |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Jan 24, 2007 4:44 pm Post subject: |
|
|
| Code: | foreach n [chanlist $chan] {
if {[string match -nocase $edu(bot_host) $n![getchanhost $n $chan]]} {
# Found nick: $n
break
}
} |
But what's the purpose of that? if it's to know if your bot is on the channel then a simple [botonchan $chan] will do that. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
edu Voice
Joined: 29 Oct 2006 Posts: 31
|
Posted: Thu Jan 25, 2007 4:32 am Post subject: |
|
|
It's not for the bot, it's for something else
It doesn't work
| Code: |
set edu(hostname) "*!*@edu.users.undernet.org"
bind pub o|- .find edu:find
proc edu:find {nickname hostname handle channel text} {
global edu
foreach n [chanlist $channel] {
if {[string match -nocase $edu(hostname) $n![getchanhost $n $channel]]} {
# Found nick: $n
putquick "PRIVMSG $channel :Found $n"
break
}
}
}
|
 _________________ Seek the truth |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Jan 25, 2007 3:45 pm Post subject: |
|
|
Try:
| Code: | set edu(hostname) "*!*@edu.users.undernet.org"
bind pub o .find edu:find
proc edu:find {nickname hostname handle channel text} {
global edu
foreach n [chanlist $channel] {
if {[string match -nocase $edu(hostname) $n![getchanhost $n $channel]]} {
set found $n
break
}
}
if {[info exists found]} {
putserv "privmsg $channel :Found $n"
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|