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.

botonchan for +inactive channel

General support and discussion of Eggdrop bots.
Post Reply
n
npax
Voice
Posts: 2
Joined: Wed Aug 24, 2011 3:09 pm

botonchan for +inactive channel

Post by npax »

Why function [botonchan $chan] returns 1 for all bot's channels, including with +inactive option?
Same with [onchan $botnick $chan]
I use eggdrop 1.6.21

I know about [channel get $chan inactive] - it works, but the bot is not on inactive channels!
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Re: botonchan for +inactive channel

Post by speechles »

<sp33chy> I am sp33chy, running eggdrop v1.6.17: 88 users (mem: 948k).
...
<sp33chy> OS: CYGWIN_NT-5.1 1.5.18(0.132/4/2)
<sp33chy> Tcl library: /cygdrive/f/sp33chy/lib/tcl8.4
<sp33chy> Tcl version: 8.4.11 (header version 8.4.11)
...
<speechles> .chanset #channel +inactive
<sp33chy> Successfully set modes { +inactive } on #channel.
<speechles> .tcl set a [botonchan #channel]
<sp33chy> Tcl: 0
<speechles> .tcl set a [onchan "sp33chy" "#channel"]
<sp33chy> Tcl: 0
<speechles> .chanset #channel -inactive
<sp33chy> Successfully set modes { -inactive } on #channel.
<speechles> .tcl set a [botonchan #channel]
<sp33chy> Tcl: 1
<speechles> .tcl set a [onchan "sp33chy" "#channel"]
<sp33chy> Tcl: 1
1.6.17 with tcl 8.4 ... This works as expected for me....
n
npax
Voice
Posts: 2
Joined: Wed Aug 24, 2011 3:09 pm

Post by npax »

eggdrop v1.6.21
Tcl version: 8.5.10

trying script:

Code: Select all

bind pub m|m "!channels" pub:channels

proc pub:channels {nick host hand chan args} {
	if {[lindex $args 0] == "on"} {
		set active ""
		foreach ch [channels] {
			if {[botonchan $ch]} {
				append active " $ch"
			}
		}
		putserv "PRIVMSG $chan :Bot is on channels:$active"
	} else {
		putserv "PRIVMSG $chan :Channels list: [channels]"
	}
}
commands:
!channels - all channels
!channels on - only active channels

both commands returns all channels, include +inactive ones

only if I replase

Code: Select all

if {[botonchan $ch]} {
with

Code: Select all

if {![channel get $ch inactive]} {
that works fine
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Moved to Eggdrop Help section.

I've tested the same thing on my bot version 1.6.20 that's sitting on Undernet network (net-type 2) and I get the same result as you.

Code: Select all

foreach cahn [channels] {
	set status [channel get $chan inactive]
	set onch [botonchan $chan]
	putlog "chan: $chan | on channel: $onch | status: $status"
}
returns:
chan: #chan1 | on channel: 1 | status: 0
chan: #chan2 | on channel: 1 | status: 1
This must be a bug or something. :roll:
Once the game is over, the king and the pawn go back in the same box.
Post Reply