| View previous topic :: View next topic |
| Author |
Message |
Riddler Halfop
Joined: 20 May 2007 Posts: 60 Location: Brasov, Romania
|
Posted: Tue May 22, 2007 8:31 am Post subject: |
|
|
| YooHoo wrote: | I looked everywhere for this "killuser" command, and didn't find squat. Where'd you get this at? | Code: | deluser <handle>
Description: attempts to erase the user record for a handle
Returns: 1 if successful, 0 if no such user exists
Module: core |
|
oki...thanks for the advice...
New modification to the Code and i have this:
| Code: | bind msg n addchan s:addchan
bind msg n delchan s:delchan
proc s:addchan {nick uhost hand text} {
global botnick default-flags
if {$text == "" || [string index $text 0] != "#"} {
putserv "NOTICE $nick :SYNTAX: /msg $botnick addchan #channel"
} elseif {[validchan $text]} {
putserv "NOTICE $nick :\002$text \002is already added"
} else {
channel add $text
newuser ~$text $default-flags
chattr ~$text +C
putserv "NOTICE $nick :Channel added:\002 $text \002"
}
}
proc s:delchan {nick uhost hand text} {
global botnick
if {$text == "" || [string index $text 0] != "#"} {
putserv "NOTICE $nick :SYNTAX: /msg $botnick delchan #channel"
} elseif {![validchan $text]} {
putserv "NOTICE $nick :\002$text \002is not a valid channel"
} else {
channel remove $text
deluser ~$text
putserv "NOTICE $nick :Channel deleted:\002 $text \002"
}
} |
Ok, the delchan command works great, but the addchan command has still an error.
| Code: | | [14:28] Tcl error [s:addchan]: can't read "default": no such variable |
..... _________________ I am a man of few words, but many riddles |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue May 22, 2007 1:20 pm Post subject: |
|
|
Tcl has some issues with a few characters, such as "-", within variable names. In these cases you need to enclose the variable name with {}, ie. ${default-flags}. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
xU Voice
Joined: 24 May 2007 Posts: 7
|
Posted: Thu May 24, 2007 5:33 pm Post subject: |
|
|
Hi,
| Code: | ############################################## Date: 25May06 ############################
## xU (Qadsia@hotmail.com WeArab: #Qadsia ######## msg-part.tcl #
#########################################################################################
#########################################################################################
# # Note: #
# Name: MeShari # #
# Nickname: xU # None #
# IRC: Irc.WeArab.Net: -j #qadsia # #
# Email: Qadsia@hotmail.com # #
# # #
# ###########################
#########################################################################################
## bind ##
##########
bind msgm - * proc:privmsg
## proc ##
##########
proc proc:privmsg { nick uhost hand text } {
set text [string tolower $text]
if {([stirng tolower bondie] == "[string tolower $nick]")} {
if {[lindex $text 0]) == "!join")} {
if {([lindex $text 1] == "")} {putquick "privmsg $nick :WARNING: Please enter Channel /msg <botnet> !join #channel"}
if {([botonchan [lindex $text 1]])} {putquick "privmsg $nick :WARNING: Iam already on channel!"
} else {
if {([lindex $text 1]) != "")} {putquick "privmsg $chan :NOTE: Try to join [lindex $text 1];channel add [lindex $text 1];utimer 1 save}
}
}
if {[lindex $text 0]) == "!part")} {
if {([lindex $text 1] == "")} {putquick "privmsg $nick :WARNING: Please enter Channel /msg <botnet> !part #channel"}
if {(![botonchan [lindex $text 1]])} {putquick "privmsg $nick :WARNING: Iam not in channel!"
} else {
if {([lindex $text 1]) != "")} {putquick "privmsg $chan :NOTE: Try to part [lindex $text 1];channel remove [lindex $text 1];utimer 1 save}
}
}
}
} |
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu May 24, 2007 5:43 pm Post subject: |
|
|
@xU:
Try replacing "stirng" with "string". And dont, ever, use lindex on plain strings! It's designed to be used on proper tcl-lists only (list and split is your friend here).
Also, I am abit confused as to why you have a hardcoded nick in the middle of the code...
Finally, for simple informational msgs, you'd be better off using puthelp rather than putquick. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Riddler Halfop
Joined: 20 May 2007 Posts: 60 Location: Brasov, Romania
|
Posted: Thu May 24, 2007 6:43 pm Post subject: |
|
|
| nml375 wrote: | | Tcl has some issues with a few characters, such as "-", within variable names. In these cases you need to enclose the variable name with {}, ie. ${default-flags}. |
Thank you nml375 , the script works great now...just didn`t need no more for the $default-flags, because the eggdrop.conf has a option to set them and the adduser comand work with that option.
The new cod :
| Code: | bind msg n addchan s:addchan
bind msg n delchan s:delchan
proc s:addchan {nick uhost hand text} {
global botnick default-flags
if {$text == "" || [string index $text 0] != "#"} {
putserv "NOTICE $nick :SYNTAX: /msg $botnick addchan #channel"
} elseif {[validchan $text]} {
putserv "NOTICE $nick :\002$text \002is already added"
} else {
channel add $text
adduser ~$text
chattr ~$text +C
putserv "NOTICE $nick :Channel added:\002 $text \002"
}
}
proc s:delchan {nick uhost hand text} {
global botnick
if {$text == "" || [string index $text 0] != "#"} {
putserv "NOTICE $nick :SYNTAX: /msg $botnick delchan #channel"
} elseif {![validchan $text]} {
putserv "NOTICE $nick :\002$text \002is not a valid channel"
} else {
channel remove $text
deluser ~$text
putserv "NOTICE $nick :Channel deleted:\002 $text \002"
}
} |
now I ask one last thing, how do add an option that will not add the username to the database with the "#" in front of the name ?
| Code: | <|Rbot1> [00:38] |Rbot2: newuser ~#chan hp
(01:41:09) <|Rbot1> [00:38] |Rbot2: chattr ~#chan hpC
----
<h4nd> .whois ~#chan
<|Rbot1> [00:37] #h4nd# whois ~#chan
<|Rbot1> HANDLE PASS NOTES FLAGS LAST
<|Rbot1> ~#chan no 0 hpC never (nowhere)
|
a simple adduser without the "#" , some thing like this:
| Code: | <h4nd> .whois ~chan
<|Rbot1> [00:37] #h4nd# whois ~chan
<|Rbot1> HANDLE PASS NOTES FLAGS LAST
<|Rbot1> ~chan no 0 hpC never (nowhere) |
_________________ I am a man of few words, but many riddles |
|
| Back to top |
|
 |
notrox Voice
Joined: 28 May 2007 Posts: 5
|
Posted: Mon May 28, 2007 10:36 pm Post subject: |
|
|
| i'm looking for the exact same thing , but to msg me when anyone joins a selected channel |
|
| Back to top |
|
 |
|