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.

chanset via msg command

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

chanset via msg command

Post by simo »

i was wondering how this could be modified to use with private msging the bot instead of public command on channel

Code: Select all

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.
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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: Select all

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]..."
   }
}
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

Code: Select all

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 :roll:
ComputerTech
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thanks i tried that and it Gives me the Same result
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tried it like this and it seems to work altho not sure if this is proper:

Code: Select all


#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
}

 
Post Reply