| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Feb 23, 2021 12:29 pm Post subject: chanset via msg command |
|
|
i was wondering how this could be modified to use with private msging the bot instead of public command on channel
| Code: |
bind pub n|n .chanset pub:chanset
proc pub:chanset {nick uhost hand chan text} {
set value [lassign $text mode]
if {![info exists value] || $value eq ""} {
catch {channel set $chan $mode} error
} else {
catch {channel set $chan $mode $value} error
}
if {$error == ""} {
putnow "NOTICE $nick :Successfully set $text"
} else {
putnow "NOTICE $nick :Error setting $text: [lindex $error 0]..."
}
}
|
so instead of .chanset +somesetting on channel
to use chanset #channel +somesetting in PM of Bot
Last edited by simo on Tue Feb 23, 2021 5:29 pm; edited 1 time in total |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Feb 23, 2021 3:42 pm Post subject: |
|
|
i tried this but if the mode isnt filled it still seems to execute wich doesnt seem right
for example doing: chanset #channel
outputs: Successfully set on #channel
| Code: |
bind msg n chanset pm_chanset
proc pm_chanset {nick host hand text} {
lassign [split $text] chanX2 chansetpart
if {![info exists chanX2] || $chansetpart eq ""} {
catch {channel set $chanX2 $chansetpart} error
} else {
catch {channel set $chanX2 $chansetpart} error
}
if {$error == ""} {
putnow "PRIVMSG $nick :Successfully set $chansetpart on $chanX2"
} else {
putnow "PRIVMSG $nick :Error setting $text: [lindex $error 0]..."
}
}
|
|
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Tue Feb 23, 2021 3:54 pm Post subject: |
|
|
| Code: |
bind MSG n|n chanset pub:chanset
proc pub:chanset {nick host hand text} {
set chan [lindex [split $text] 0]
set target [lindex [split $text] 1 end]
set value [lassign $target mode]
if {![info exists value] || $value eq ""} {
catch {channel set $chan $mode} error
} else {
catch {channel set $chan $mode $value} error
}
if {$error == ""} {
putnow "NOTICE $nick :Successfully set $text"
} else {
putnow "NOTICE $nick :Error setting $text: [lindex $error 0]..."
}
}
|
Not tested  _________________ ComputerTech |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Feb 23, 2021 4:25 pm Post subject: |
|
|
| thanks i tried that and it Gives me the Same result |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Feb 23, 2021 4:49 pm Post subject: |
|
|
i was looking at : http://forum.egghelp.org/viewtopic.php?p=95528#95528
it looks usefull for this porpose but im not sure how to use it to combine the two to have public command and private message combined in 1 proc if possible |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Feb 23, 2021 5:29 pm Post subject: |
|
|
i tried it like this and it seems to work altho not sure if this is proper:
| Code: |
#syntax:/msg bot chanset channel -+somesetting
bind msg n chanset pm_chanset
proc pm_chanset {nick uhost handle text} {
set chan [join [lindex [split $text] 0]]
set msg [join [lrange [split $text] 1 end]]
set items [split $text]
if {[llength $items] < 2} { putnow "notice $nick :Syntax chanset #channel +/-some-setting" ; return }
pub:chanset $nick $uhost $handle $chan $msg
}
|
|
|
| Back to top |
|
 |
|