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.

how to get the reason from trigger command

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
G
Gulio
Halfop
Posts: 74
Joined: Sun Nov 01, 2020 11:53 am

how to get the reason from trigger command

Post by Gulio »

I want to get on notice new reason i added like the first command .shun Dorian 2 . relax also and to shun multi nick like default .shun Dorian Emilia Jolee and .shun Dorian Emilia Jolee 20 . reason
in first notice msg reason is come as default reason not the reason "relax"
If someone can help thx in advance



Triiger Command:

Code: Select all

[16:43:48] <Giulio> .shun Dorian 2 . relax
[16:44:05] <Giulio> .shun Emilia
[16:45:18] <Giulio> .shun Jolee 3
how need to be the reason for this comand <Giulio> .shun Dorian 2 . relax

Code: Select all

Shun added for *@72.221.164.34 on Sat Jul 17 13:43:51 2021 GMT (from Bot to expire at Sat Jul 17 13:45:51 2021 GMT: SHUN for Dorian - Reson: relax - Time: 2 min. )

Notice action shun:

Code: Select all

Shun added for *@72.221.164.34 on Sat Jul 17 13:43:51 2021 GMT (from Bot to expire at Sat Jul 17 13:45:51 2021 GMT: SHUN for Dorian - Reson: Abusers - Time: 2 min. )
Shun added for *@72.195.114.184 on Sat Jul 17 13:44:08 2021 GMT (from Bot to expire at Sat Jul 17 13:49:08 2021 GMT: SHUN for Emilia - Reson: Abusers - Time: 5 min. )
Shun added for *@98.162.25.7 on Sat Jul 17 13:45:21 2021 GMT (from Bot to expire at Sat Jul 17 13:48:21 2021 GMT: SHUN for Jolee - Reson: Abusers - Time: 3 min. )
Script:

Code: Select all

bind pub -|- .shun proc_shun

proc proc_shun {nick host hand chan text} {
	if {![onchan $nick #Oper ]} { return }
	set nick [lindex [split $text] 0]
	set reason [join [lrange [split $text "."] 1 end] "."]
	set text  [lindex [split $text "."] 0]
	set last_el [lindex $text end]

	## determine if last element is a number. If it is,  use it as ban time in minutes.  If it is not, then default bant time is 5 minutes.
	if {[string is digit $last_el]} {
		set text [lrange $text 0 end-1]
		set ban_time_min $last_el
	} else {
		set ban_time_min 5
	}
	set ban_time [expr {$ban_time_min * 60}]
	set nick [split [string trim $text]]

	if {$reason eq ""} { set reason " SHUN for $nick - Reason: $reason - Time: $last_el min. "
	} else { set reason " SHUN for $nick - Reason: Abuser -Time: $ban_time_min min. " }
	set nick [split [string trim [lindex [split $text "."] 0]]]

	if {[set chost [getchanhost $nick]] ne ""} {
		switch -glob -- $chost {
			{*.irccloud.com} - {*.mibbit.com} - {*.kiwiirc.com} {
				scan $chost {%[^@]} ident
				putnow "SHUN [string trimleft $ident@*] $ban_time $reason"
			}
			{default} {
				putnow "SHUN $nick2 $ban_time $reason"
			}
		}
	}
}

G
Gulio
Halfop
Posts: 74
Joined: Sun Nov 01, 2020 11:53 am

Hello

Post by Gulio »

i fixed reason command but how to make multi nick shun ?

this

Code: Select all

if {$reason eq ""}
with

Code: Select all

if {$reason ne ""}
is this good ?

Code: Select all


bind pub -|- .shun proc_shun


proc proc_shun {nick host hand chan text} {
	if {![onchan $nick #shqiperia ]} { return }
	set nick [lindex [split $text] 0]
	set reason [join [lrange [split $text "."] 1 end] "."]
	set text  [lindex [split $text "."] 0]
	set last_el [lindex $text end]

	## determine if last element is a number. If it is,  use it as ban time in minutes.  If it is not, then default bant time is 5 minutes.
	if {[string is digit $last_el]} {
		set text [lrange $text 0 end-1]
		set ban_time_min $last_el
	} else {
		set ban_time_min 5
	}
	set ban_time [expr {$ban_time_min * 60}]
	set nick [split [string trim $text]]

			   if {$reason ne ""} { set reason " SHUN for $nick - Reason: $reason - Time: $last_el min. "
   } else { set reason " SHUN for $nick - Reason: Abuser -Time: $ban_time_min min. " }
			set nick [split [string trim [lindex [split $text "."] 0]]]

	foreach user $text {

		if {![onchan $user $chan]} {
			putserv "NOTICE $nick $user is not on channel $chan"
		} else {

			if {[set chost [getchanhost $nick]] ne ""} {
				switch -glob -- $chost {
					{*.irccloud.com} - {*.mibbit.com} - {*.kiwiirc.com} {
						scan $chost {%[^@]} ident
						putnow "SHUN [string trimleft $ident@*] $ban_time $reason"
					}
					{default} {
						putnow "SHUN $nick $ban_time $reason"
					}
				}
			}
		}
	}
}
G
Gulio
Halfop
Posts: 74
Joined: Sun Nov 01, 2020 11:53 am

hi

Post by Gulio »

Is fixed now can shun multi nicks

Code: Select all

bind pub -|- .shun proc_shun


proc proc_shun {nick host hand chan text} {
	if {![onchan $nick #shqiperia ]} { return }
	set nick2 [lindex [split $text] 0]
	set reason [join [lrange [split $text "."] 1 end] "."]
	set text  [lindex [split $text "."] 0]
	set last_el [lindex $text end]

	## determine if last element is a number. If it is,  use it as ban time in minutes.  If it is not, then default bant time is 5 minutes.
	if {[string is digit $last_el]} {
		set text [lrange $text 0 end-1]
		set ban_time_min $last_el
	} else {
		set ban_time_min 5
	}
	set ban_time [expr {$ban_time_min * 60}]
	set nick2 [split [string trim $text]]

	if {$reason ne ""} { set reason " SHUN for $nick2 - Reason: $reason - Time: $last_el min. "
	} else { set reason " SHUN for $nick2 - Reason: Abuser -Time: $ban_time_min min. " }
	set nick2 [split [string trim [lindex [split $text "."] 0]]]

	foreach nick2 $text {

		if {![onchan $nick2 $chan]} {
			putserv "NOTICE $nick $nick2 is not on channel $chan"
		} else {

			if {[set chost [getchanhost $nick]] ne ""} {
				switch -glob -- $chost {
					{*.irccloud.com} - {*.mibbit.com} - {*.kiwiirc.com} {
						scan $chost {%[^@]} ident
						putnow "SHUN [string trimleft $ident@*] $ban_time $reason"
					}
					{default} {
						putnow "SHUN $nick2 $ban_time $reason"
					}
				}
			}
		}
	}
}
Post Reply