| View previous topic :: View next topic |
| Author |
Message |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sun Apr 19, 2015 10:51 pm Post subject: Virtual host of bot (process into process) |
|
|
I need the vhost (virtual host) my bot, that I did not return the getchanhost, matchaddr or maskhost commands.
If I do a whois to my bot, your vhost is different than other commands return.
The matchaddr command returns the real host, that is, the company belonging to the internet .:
mybot!botijo@anteldata.net.uy
The vhost my bot is another:
mybot!botijo@hello.your.best.bot
I need a command to return vhost bot.
I found the solution, but have the problem of getting the value of the variable vhost from one process to another.
| Code: | bind mode - "% +b" check:ban
proc check:ban {nick host hand chan mode target} {
global canal_admin vhost
putserv "WHOIS $::botnick"
proc whois::311 {from key botnick } {
global canal_admin vhost
if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $botnick wholematch nick ident host realname]} {
set vhost [stripcodes bc ${host}]
putserv "PRIVMSG $canal_admin :boT vhost: $vhost"
}
}
set host1 "*!*@[join $vhost]"
.................more stuff................ |
Tcl error [check:ban]: can't read "vhost": no such variable
The problem starts in the following line:
| Quote: | | set host1 "*!*@[join $vhost]" |
You can not set the host1 variable, because it can not read the vhost variable.
Is there any way to fix this code, or another way to get the vhost bot? _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Apr 20, 2015 12:10 am Post subject: |
|
|
You can't just put the proc whois::311 inside of the process that is calling the whois, and then just continue on as though you have the returned results from the server.
At the time this line runs: set host1 "*!*@[join $vhost]" :there has not been a return from the server yet, and you have no bind to even catch that raw return.
Also, don't use :: in your process names unless you fully understand tcl namespaces, and you handle the namespace correctly.
If I was trying to do this sort of thing, I would whois the bot on connection to the network, and save the required nick!user@vhost info to a global var I could call when needed.
This info should not change while you are still connected, and can be updated as needed every time the bot connects.
That would keep you from having to whois the bot every time someone sets a ban on any channel the bot is on.
Then, all you have to do when a ban is set, is string match -nocase the new ban mask against the stored nick!user@vhost of the bot, and can continue without having to wait for a whois to be returned by the server:) _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Apr 20, 2015 1:34 am Post subject: |
|
|
He doesn't need to do a whois on the bot when can get creative and instead use getchanhost on the bot and will result current vhost. At least in theory. Will see what results he will get in the other topic that he opened with about the same subject. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Mon Apr 20, 2015 9:30 am Post subject: |
|
|
| SpiKe^^ wrote: |
...
This info should not change while you are still connected, and can be updated as needed every time the bot connects.
...
|
This made me remember:
Are not most vhosts controlled by Nickserv? In that the vhost is not applied until the nick identifies with Nickserv.
I think the original poster said something about getchanhost failing to get an address that matched.
Could this have been the problem?
Just a thought .... _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Mon Apr 20, 2015 10:51 am Post subject: |
|
|
| caesar wrote: |
He doesn't need to do a whois on the bot when can get creative and instead use getchanhost on the bot and will result current vhost. At least in theory. Will see what results he will get in the other topic that he opened with about the same subject. |
It is truly in theory.
| willyw wrote: |
I think the original poster said something about getchanhost failing to get an address that matched.
|
[matchaddr $target "$::botnick![getchanhost $::botnick]"] return 0 (zero) _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
|