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.

auto-invite script

Support & discussion of released scripts, and announcements of new releases.
Post Reply
i
iNFERiON
Voice
Posts: 7
Joined: Sat Nov 13, 2004 4:23 pm

auto-invite script

Post by iNFERiON »

Description pretty much says it all, enjoy :)

Code: Select all

#######################
##  auto-invite.tcl  ##
## v1.0   01/18/2006 ##
## Coded by iNFERiON ##
#######################
#     DESCRIPTION     #
#######################
# This script will monitor a channel for joining people
# and see if their hostname is in the by you specified file.
# If it is, it will auto-invite that person to a +i channel of your choice.
# This is easy if you have a public and a private channel like #mychan and #mychan.crew
# A bot master (+m) can add hosts to the invitehosts.txt file by using !addinvite <hostmask>,
# e.g. !addinvite ~me@my.ISP.here.net
# For extra security, this command only works in the +i chan.
#
# Enjoy :)
######################


### Config ###

# Hostlist file?
set hostlist_file "invitehosts.txt"

# Listen channel?
set listen_chan "#changeme"

# Invite channel?
set invite_chan "#invitemehere"

# Nick to notify about sent invites?
set notify_nick "BotOwner"

# Notice to send before invite?
set invite_note "You are recognized as crew member, inviting you to the crew channel."

### End of config ###

### Do NOT edit below ###

bind pub m !addinvite ai_add
bind join - * ai_join

proc ai_join { nick host handle chan } {
	global hostlist_file listen_chan invite_chan notify_nick invite_note
	if {$chan == $listen_chan} {
		set fname $hostlist_file
		set fp [open $fname "r"]
		set data [read -nonewline $fp]
		close $fp
		set lines [split $data "\n"] 
		foreach line $lines {
  	  if {[string match -nocase "$host" $line]} {
				puthelp "NOTICE $notify_nick :Inviting $nick to $invite_chan"
				puthelp "NOTICE $nick :$invite_note"
				putserv "INVITE $nick :$invite_chan"
			}
		}
	}
}

proc ai_add { nick host handle chan text } {
	global hostlist_file invite_chan	
	if {$chan == $invite_chan} {
		set newhost "$text"
		set fname $hostlist_file
		set fp [open $fname "a"]
		puts $fp $newhost
		close $fp
		puthelp "NOTICE $nick :Done."
	}
}

putlog "Auto-invite v1.0 by iNFERiON loaded"
p
pavel_kbc
Voice
Posts: 23
Joined: Thu Dec 28, 2006 2:17 pm

Post by pavel_kbc »

its really good . but can you make it for multiple channel? please
T
TRB
Voice
Posts: 1
Joined: Sat Feb 02, 2008 9:56 am

Post by TRB »

I'm having a problem with users who use +x (hostname masking). Is there a way around that without having the user do anything? User privacy is a big concern, and I don't want to reveal their IP address if I don't have to.
User avatar
4mirc
Voice
Posts: 37
Joined: Fri May 16, 2008 11:11 pm
Contact:

Post by 4mirc »

hiiiiiiiiiiiiiiii


im looking for this script :lol:

but can u make it for nicks not hosts ???????


thx alot alot
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

4mirc wrote:hiiiiiiiiiiiiiiii


im looking for this script :lol:

but can u make it for nicks not hosts ???????


thx alot alot

Code: Select all

Use code snippet in my post below
Last edited by speechles on Sat May 17, 2008 4:15 am, edited 3 times in total.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

TRB wrote:I'm having a problem with users who use +x (hostname masking). Is there a way around that without having the user do anything? User privacy is a big concern, and I don't want to reveal their IP address if I don't have to.
ident@users*thatnet.org - of course users*thatnet.org is merely an example.
This would be the only way to accomplish it (hopefully your privileged users have unique enough idents.. heh). Keep in mind you can use asterisks in the hostname using this script. It uses string match for field comparing which does accept wildcards (aka asterisks).
User avatar
4mirc
Voice
Posts: 37
Joined: Fri May 16, 2008 11:11 pm
Contact:

Post by 4mirc »

thx speechles for the reply
can u help me to make this script ?
i need it :(

http://forum.egghelp.org/viewtopic.php?t=15748
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

change this:
if {[string match -nocase "$host" $line]} {
to this:
if {[string match -nocase $line "$nick!$host"]} {
corrected code above, see note in post below.
This would solve everything. Makes this script able to allow any nick!ident@host combinations.
To add a nick, !addinvite nick!*@*
To add a nick with a unique ident, !addinvite nick!ident@*
To add a bare host with no nick or ident, !addinvite *!*@host.goes.here
And so and and so forth, doing it this way allows you flexibility to work around things..

@4mirc, I can help you sure. But for my help it requires you make some effort as well..Making a request for a script using red is not helping.. It doesn't make your request any more urgent than the other requests made using normal text. Why you felt the need to enshroud your entire post into the angry color red goes without question....
Last edited by speechles on Sat May 17, 2008 4:31 am, edited 3 times in total.
User avatar
4mirc
Voice
Posts: 37
Joined: Fri May 16, 2008 11:11 pm
Contact:

Post by 4mirc »

hi speechles

im looking for script like adding nicks in text

so when any nick connected the bot will read the nick

like a notify script

i did what u said and i added my nick nothing happen :|

dunno whats the problem
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

4mirc wrote:hi speechles

im looking for script like adding nicks in text

so when any nick connected the bot will read the nick

like a notify script

i did what u said and i added my nick nothing happen :|

dunno whats the problem
notify? how exactly is the eggdrop to realize the event? Is this person joining a channel in common with the eggdrop? If so, change the invite portion of this script to fit your need. This is not rocket science or nuclear chemistry. If you make a mistake, your bot will simply crash. This does not end the world. When you revise a script, never tamper with the original working script. Make a copy, call it *-WIP.*, and add that to your bot when doing modifications. In this way, if for some reason something goes drastically wrong and you can't remember how to undo whats been done, it's as simple as going back to the last working version of the script.

Note: follow my advice in the last section where I mention code snippets. The post where I show how to add nick!*@* and such. This fix does indeed work, why wouldn't it? Trust in the string match, especially with it's -nocase. nIcK!wItH.a@fUnKy.L3EteD.uP.vHoSt using differing combinations of random cases, this not a problem to match against as long as you get the letters right, the nocase makes case hereby irrelevant... I can't see how this is a problem...
<speechles> .tcl set question [string match "does!this@match" "does!*@*" ]
<sp33chy> Tcl: 0
<speechles> .tcl set question [string match "does!*@*" "does!this@match" ]
<sp33chy> Tcl: 1
<speechles> .tcl set question [string match "*oe*!*s@*ch" "does!this@match" ]
<sp33chy> Tcl: 1
I naturally assumed this worked either way, apparently I was wrong. Corrected the code in the fix above to work now, it will behave as intended. Try it and let me know if it doesn't.. ;)

Note: the original coder of this script is using string match backwards as well, and using wildcards of any sort will result in 0 (no match) rather than 1 (match)
User avatar
4mirc
Voice
Posts: 37
Joined: Fri May 16, 2008 11:11 pm
Contact:

Post by 4mirc »

hi speechles

i changed this

Code: Select all

if {[string match -nocase "$host" $line]} { 
to this: 
if {[string match -nocase $line "$nick!$host"]} {
but nothing happen but when i changed

Code: Select all

if {[string match -nocase "$host" $line]} { 
to this: 
if {[string match -nocase $line "$nick"]} {
my bot working 100%

thx again :)
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

The reason the correct code didn't work is because you didn't enter a valid entry (also when making this modifcation to the script, deleting the old .txt database, and rebuild all using the below method is required).
!addinvite nick!*@* - add by nick
!addinvite *!ident@* - add by ident
!addinvite *!*@hostna.me - add by hostname

Of course combinations of any of these methods is allowed as well.

Code: Select all

change:
if {[string match -nocase "$host" $line]} { 
to this: 
if {[string match -nocase $line "$nick!$host"]} {
bestest.
Post Reply