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.

ask for help

Old posts that have not been replied to for several years.
User avatar
qwek
Voice
Posts: 35
Joined: Tue Sep 21, 2004 7:51 am
Location: space

ask for help

Post by qwek »

Hi all,

how can i make the bot follow me to mode channel?

in ex:

* owner sets mode: -b *!*@eggdrop.host.net
* bot1 sets mode: -b *!*@eggdrop.host.net
* bot2 sets mode: -b *!*@eggdrop.host.net
* bot3 sets mode: -b *!*@eggdrop.host.net

* owner sets mode: +mi
* bot1 sets mode: +mi
* bot2 sets mode: +mi
* bot3 sets mode: +mi

and how can i find enforce ban coding? i know in the config files for eggdrop there's already have +enforceban, but i want to know what is the code, will be there someone to help me?

regards,
qwek
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

since when can you unset a ban 3 times after its unset, same with modes. :|
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

On partyline, do
.chanset #channel +enforcebans
Or if you are making a tcl script, the code to set a channel +enforcebans is

Code: Select all

channel set #channel +enforcebans
User avatar
qwek
Voice
Posts: 35
Joined: Tue Sep 21, 2004 7:51 am
Location: space

Post by qwek »

i mean bot follow me to mode channel in a proc and a bind.

in ex:
bind modes - modes modechan
proc modechan { nick handle uhost arg } {
and? i dont know how to make tcl proc on follow mode channel.

and also enforce ban, i already know how to set in partyline and conf. but i wish i can see the real bind/proc for enforce ban.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

you'll need a raw mode bind for the modes to be output the right way (because the modes are split before the command of a mode bind is called and pushmode doesn't do stupid things like setting redundant modes :P)

Code: Select all

bind raw - MODE lameness
proc lameness {by args} {
	if {[matchattr [finduser $by] n]} {
		putserv [join $args]
	}
}
(not tested - because i'm not on a lame ircd that allows redundant mode changes)
Have you ever read "The Manual"?
User avatar
qwek
Voice
Posts: 35
Joined: Tue Sep 21, 2004 7:51 am
Location: space

Post by qwek »

user wrote:you'll need a raw mode bind for the modes to be output the right way (because the modes are split before the command of a mode bind is called and pushmode doesn't do stupid things like setting redundant modes :P)

Code: Select all

bind raw - MODE lameness
proc lameness {by args} {
	if {[matchattr [finduser $by] n]} {
		putserv [join $args]
	}
}
(not tested - because i'm not on a lame ircd that allows redundant mode changes)
user: you write the code of modes is correct :), i know it's just for fun modes but i want work in my bot like a human lol :) thanks for the code user. and how about enforce ban code? hehe *wink*, i'm sorry if i make a problem for asking help.

regards,
qwek
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

qwek wrote:and also enforce ban, i already know how to set in partyline and conf. but i wish i can see the real bind/proc for enforce ban.
The binds triggering the ban enforcement (on join/nick change/mode +b) don't call procs. They call internal commands provided by the channels module that do everything related to joining/nick changes/channel mode changes. If you want to customized enforcement, disable the built in thing and make your own from scratch :)
Have you ever read "The Manual"?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You can bind mode on every "+b" for the enforcebans and check if $target != $botname, go ahead and do a foreach loop of the chanlist in the channel, string match every users *!*@host, if they match append each to a list, then after your loop is complete and your list != "" then go ahead and join the list with ,'s (commas) and kick all the people out with putserv, putkick etc.

But anyway +enforcebans is a better way todo it (but slow). In the tcl script case bot might get excess flood if there are alot of people matching the ban in the channel. Enforcebans are inside the channel module and coded with C, so there like apart of the bot's body, while scripts you can add and remove like external accessories for futher echancements and capabilites.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Here is an banenforcement script.

Code: Select all

setudef flag enforce

bind mode - "% +b" ban:enforce

proc ban:enforce { nick host hand chan mode mask } { 
global botnick
if {![channel get $chan enforce]} { 
return 
 } 
foreach user [chanlist $chan] {
if {[string match -nocase $mask $user![getchanhost $user]]} {
if {$user == "$botnick"} {
putquick "PRIVMSG $chan :Do not ban me."
} else {
putquick "KICK $chan $user :You are BANNED from this channel."
}
}
}
}
I was working on it awhile back and i dont know if i ever finished it
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I would suggest to put all nicks in one line then go ahead and kick them, that would send less data to the server, for example sending same reasons for each nick, can be done by sending one reason for multiple nicks.

Roughly, something like this:
putserv "KICK $chan awyeah,metroid,elite,god,jesus,hotchick :Banned - lamer detected"
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

awyeah wrote:putserv "KICK $chan awyeah,metroid,elite,god,jesus,hotchick :Banned - lamer detected"
putkick would be better as not all ircds support multiple nicks/kick.
MeTroiD wrote:

Code: Select all

[string match -nocase $mask $user![getchanhost $user]]
You need to escape the chars that have a special meaning in tcl's glob matching, but are treated like normal characters by the ircd (\[])
Have you ever read "The Manual"?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You would have to match each and every *!*@host like:

Code: Select all

proc my_proc {nick uhost hand chan mode target} {
 ..........................
 ................................
 .....................................
 foreach user [chanlist $chan]
 if {([string match -nocase *[lindex [split [getchanhost $user $chan] "@"] 1]* $target])} {
  ...........................................
  ....................................
  }
 }
 .........................
}
To escape the chars, you can either use string map, regsub or do a simple split and join on the variable:

Code: Select all

set nick [join [split $nick]]
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

awyeah wrote:You would have to match each and every *!*@host like:

Code: Select all

proc my_proc {nick uhost hand chan mode target} {
 ..........................
 ................................
 .....................................
 foreach user [chanlist $chan]
 if {([string match -nocase *[lindex [split [getchanhost $user $chan] "@"] 1]* $target])} {
  ...........................................
  ....................................
  }
 }
 .........................
}
To escape the chars, you can either use string map, regsub or do a simple split and join on the variable:

Code: Select all

set nick [join [split $nick]]
wrong...use the ban as a mask and match against the entire name (nick!user@host) like in MeTroiD's example. That split+join of yours does nothing (apart from wasting some cpu).
to do case insensitive matching of irc strings you need something like this....

Code: Select all

proc irc2lower str {
	if {${::rfc-compliant}} {
		string tolower [string map {[ \{ ] \} \\ |} $str]
	} else {
		string tolower $str
	}
}
Have you ever read "The Manual"?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well yeah actually, my ban was only if a user is banned with *!*@host.domain.com (I use it mainly for clones).

Now you might want to consider the other 2 options as well, nick and ident.
So for that you would want to use nick!ident@host.domain.com. I guess user is right.

user: Some one told me splitting and then joining a variable with a delayed utimer adds an extra \ infront of each special tcl character such as a [, to be \[ and } to be \} etc. So that isn't true?

Well I knew regsub can do it, but its slow, string map on the other hand is a bit faster you can utilize that too, but as I thought joining and splitting is the simplest of all so we should use that, if it really did work.

set myvar "awyeah"
set newvar [split $myvar]
putlog "$newvar"

Output: a {} w {} y {} e {} a {} h {}
or: a w y e a h

Meaning escaping the special characters, on a join:
set myvar [join $newvar]
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

'split "awyeah"' will result in a list with one element containing the string "awyeah" (which looks identical to the string because there are no special chars in it)
i think this is closer to what you were thinking of:

Code: Select all

set escaped [join [split [split $string ""]] ""]
...but not quite right :P
This proc should give you an idea of how to do the ban matching:

Code: Select all

proc banvictims {ban chan} {
	set nicks {}
	if {${::rfc-compliant}} {
		set ban [string tolower [string map {[ \{ ] \} \\ |} $ban]]
		foreach nick [chanlist $chan] {
			set name [string tolower [string map {[ \{ ] \} \\ |} $nick![getchanhost $nick $chan]]]
			if {[string match $ban $name]} {lappend nicks $nick}
		}
	} else {
		set ban [string tolower [string map {[ \\[ ] \\] \\ \\\\} $ban]]
		foreach nick [chanlist $chan] {
			set name [string tolower $nick![getchanhost $nick $chan]]
			if {[string match $ban $name]} {lappend nicks $nick}
		}
	}
	set nicks
}
Have you ever read "The Manual"?
Locked