| View previous topic :: View next topic |
| Author |
Message |
iNFERiON Voice
Joined: 13 Nov 2004 Posts: 7
|
Posted: Wed Jan 18, 2006 6:14 am Post subject: auto-invite script |
|
|
Description pretty much says it all, enjoy
| Code: | #######################
## 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" |
|
|
| Back to top |
|
 |
pavel_kbc Voice
Joined: 28 Dec 2006 Posts: 23
|
Posted: Fri Dec 29, 2006 4:43 pm Post subject: |
|
|
| its really good . but can you make it for multiple channel? please |
|
| Back to top |
|
 |
TRB Voice
Joined: 02 Feb 2008 Posts: 1
|
Posted: Sat Feb 02, 2008 9:58 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
4mirc Voice

Joined: 16 May 2008 Posts: 37
|
Posted: Fri May 16, 2008 11:42 pm Post subject: |
|
|
hiiiiiiiiiiiiiiii
im looking for this script
but can u make it for nicks not hosts ???????
thx alot alot |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat May 17, 2008 2:48 am Post subject: |
|
|
| 4mirc wrote: | hiiiiiiiiiiiiiiii
im looking for this script
but can u make it for nicks not hosts ???????
thx alot alot |
| Code: | | Use code snippet in my post below |
Last edited by speechles on Sat May 17, 2008 4:15 am; edited 3 times in total |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat May 17, 2008 2:54 am Post subject: |
|
|
| 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). |
|
| Back to top |
|
 |
4mirc Voice

Joined: 16 May 2008 Posts: 37
|
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat May 17, 2008 4:00 am Post subject: |
|
|
| Code: | 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 |
|
| Back to top |
|
 |
4mirc Voice

Joined: 16 May 2008 Posts: 37
|
Posted: Sat May 17, 2008 4:03 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat May 17, 2008 4:08 am Post subject: |
|
|
| 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... | Quote: | <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) |
|
| Back to top |
|
 |
4mirc Voice

Joined: 16 May 2008 Posts: 37
|
Posted: Sun May 18, 2008 10:45 pm Post subject: |
|
|
hi speechles
i changed this
| Code: | if {[string match -nocase "$host" $line]} {
to this:
if {[string match -nocase $line "$nick!$host"]} { |
but nothing happen but when i changed
| Code: | if {[string match -nocase "$host" $line]} {
to this:
if {[string match -nocase $line "$nick"]} { |
my bot working 100%
thx again  |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Mon May 19, 2008 12:33 am Post subject: |
|
|
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: | change:
if {[string match -nocase "$host" $line]} {
to this:
if {[string match -nocase $line "$nick!$host"]} { |
bestest. |
|
| Back to top |
|
 |
|