knk.tcl

knk.tcl

TCL snippet that uses custom commands for chanops: !uptime, !cmds, !rehash, !join <#channel>, !part <#channel>

Postat de Copyright Categorie Review user Vizualizari Data
btc Ian Preglo chanops Cod netestat 402 2023-12-25 09:55:36

######
#
#
#KnK Script v1.0 by Ian Preglo and Marluo Anuengo
#   Ian Preglo a.k.a KALAG <krampstyle@gmail.com> a.k.a BANKY <irc.freenode.net #garo-shells>
#   Marluo Anuengo a.k.a reggaeky0 <reggaeky0@undernet.org>
#
#Available commands:
#
#!uptime
#!cmds
#!rehash
#!join <#channel>
#!part <#channel>
#
####


#set this to "-" if you want everyone to use the !uptime command

set userflag "h"

#set this to any word you want to type if you want to see the bots uptime

set trig "!uptime"

#set this to any word you want to type if you want to see the list of commands

set trigg "!cmds"


#####DONT EDIT IF YOU DONT UNDERSTAND ANY OF THE STUFF BELOW######

bind PUB $userflag $trig main_func
bind PUB $userflag $trigg upcom
bind PUB $userflag !join join_func
bind PUB $userflag !part part_func
bind PUB $userflag !rehash rehash_func
bind JOIN $userflag * onjoin_func

proc main_func {nick uhost hand chan arg} {show_uptime $nick $uhost $hand $chan $arg}

proc show_uptime {nick uhost hand chan arg} {
catch {exec uptime} shelluptime
catch {exec uname -ms} shellver
putserv "PRIVMSG $chan :\0032,0::::KnK Script v1.0::::\003"
puthelp "PRIVMSG $chan :\0038,2Bot Uptime:\0037\002 [duration [expr [clock seconds] - $::uptime]]\002\003" 
puthelp "PRIVMSG $chan :\00311,2Shell Uptime:\0039$shelluptime running on \0030$shellver\003"
}

proc upcom {nick uhost hand chan arg} {
   global botnick
   putserv "NOTICE $nick : \0032,0::::KnK Script v1.0 Commands Version 1.0::::\003"
   putserv "NOTICE $nick : BotNick: $botnick"
   putserv "NOTICE $nick : Here Are The List Of Available Commands:"
   putserv "NOTICE $nick : !cmds - It will show you the list of commands"
   putserv "NOTICE $nick : !uptime - It will show you the Bot & Shell Uptime."
   putserv "NOTICE $nick : !rehash - Reloads all the scripts and config files of the bot."
   putserv "NOTICE $nick : !join <#channel> - Make the bot join a channel."
   putserv "NOTICE $nick : !part <#channel> - Make the bot leave a channel."
   putserv "NOTICE $nick : \00311,1Created by \0039Ian Preglo\003"
   putserv "NOTICE $nick : \00311,1Contributed by \0039Marluo Anuengo\003"
   putserv "NOTICE $nick : \0032,0:::::End of KnK Script Command List:::::\003"
}

proc join_func {nick uhost hand chan arg} {
set target "[lindex $arg 0]"
if {[expr { $target == "" || [expr { [string index $target 0] != "#"}] } ]} { puthelp "NOTICE $nick :Command usage: !join <#channel>. Type !cmds for a list of commands."
		         return 1	
	} else { global server
		   channel add $target
               putserv "NOTICE $nick :Joined $target on $server"
             }
}

proc part_func {nick uhost hand chan arg} {
set ptarg "[lindex $arg 0]"
if {[expr { $ptarg == "" || [expr { [string index $ptarg 0] != "#"}] } ]} { puthelp "NOTICE $nick :Command usage: !part <#channel>. Type !cmds for a list of commands."
		         return 1	
	} else { global server
		   channel remove $ptarg
               putserv "NOTICE $nick :Parted $ptarg on $server"
             }
}

proc rehash_func {nick uhost hand chan arg} {
putserv "PRIVMSG $chan :Rehashing..."
rehash
putserv "PRIVMSG $chan :$nick Rehashing was successful!"
}

proc onjoin_func {nick uhost hand chan} {
putserv "NOTICE $nick :KnK Script v1.0 is loaded on this bot."
putserv "NOTICE $nick :Type \0032,0!cmds\003 to see available commands"
}

############################################################
putlog "\0034KnK Script v1.0 by Ian Preglo and Marluo Anuengo has been loaded.\003"