Top

Simple Tcl example bot


TCL Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  May 14, 2008
Last Updated  May 14, 2008
Tags  bot  tcl 

Introduction

Tcl example bot (use in linux OS but will work on windows) it doesnt do anything aside from connect identify to nickserv and join the channels specified

if you want to add to this such as commands and admin authorization contact me here on hawkee.com via msg

run with: 'tclsh filename.tcl &'
if you don't add the & at the end, your terminal window will be locked until the bot is closed.

do what you like with the code =D

Grab the Code

#### "Simple Tcl irc bot", Version: 1.0, Created by: mentalglitch
 
package require Tcl 8.5
 
### Vairables. Edit these
 
array set main {
 server "irc.icq.com"
 port "6667"
 nick "T-Bot"
 user "TclBot"
 rname "Simple Tcl irc bot"
 nickpass "qj3h5bag"
 mymodes "+iBT-G"
 channels "#chan1,#chan2,#chan3"
}
 
### Do not edit below this line
 
set main(sock) "0"
 
### Procs
 
proc send {raw} {
 global main
 puts $main(sock) "$raw"; flush $main(sock)
 return
}
 
proc startsock {s p} {
 global main
 catch {socket $s $p} main(sock)
 send "NICK $main(nick)"
 send "\nUSER $main(user) * $main(server) :$main(rname)"
 recv $main(sock)
}
 
proc recv {sid} {
 global main
 while {[set argu [gets $sid]] != "-1"} {
  if {[llength [split $argu]] < 1} {break}
  set argu [split $argu]
  set nick [lindex [split [lindex $argu 0] :!@] 1]
  set user [lindex [split [lindex $argu 0] :!@] 2]
  set host [lindex [split [lindex $argu 0] :!@] 3]
  set sw "[lindex $argu 1]"
  switch -exact $sw {
   001 {serverinit $sid}
   PING {send "PONG [join [lindex $argu 2]]"}
  }
 }
}
 
proc serverinit {sid} {
 global main
 send "MODE $main(nick) $main(mymodes)"
 send "PRIVMSG nickserv :identify $main(nickpass)"
 after 420 set next 1
 vwait next
 send "JOIN :$main(channels)"
}
startsock $main(server) $main(port)

Comments

  (2)  RSS
mentalglitch
Comments: 22
 
TCL Snippet:  Simple Tcl example bot
Posted on Jun 17, 2008 8:21 pm
don't use this due to various TCL updates it wont work anymore
juhapuha
Comments: 73
 
TCL Snippet:  Simple Tcl example bot
Posted on Nov 24, 2008 6:30 pm
I've made a TCL bot too. The base takes hours to be completed, if you want your bot so be smart (know it's channels, channels of user, hosts, prefixes, authnames etc...) though the biggest problem for me was getting the new prefixes of nicks when they got mass-deopped/opped/voiced/devoiced.. Spending time with the bot makes it smar, light and efficient.

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom