egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

chanset via msg command

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Feb 23, 2021 12:29 pm    Post subject: chanset via msg command Reply with quote

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
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Feb 23, 2021 3:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Tue Feb 23, 2021 3:54 pm    Post subject: Reply with quote

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 Rolling Eyes
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Feb 23, 2021 4:25 pm    Post subject: Reply with quote

thanks i tried that and it Gives me the Same result
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Feb 23, 2021 4:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Feb 23, 2021 5:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber