TeamSpeak 3 Interaction Script v1.2

By Prulez on Feb 17, 2010

README - Teamspeak 3 Interaction script
Original TS2 script by aca20031
Modified for usage with TS3 by Prulez - http://exoduscommunity.com

----Instructions ----

How to install

1) Extract the files to your mIRC directory (This probably is C:\Program Files\mIRC, C:\Documents and Settings\\Application Data\mIRC or C:\Users\\AppData\Roaming\mIRC
2) Load the file into Remotes by pressing ALT+R in mIRC, then going to File --> Load and selecting the file.
--If this fails, type "/load -rs teamspeak3_interaction.mrc" in mIRC. (Without quotes)
3) You should now see messages about using the script, where to get support and keeping the version message intact. Please read them carefully.
4) Also, a setup dialog should have been opened. Please fill in the data in this dialog. You need a ServerQuery account on TeamSpeak, read below on how to create one.
5) Make your bot rejoin the channel you specified in the configuration and type !TS Connect if the bot does not autoconnect. (You need % or @ to use !TS Connect)
6) Enjoy!

Creating a ServerQuery account on TeamSpeak 3
1) Open TeamSpeak 3 and connect to your server. Make 100% sure you are a serveradmin before doing this!
2) Go to Permissions --> Set ServerQuery Login in TeamSpeak 3 and enter the nickname you want to use to connect. Enter this nickname in the setup dialog. (Case Sensitive!)
3) When you click OK, you should recieve your password. Copy-paste this into the setup dialog.
4) Done!

What commands can I use?
Type !TS Help to see all the available commands.

---- FAQ ----

The script does not connect to the server!

  • Follow the instructions given by the script and triple-check your settings in the setup dialog.

I can't figure this out! Help me!

  • I will only provide support for this script at my own community, Exodus Gaming. I will only provide limited support on other websites, channels or networks.

  • Website: http://exoduscommunity.com - Register there and PM "Prulez". Please specify the problem you have and also provide messages the bot outputs (if any). Also provide the network/channel you're using.
  • IRC: irc.exoduscommunity.com, #exodus-home. PM "Prulez" on there. If I'm not there, then please contact me using the website.

Can I get rid of the !TS Version command? Your nickname and community advertisement are annoying me!
In theory, yes, you can get rid of it. Though, I would highly appreciate it if you wouldn't remove it. I won't help you with removing it, either.

I have spent a lot of hours creating this script. I could have kept it exclusive for my community, but as the need for a good script is high I am kind enough to release my modification of the TS2 Interaction script by aca20031.
Also, when I find out that you have removed this command, I will not provide any support anymore, would you need it. Also, I will send a horde of angry rabbits your way. You have been warned.

I love you for creating this! How can I express my endless love towards you?
When you like this script, you can join my community. You can also send me a PM with your thanks, they are appreciated a lot.
If you feel really generous, a PayPal donation using the donate button on our forums would be highly appreciated.

I've found a bug/got a suggestion. Where can I submit it?
Simple, contact me on IRC or on our Website, listed above.

---- Changelog ----
1.2 - 22 Feb 2010

  • Removed tsconfig.ini and added a setup dialog (!)
  • Multi-Channel support (!)
  • Banning from IRC added: !TS Ban
  • Slight re-ordering of the script and added more comments
  • Server ID is now found using "serveridgetbyport" instead of serverlist and looping through the servers.
  • Added more checks to see if commands are being executed successfully, and if not, it will tell you so.
  • Added error messages incase connecting to the server messes up somewhere and gives you some leads where the cause can possibly be found.
  • A menu has been added to find the dialog again and to send commands from the client itsself.

1.1 - 18 Feb 2010

  • Added $htmlconv alias that was missing and messed up all output.

1.0 - 17 Feb 2010

  • Initial release

---- Planned ----

  • Allow multiple TS3 Servers (This will take quite a while to script and to change the dialogs accordingly
  • Showing the banlist on IRC when requested
  • Removing bans from IRC

---- Known bugs ----

  • When an user connects with the ";" character in his/her name, the output will be modified and/or commands will not work. [Will be fixed in 1.3]
  • When a message is sent with the ";" character in it, the message will not be sent properly. [Will be fixed in 1.3]
  • When you have multiple channels setup, the messages will not show up anymore inside the channels on your mIRC client. They are sent, though.

Best of luck!
-Prulez

Image

;********************************************
;TeamSpeak 3 Script by Prulez - Version 1.2
;Support will ONLY be given at Exodus Community IRC/Site
;Website: http://www.exoduscommunity.com
;IRC: irc.exoduscommunity.com #exodus-home
;----------
;This script is a modification of the original TS2 script by aca20031
;Lots of hours have been spent into modifying this script so YOU can use it easily.
;When you use, release or modify this script, please leave this message intact, along with the !TS Version command.
;If you do not keep the version message intact as-is, then I will not provide any support.
;----------
;When you have encountered any bugs, or have any suggestions, then please contact me at the site or IRC given above.
;Thanks and have fun with my script!
;*******************************************

;================================
;===== on LOAD event

on *:LOAD: {
  ts3setup
  set %ts.sversion 1.2
  echo -a 7TeamSpeak 3 Script by Prulez has been loaded! Version %ts.sversion
  echo -a 11Support will ONLY be given at the Exodus Gaming Community IRC/Site
  echo -a 11Website: http://www.exoduscommunity.com
  echo -a 11IRC: irc.exoduscommunity.com #exodus-home
  echo -a ----------
  echo -a 11This script is a modification of the original TS2 script by aca20031
  echo -a 11Lots of hours have been spent into modifying this script so YOU can use it easily.
  echo -a 11When you use, release or modify this script, please leave this message intact, along with the !TS Version command.
  echo -a 11If you do not keep the version message intact as-is, then I will not provide any support.
  echo -a ----------
  echo -a 11When you have encountered any bugs, or have any suggestions, then please contact me at the site or IRC given above.
  echo -a 11Thanks and have fun with my script!
}

;================================
;===== Menu & Setup Dialog

menu menubar,channel,status,query,nicklist,statusbar { 
  TS3 Interaction
  .Setup:/ts3setup
  .Readme://run $scriptdir $+ ts3readme.txt
  .-
  .Display Server Info:/ts3info %ts.channels
  .Display Users:/ts3users %ts.channels
  .Display Channels:/ts3channels %ts.channels
  .-
  .Kick Client:/ts3kick $$input(What is the nickname of the client you want to kick?, e) $+ ; $+ $$input(What is the reason you want to kick this user?, e) $+ ; $+ $me $+ ; $+ %ts.channels
  .Ban Client:/ts3ban $$input(What is the nickname of the client you want to ban?, e) $+ ; $+ $$input(What is the reason you want to ban this user?, e) $+ ; $+ $me $+ ; $+ %ts.channels
  .-
  .Message Server:/ts3msg $me $+ ; $+ $$input(What's the message that you want to send?, e)
  .PM Client:/ts3pm $$input(What is the nickname of the client you want to PM?, e) $+ ; $+ $$input(What's the message that you want to send?, e) $+ ; $+ $me $+ ; $+ %ts.channels
  .Poke Client:/ts3poke $$input(What is the nickname of the client you want to Poke?, e) $+ ; $+ $$input(What's the message that you want to send?, e) $+ ; $+ $me $+ ; $+ %ts.channels
  .-
  .Advertise Script:/ts3version %ts.channels
}

alias ts3setup {
  /dialog -m ts3setup ts3setup
}

dialog ts3setup {
  ;MAIN DIALOG INFO
  title TS3 Interaction Setup - Version %ts.sversion by Prulez
  size -1 -1 200 185
  option dbu

  ;MAIN BOXES
  box "Channels", 1, 1 1 99 116 
  box "Server Info", 2, 101 1 99 116
  box "Timeout", 3, 1 118 99 52
  box "Login Info", 4, 101 118 99 52

  ;CHANNELS
  edit "#", 5, 3 8 70 10 
  button "Add", 6, 75 8 20 10
  list 7, 3 19 95 90
  button "Delete Channel", 8, 3 105 95 10

  ;SERVER INFO
  box "Server IP", 9, 103 8 95 20
  edit %ts.ip, 10, 105 15 90 10, %ts.ip
  box "Query Port", 11, 103 29 95 20
  edit %ts.qport, 12, 105 36 90 10, %ts.qport
  box "Public IP", 13, 103 50 95 32
  edit %ts.ip.public, 14, 105 57 90 10, %ts.ip.public
  text "The IP clients have to enter in the TS3 client to connect to the server", 15, 107 67 90 15
  box "Server Port", 16, 103 83 95 32
  edit %ts.sport, 17, 105 90 90 10, %ts.sport
  text "The port clients have to enter in the TS3 client to connect to the server", 18, 107 100 90 15

  ;TIMEOUT
  edit %ts.timeout, 19, 3 127 95 10, %ts.timeout
  text "The amount of seconds before the script assumes the server has timed out when it has stopped responding.", 20, 5 138 90 20

  ;LOGIN INFO
  box "Username", 21, 103 126 95 20
  edit %ts.slogin, 22, 105 133 90 10, %ts.slogin
  box "Password", 23, 103 147 95 20
  edit %ts.spass, 24, 105 154 90 10, %ts.spass

  ;OK & CANCEL BUTTONS
  button "Save and Exit", 25, 60 172 40 10, ok
  button "Cancel", 26, 101 172 30 10, cancel
}

on *:DIALOG:ts3setup:*:*: {
  if ($devent == sclick) {
    if ($did == 6) {
      did -a ts3setup 7 $did(ts3setup,5)
      did -ra ts3setup 5 [ $chr(35) ]
    }
    if ($did == 8) {
      did -d ts3setup 7 $did(ts3setup,7).sel
    }
    if ($did == 25) {
      set %ts.channels $didtok(ts3setup,7,44)
    }
  }
  if ($devent == init) {
    didtok ts3setup 7 44 %ts.channels
  }
}

;==========================
;====== Aliases

; ***Converting HTML output to readable output***
alias htmlconv {
  var %t, %u = $regsub($replace($1,<br>,$crlf),/^[^<]*>|<[^>]*>|<[^>]*$/g,,%t)
  if (!$regex(%t,/&\S+?;/)) return %t
  if ($prop == rem) { !.echo -q $regsub(%t,/&\S+?;/g,,%t) | return %t }
  %t = $replace(%t,&nbsp;,$chr(160),&quot;,",&lt;,<,&gt;,>,&amp;,&,&hellip;,...,&reg;,®, $&
    &copy;,©,,&trade;,™,&frac14;,¼,&frac12;,½,&frac34;,¾,&sup3;,³,&sup2;,²,&deg;,°,&bull;,•, $&
    &rsaquo;,›,&lsaquo;,‹,&raquo;,»,&laquo;,&rsquo;,’,&lsquo;,‘,&rdguo;,”,&ldquo;,“,&ndash;, $&
    –,&mdash;,—,&apos;,',&tilde;,~,&times;,×,&divide;,÷,&para;,¶,&ecute;,é,&Ecute;,É,&cent;, $&
    ¢,&pound;,£,&yen;,¥,&sect;,§)
  if ($version < 6.14) || (!$regex(%t,/&\S+?;/)) return %t
  var %html = html $+ $ticks, %body = body $+ $ticks
  .comopen %html htmlfile
  if ($comerr) return %t
  %t = $com(%html,write,1,bstr*,$+(<html><body>,%t,</body></html>))
  %t = $com(%html,body,2,dispatch* %body) $com(%body,innertext,2)
  %t = $com(%body).result
  :error
  if ($com(%body)) .comclose %body
  if ($com(%html)) .comclose %html
  return %t
}

; ***Connecting to the server***
alias ts.connect { sockclose ts3 | if $hget(ts3) { .hfree ts3 } | msg %ts.channels 7[TS3] Attempting to connect to the TS3 server.. | sockopen ts3 %ts.ip %ts.qport | .timertsconfail 1 15 ts.sockclose cc }

; ***Writing to the server***
alias ts3.d { if $sock(ts3) { sockwrite -n ts3 $1- } }

; ***"Translating" output from the server to normal things that's readable***
alias ts.clean { return $htmlconv($remove($replace($replace($replace($1-, \s, $chr(32)), \p, $chr(124)), \/, /),<,>,**,*,<u>,**,</u>,*,)) }

; ***"Translating" input (Messages) to blahblah that the TS3 server can read***
alias ts.input { return $replace($replace($1-, $chr(32), \s), $chr(124), \p) }

; ***!TS Info***
alias ts3info {
  set %ts.getclientlist 1
  set %ts.infochan $1-
  ts3.d channellist
  ts3.d clientlist -away
  ts3.d serverinfo
}

; ***!TS Users***
alias ts3users {
  set %ts.getclientlist 1
  set %ts.userchan $1-
  set %ts.showclientlist 1
  ts3.d channellist
  ts3.d clientlist -away
}

; ***!TS Channels***
alias ts3channels {
  set %ts.displaychanlist 1
  set %ts.chanchan $1-
  ts3.d channellist
}

; ***!TS Msg***
alias ts3msg {
  var %nick = $gettok($1-, 1, 59)
  var %msg = $gettok($1-, 2, 59)
  var %message = $ts.input(( $+ %nick $+ @IRC) %msg)
  ts3.d gm msg= $+ %message
}

; ***!TS Ban***
alias ts3ban {
  var %client = $gettok($1-, 1, 59)
  var %reason = $gettok($1-, 2, 59)
  var %banner = $gettok($1-, 3, 59)
  var %chan = $gettok($1-, 4, 59)
  var %hash = $hfind(ts3, %client $+ *, 1, w)
  if (!%hash) { msg $1- 7[TS3] 9[Ban] 11Unable to find client. | HALT }
  else {
    var %nick = $gettok(%hash, 1, 59)
    var %clid = $gettok(%hash, 2, 59)
    var %msg = $ts.input(( $+ %banner $+ @IRC) %reason)
    set %ts.act ban
    set %ts.banchan %chan
    ts3.d banclient clid= $+ %clid banreason= $+ %msg
    msg %ts.channels 7[TS3] 9[Ban] 3Attempting to ban %nick - 11( $+ %banner $+ @IRC) %reason
  }
}

; ***!TS Poke***
alias ts3poke {
  var %client = $gettok($1-, 1, 59)
  var %message = $gettok($1-, 2, 59)
  var %poker = $gettok($1-, 3, 59)
  var %chan $gettok($1-, 4, 59)
  var %hash = $hfind(ts3, %client $+ *, 1, w)
  if (!%hash) { msg %chan 7[TS3] 9[Poke] 11Unable to find client. | HALT }
  else {
    var %nick = $gettok(%hash, 1, 59)
    var %clid = $gettok(%hash, 2, 59)
    var %msg = $ts.input(( $+ %poker $+ @IRC) %message)
    ts3.d clientpoke clid= $+ %clid msg= $+ %msg
    msg %chan 7[TS3] 9[Poke] 3Poked %nick - 11Message: ( $+ %poker $+ @IRC) %message
  }
}

; ***!TS Kick***
alias ts3kick {
  var %client = $gettok($1-, 1, 59)
  var %message = $gettok($1-, 2, 59)
  var %kicker  $gettok($1-, 3, 59)
  var %chan $gettok($1-, 4, 59)
  var %hash = $hfind(ts3, %client $+ *, 1, w)
  if (!%hash) { msg %chan 7[TS3] 9[Kick] 11Unable to find client. | HALT }
  else {
    var %nick = $gettok(%hash, 1, 59)
    var %clid = $gettok(%hash, 2, 59)
    var %msg = $ts.input(( $+ %kicker $+ @IRC) %message)
    set %ts.act kick
    set %ts.kickchan %chan
    if ($len(%msg) > 40) { msg %chan 7[TS3] 9[Kick] 11Kick message is too long. Limiting it to 40 characters.. | var %msg = $left(%msg, 40) }
    ts3.d clientkick clid= $+ %clid reasonid=5 reasonmsg= $+ %msg
    msg %chan 7[TS3] 9[Kick] 3Attempting to kick %nick - 11( $+ %kicker $+ @IRC) %message
  }
}

; ***!TS PM***
alias ts3pm {
  var %client = $gettok($1-, 1, 59)
  var %message = $gettok($1-, 2, 59)
  var %pmer  $gettok($1-, 3, 59)
  var %chan $gettok($1-, 4, 59)
  var %hash = $hfind(ts3, %client $+ *, 1, w)
  if (!%hash) { msg %chan 7[TS3] 9[PM] 11Unable to find client. | HALT }
  else {
    var %nick = $gettok(%hash, 1, 59)
    var %clid = $gettok(%hash, 2, 59)
    var %msg = $ts.input(( $+ %pmer $+ @IRC) $%message)
    ts3.d sendtextmessage targetmode=1 target= $+ %clid msg= $+ %msg
    msg %chan 7[TS3] 9[PM] 3PM sent to %nick - 11( $+ %pmer $+ @IRC) %message
  }
}

; ***!TS Version***
alias ts3version {
  set %ts.sversion 1.2
  msg $1- 7[TS3] 3[Author] 11This script has been made by Prulez for Exodus Gaming Community, http://exoduscommunity.com
  msg $1- 7[TS3] 3[Version] 11Script version: %ts.sversion
}

; ***Displaying the userlist when requested***
alias ts.displaylist {
  var %totalhash = $hget(ts3, 0).item
  if (%totalhash == 0) {
    msg %ts.userchan 7[TS3] 9No users are currently online.
  }
  if (%totalhash != 0) {
    var %a = 1 
    while (%a <= %totalhash) {
      var %hashname = $hget(ts3, %a).item
      var %cid = $gettok($gettok($hget(ts3, %hashname), 1, 59), 2, 61)
      var %channame = $ts.clean($gettok($hget(ts3chan, %cid), 1, 59))
      var %away = $gettok($gettok($hget(ts3, %hashname), 2, 59), 2, 61)
      var %awaymessage = $ts.clean($gettok($gettok($hget(ts3, %hashname), 3, 59), 2, 61))
      var %clnick = $ts.clean($gettok(%hashname, 1, 59))
      msg %ts.userchan 7[TS3] 9[User %a $+ ] 11 $+ %clnick 3( $+ %channame $+ ) $iif(%away == 1, $iif(%awaymessage, 5(Away: %awaymessage $+ ), 5(Away)))
      inc %a 
    }
  }
  unset %ts.userchan
}

;============================
;==== Connecting & Commands

; ***Connects to TS when you join one of the channels (and if the socket isn't already active)***
on *:join:#:if $nick == $me && $findtok(%ts.channels,$chan,1,44) && !$sock(ts3) { ts.connect }

; ***Referring commands to aliases***
on *:TEXT:*:#: {
  ; ignores text typed anywhere except the ts channel 
  if (!$findtok(%ts.channels,$chan,1,44)) { halt }
  ; command help
  if $1- == !ts { msg # 7[TS3] 3TeamSpeak Commands: 9!TS Users, Channels, Kick, Ban, Msg, PM, Poke, Info, Version - 11"!TS help [command]" for more information. }
  if ($1 == !ts) && ($2 == help) {
    if $3 == users { msg # 7[TS3] 9!TS Users - 11Displays information about the currently connected users. }
    elseif $3 == info { msg # 7[TS3] 9!TS Info - 11Lists basic information about the TeamSpeak Server }
    elseif $3 == channels { msg # 7[TS3] 9!TS Channels - 11Displays all channels and the number of users in them. }
    elseif $3 == msg { msg # 7[TS3] 9!TS Msg <message> - 11Sends a message to the server }
    elseif $3 == PM { msg # 7[TS3] 9!TS PM <user> <message> - 11Sends a private message to an user }
    elseif $3 == poke { msg # 7[TS3] 9!TS Poke <user> <message> - 11Pokes an user with the specified message (if any). }
    elseif $3 == kick { msg # 7[TS3] 9!TS Kick <user> <reason> - 11Kicks an user from the server. }
    elseif $3 == ban { msg # 7[TS3] 9!TS Ban <user> <reason> - 11Bans an user from the server. }
    elseif $3 == version { msg # 7[TS3] 9!TS Version - 11Displays information about the script and its author. }
    elseif (!$3) { msg # 7[TS3] 3TeamSpeak Commands: 9!TS Users, Channels, Kick, Ban, Msg, PM, Poke, Info, Version - 11"!TS help [command]" for more information. }
    else { msg # 7[TS3] 4Unknown command. 3TeamSpeak Commands: 9!TS Users, Channels, Kick, Ban, Msg, PM, Poke, Info, Version - 11"!TS help [command]" for more information. }
  }
  ; commands
  if $1-2 == !ts connect && ($nick ishop # || $nick isop #)  { ts.connect } 
  elseif $1 == !ts && $2 != connect && !$sock(ts3) { msg # 7[TS3] 4Error: 11Not connected to the TeamSpeak server, connecting to server.. | ts.connect }
  if ($1-2 == !ts info) { ts3info $chan }
  if ($1-2 == !ts users) { ts3users $chan }
  if ($1-2 == !ts version) { ts3version $chan }
  if ($1-2 == !ts channels) { ts3channels $chan }
  if ($1-2 == !ts msg) { ts3msg $nick $+ ; $+ $3- }
  if ($1-2 == !ts poke) { ts3poke $3 $+ ; $+ $4- $+ ; $+ $nick $+ ; $+ $chan }
  if ($1-2 == !ts ban) {
    if ($nick !ishop $chan) && ($nick !isop $chan) { msg $chan 7[TS3] 9[Ban] 11You lack the required permissions to use this command | HALT }
    else { ts3ban $3 $+ ; $+ $4- $+ ; $+ $nick $+ ; $+ $chan }
  }
  if ($1-2 == !ts kick) {
    if ($nick !ishop $chan) && ($nick !isop $chan) { msg $chan 7[TS3] 9[Kick] 11You lack the required permissions to use this command | HALT }
    else { ts3kick $3 $+ ; $+ $4- $+ ; $+ $nick $+ ; $+ $chan }
  }
  if ($1-2 == !ts pm) {
    ts3pm $3 $+ ; $+ $4- $+ ; $+ $nick $+ ; $+ $chan
  }
}

;=======================================
;===== Reading & Responding or Relaying

on *:sockread:ts3: {
  ; puts the information recieved from the ts sever into %tsl, and then throws it into $*
  var %tsl | sockread -n %tsl | tokenize 32 %tsl
  var %tsl2 = $right(%tsl, -1)
  if %tsl == TS3 {
    .timertsconfail off 
    msg %ts.channels 7[TS3] Connection Establised...Logging in as a server admin.
    set %ts.act login
    ts3.d login client_login_name= $+ %ts.slogin client_login_password= $+ %ts.spass
  }
  if (error id=*msg=* iswm %tsl2) && (%tsl2 != error id=0 msg=ok) {
    if (%ts.act == ban) {
      msg %ts.banchan 7[TS3] 9[Ban] The bot does not have the permissions needed to ban the client specified. Reasons for this could be:
      msg %ts.banchan 7[TS3] 9[Ban] 1) The client you are trying to ban is a serveradmin, or is in a group with the permission "b_client_ignore_bans" granted.
      msg %ts.banchan 7[TS3] 9[Ban] 2) The bot does not have the permissions to ban. Please check if the bot is in the "Admin ServerQuery" group. 
      unset %ts.act
      unset %ts.banchan
    }
    elseif (%ts.act == kick) {
      msg %ts.kickchan 7[TS3] 9[Kick] The bot does not have the permissions needed to kick the client specified. Reasons for this could be:
      msg %ts.kickchan 7[TS3] 9[Kick] 1) The bot does not have the permissions to kick. Please check if the bot is in the "Admin ServerQuery" group. 
      unset %ts.act
      unset %ts.kickchan
    }
    elseif (%ts.act == login) {
      msg %ts.channels 7[TS3] Unable to login on the server, are you sure you have entered the username/password correctly?
      ts.sockclose silent
      unset %ts.act
    }
    elseif (%ts.act == sid) {
      msg %ts.channels 7[TS3] Unable to find a server. Reasons for this could be:
      msg %ts.channels 7[TS3] 1) The bot does not have the required permissions to request the server ID. Please doublecheck the permissions the bot has on the TS3 server.
      msg %ts.channels 7[TS3] 2) The server port you have entered in the script is incorrect. 
      ts.sockclose silent
      unset %ts.act
    }
    else {
      msg %ts.channels 7[TS3] Permission error! ( $+ $ts.clean(%tsl2) $+ )
      msg %ts.channels 7[TS3] Please check if the bot has the required permissions to take the action that's needed.
      msg %ts.channels 7[TS3] If you don't know what could be causing this error message, please contact the author of the script. (!TS Version)
    }
  }
  if (cid=*pid=*channel_order=*channel_name=*total_clients=*channel_needed_subscribe_power=* iswm %tsl2) {
    var %ts.chanlist = %tsl2
    var %totalchannels = $gettok(%ts.chanlist, 0, 124) 
    if (%totalchannels == 0) { HALT }
    if ($hget(ts3chan)) { hfree ts3chan }
    hmake ts3chan 10
    var %a = 1
    while (%a <= %totalchannels) {
      var %rawline = $gettok(%ts.chanlist, %a $+ , 124)
      tokenize 32 %rawline
      var %cid = $gettok($1, 2, 61)
      var %pid = $gettok($2, 2, 61)
      var %chan = $gettok($4, 2, 61)
      var %totclients = $gettok($5, 2, 61)
      hadd ts3chan %cid %chan $+ ; $+ %totclients
      if (%ts.displaychanlist == 1) {
        msg %ts.chanchan 7[TS3] $iif(%pid != 0, 9--, 3) $+ $ts.clean(%chan) $iif(%totclients != 0, 11[ $+ %totclients $iif(%totclients == 1, client, clients) $+ ])
      }
      inc %a
    } 
    unset %ts.chanchan
    unset %ts.displaychanlist
  }
  if (clid=*cid=*client_database_id=*client_nickname=* iswm %tsl2) && (%ts.getclientlist == 1) {
    set %ts.clients %tsl2
    var %totalclients = $gettok(%ts.clients, 0, 124) 
    if (%totalclients == 0) { HALT }
    hdel -w ts3 *
    var %a = 1
    while (%a <= %totalclients) {
      var %rawline = $gettok(%ts.clients, %a $+ , 124)
      tokenize 32 %rawline
      var %clid = $gettok($1, 2, 61)
      var %cid = $gettok($2, 2, 61)
      var %ts3nick = $gettok($4, 2, 61)
      var %away = $gettok($6, 2, 61)
      var %awaymessage = $iif($gettok($7, 2, 61), $gettok($7, 2, 61))
      var %connectionmethod = $gettok($5, 2, 61)
      if (%connectionmethod != 1) {
        var %ts.online = $addtok(%ts.online, %ts3nick, 44)
        hadd ts3 %ts3nick $+ ; $+ %clid cid= $+ %cid $+ ;away= $+ %away $+ ;awaymessage= $+ %awaymessage
      }
      inc %a
    } 
    unset %ts.clients
    unset %ts.getclientlist
    if (%ingame.show == 1) {
      if ($len(%ts.online) > 150) { var %ts.online = $left(%ts.online, 147) $+ ... }
      sendexo msg Currently online on TS3: %ts.online
      sendexo msg Join us on TS3 @ ts.exoduscommunity.com - Port: 9987 (Default)
      unset %ingame.show
    }
    if (%ts.showclientlist == 1) {
      ts.displaylist
      unset %ts.showclientlist
    }
  }
  if ((server_id=* iswm %tsl2) && (%ts.act == sid)) {
    var %sid = $gettok(%tsl2, 2, 61)
    msg %ts.channels 7[TS3] Selecting server on ID %sid with port %ts.sport $+ ...
    set %ts.act use
    ts3.d use sid= $+ %sid
  }
  if (virtualserver_unique_identifier=*virtualserver_name=*virtualserver_welcomemessage=*virtualserver_platform=*virtualserver_version=*virtualserver_maxclients=* iswm %tsl2) {
    var %name = $ts.clean($gettok($2, 2, 61))
    var %platform = $ts.clean($gettok($4, 2, 61))
    var %version = $ts.clean($gettok($5, 2, 61))
    var %maxclients = $gettok($6, 2, 61)
    var %currclients = $gettok($8, 2, 61)
    var %channels = $gettok($9, 2, 61)
    msg %ts.infochan 7[TS3] 9[Name] 03 $+ %name
    msg %ts.infochan 7[TS3] 9[IP/Port] 03 $+ %ts.ip.public $+ : $+ %ts.sport
    msg %ts.infochan 7[TS3] 9[Clients] 03[ $+ %currclients $+ / $+ %maxclients $+ ] - 11Type !TS Users for more information
    msg %ts.infochan 7[TS3] 9[Channels] 03 $+ %channels channels - 11Type !TS Channels for more information
    msg %ts.infochan 7[TS3] 9[Version] 03 $+ %platform %version
    unset %ts.infochan
  }
  if (notifytextmessage* iswm %tsl2) {
    var %targetmode = $gettok($2, 2, 61)
    if (%targetmode == 3) {
      var %msg1 = $ts.clean($right($3, -4))
      var %msg = $iif(* iswm %msg1, $right(%msg1, -15), %msg1)
      var %messager = $ts.clean($gettok($5, 2, 61))
      msg %ts.channels 7[TS3] 09[Message] 11 $+ %messager $+ : 03 $+ %msg $+ 
    }
  }
  if (notifyclientleftview* iswm %tsl2) {
    var %clid = $gettok($6, 2, 61)
    var %leavemsg = $ts.clean($gettok($5, 2, 61))
    var %hashname = $hfind(ts3, *; $+ %clid, 1, w)
    if (!%hashname) { HALT }
    var %leavenick = $gettok(%hashname, 1, 59)
    msg %ts.channels 7[TS3] 9[Player Left] 11 $+ %leavenick -3 Quitmessage: %leavemsg $+ 
    hdel ts3 %hashname
    set %ts.getclientlist 1
    ts3.d clientlist -away
  }
  if (*notifycliententerview* iswm %tsl2) {
    var %clid = $gettok($5, 2, 61)
    var %identifier = $gettok($6, 2, 61)
    var %clnick = $ts.clean($gettok($7, 2, 61))
    var %inputhardware = $gettok($11, 2, 61)
    var %outputhardware = $gettok($12, 2, 61)
    if ((%identifier != ServerQuery) && (%inputhardware == 1) && (%outputhardware == 1)) {
      hadd ts3 %clnick $+ ; $+ %clid
      msg %ts.channels 7[TS3] 9[Player Join] 11 $+ %clnick
      set %ts.getclientlist 1
      ts3.d clientlist -away
    }
  }
  ; The following is triggered when "OK" is sent to the server, based on %ts.act, it reacts accordingly
  elseif (%tsl2 == error id=0 msg=ok) {
    if %ts.act == use {
      msg %ts.channels 7[TS3] TS3 Virtual Server selected successfully, ready for duty.
      .timertspingout 1 %ts.timeout ts.sockclose
      set %ts.act getsid
      ts3.d servernotifyregister event=server
      ts3.d servernotifyregister event=textserver
      ts3.d clientupdate client_nickname= $+ $me
      if ($hget(ts3chan)) { hfree ts3chan }
      if (!$hget(ts3chan)) { hmake ts3chan 10 }
      if ($hget(ts3)) { hfree ts3 }
      if (!$hget(ts3)) { hmake ts3 10 }
      set %ts.getclientlist 1
      ts3.d clientlist -away
      .timertscheckok 0 5 ts.checkok
    }
    elseif %ts.act == ban {
      msg %ts.banchan 7[TS3] 9[Ban] 3The client has been banned successfully.
      unset %ts.act
      unset %ts.banchan
    }
    elseif %ts.act == kick {
      msg %ts.kickchan 7[TS3] 9[Kick] 3The client has been kicked successfully.
      unset %ts.act
      unset %ts.kickchan
    }
    elseif %ts.act == login {
      msg %ts.channels 7[TS3] Logged in successfully, Searching for server id...
      set %ts.act sid
      ts3.d serveridgetbyport virtualserver_port= $+ %ts.sport
    }
    elseif $gettok(%ts.act,1,32) == pl {
      unset %ts.act
    }
    elseif $gettok(%ts.act,1,32) == bl {
      unset %ts.act
    }
    elseif %ts.checkok == check { .timertspingout 1 %ts.timeout ts.sockclose | unset %ts.checkok }
  }
}

; ***Checks if the server is still responding every 5 seconds***
alias ts.checkok {
  ts3.d whoami
  set %ts.checkok check
}

; activates if the connection is lost
on *:sockclose:ts3: { ts.sockclose }
; activates when a socket times out, kills the timers
alias ts.sockclose {
  if !$1 {
    sockclose ts3
    msg %ts.channels 7[TS3] TS Error: Socket timed out.
    .timergettslogs off
    .timertscheckok off
  }
  elseif $1 == cc {
    msg %ts.channels 7[TS3] TeamSpeak failed to connect! Reasons for this could be:
    msg %ts.channels 7[TS3] 1) The server is offline 
    msg %ts.channels 7[TS3] 2) The IP or Query Port you have entered is incorrect.
    .timergettslogs off
    .timertscheckok off
    sockclose ts3
    .timertspingout off
  }
  elseif $1 == silent { 
    .timergettslogs off
    .timertscheckok off
    .timertspingout off
    sockclose ts3
  }
}

Comments

Sign in to comment.
PackardBell   -  Oct 13, 2013

urgh...
I get this all the time:

!ts [TS3] TeamSpeak Commands: !TS Users, Channels, Kick, Ban, Msg, PM, Poke, Info, Version - "!TS help [command]" for more information. [TS3] Error: Not connected to the TeamSpeak server, connecting to server.. [TS3] Attempting to connect to the TS3 server.. [TS3] Connection Establised...Logging in as a server admin. [TS3] Logged in successfully, Searching for server id... [TS3] Unable to find a server. Reasons for this could be: [TS3] 1) The bot does not have the required permissions to request the server ID. Please doublecheck the permissions the bot has on the TS3 server. [TS3] 2) The server port you have entered in the script is incorrect. I tried chaning my own IP and localhost. (and port 10011) I tried with over 10 Serverquerry logins Still doesn't work. All the ports are open.
PackardBell  -  Oct 14, 2013

Does this script work with the FREE software to run on your own PC?

Sign in to comment

Bekir   -  Aug 12, 2012

All commands except
!ts users PM ban kick poke works to me
Getting error:

  • /timertspingout: insufficient parameters (line 504, teamspeak3_interaction.mrc)
  • /timertspingout: insufficient parameters (line 504, teamspeak3_interaction.mrc)
  • /hdel: no such table 'ts3' (line 417, teamspeak3_interaction.mrc)
    and user not found

Edited

 Respond  
m4v3r1ck   -  Feb 22, 2012

Hi guys,

I see mass notice's lately about its not working bla bla overhere , kinda weird mine is working very fine from the very start i configered it so , thats wat I would like to make clear, ones and for all :) , looki !!

<@maverick> !ts
<@[TS3]> [TS3] 3TeamSpeak Commands: 9!TS Users, Channels, Kick, Ban, Msg, PM, Poke, Info, Version - "!TS help [command]" for more information.
<@maverick> !ts info
<@[TS3]> [TS3] The Dutch Squad
<@[TS3]> [TS3] [IP/Port] spacelinked.dyndns.info:9986
<@[TS3]> [TS3] [Clients] [2/32] - 11Type !TS Users for more information
<@[TS3]> [TS3] [Channels] 21 channels - 11Type !TS Channels for more information
<@[TS3]> [TS3] [Version] Linux 3.0.1 [Build: 1321515270]
<@maverick> !ts connect
<@[TS3]> [TS3] Attempting to connect to the TS3 server..
<@[TS3]> [TS3] Connection Establised...Logging in as a server admin.
<@[TS3]> [TS3] Logged in successfully, Searching for server id...
<@[TS3]> [TS3] Selecting server on ID 1 with port 9986...
<@[TS3]> [TS3] TS3 Virtual Server selected successfully, ready for duty.

forwarded

 Respond  
Lenooox   -  Nov 01, 2011

could not be left out without having to enter a password to them?
hahóóóó someone ?

 Respond  
Lenooox   -  Jul 13, 2011

could not be left out without having to enter a password to them?

m4v3r1ck  -  Jan 28, 2013

Nope not possible

Sign in to comment

Saigyouji   -  Feb 17, 2011
[18:41:09] <&Konpaku> [TS3] Attempting to connect to the TS3 server..
[18:41:09] <&Konpaku> [TS3] Connection Establised...Logging in as a server admin.
[18:41:09] <&Konpaku> [TS3] Logged in successfully, Searching for server id...
[18:41:09] <&Konpaku> [TS3] Unable to find a server. Reasons for this could be:
[18:41:09] <&Konpaku> [TS3] 1) The bot does not have the required permissions to request the server ID. Please doublecheck the permissions the bot has on the TS3 server.
[18:41:09] <&Konpaku> [TS3] 2) The server port you have entered in the script is incorrect.

Apparently I can't use the admin user & pw anymore because TS3 doesn't have them now. What do I do?

EDIT: Okay. I solved that problem. But can you make the script so that during !ts channels, there's a hyphen between the channel and the # of clients?

[20:45] <~Saigyouji> !ts channels
[20:45] <&Konpaku> [TS3] Lobby 4 clients

It says it has 4 clients but it seems like Lobby 4 clients is a channel name.

EDIT: Fixed the script on my own to parenthesize the clients.
Another question though; I'm getting

* /timer: timer tspingout not active
-
* /timer: timer tspingout not active
-
* /timer: timer tspingout not active
-
* /timer: timer tspingout not active
-
* /timer: timer tspingout not active
-
* /timer: timer tspingout not active
-
* /timer: timer tspingout not active

Anyway to solve this?

 Respond  
Prulez   -  Feb 22, 2010

Version 1.2 has been released, please report any bugs you may encounter!

 Respond  
Lenooox   -  Feb 21, 2010

works good for me :) nice script :)
i wanna set a multiple channel in the script. so , im waiting for the update :p
if its possible ^^

 Respond  
Prulez   -  Feb 21, 2010

Odd, it's working here and on other bots aswell.

 Respond  
Nuk3d   -  Feb 21, 2010

oh well
i had to add that for mine to get past the connection established message..

 Respond  
Prulez   -  Feb 20, 2010

Nuk3d, it's working on Beta18, though I might change it in a future version, would it become unsupported or encounter any issues.

As you can see with Lennox, his account is being logged in, I just guess the serverquery account doesn't have the permissions needed to execute the "serverlist" command.

 Respond  
TheImrac   -  Feb 19, 2010

Great stuff, I will for sure be using something similar to this when my clan dumps vent and goes with ts3.

 Respond  
Nuk3d   -  Feb 19, 2010

change ts3.d login $ts.slogin $ts.spass
to ts3.d login client_login_name= $+ $ts.slogin client_login_password= $+ $ts.spass
or something along that line

of course i dont know which beta they started using that on but beta18 needs that to login

 Respond  
Lenooox   -  Feb 19, 2010

hmm this script work for you?

13:57:58) (@Lenooox) !ts help
(13:57:59) (@Zer0CoDe8) [TS3] TeamSpeak Commands: !TS Users, Channels, Kick, Msg, PM, Poke, Info - "!TS help [command]" for more information.
(13:58:03) (@Lenooox) !ts connect
(13:58:04) (@Zer0CoDe8) [TS3] Connection Establised...Logging in as a server admin.
(13:58:04) (@Zer0CoDe8) [TS3] Logged in successfully, Searching for server id...

(13:58:21) (@Lenooox) !ts users
(13:58:28) (@Lenooox) !ts channels
(13:58:34) (@Lenooox) !ts kick Lenooox
(13:58:35) (@Zer0CoDe8) [TS3] [Kick] Unable to find client.
(13:58:43) (@Lenooox) !ts msg test
(13:58:51) (@Lenooox) !ts pm Lenooox test
(13:58:52) (@Zer0CoDe8) [TS3] [PM] Unable to find client.
(13:59:07) (@Lenooox) !ts poke Lenooox test
(13:59:07) (@Zer0CoDe8) [TS3] [Poke] Unable to find client.

(14:08:43) (@Zer0CoDe8) Connection closed to the TeamSpeak server.
(14:08:43) (@Zer0CoDe8) TS Error: Socket timed out.
 Respond  
Prulez   -  Feb 18, 2010

This script has been changed, it was not working before. Please update to version 1.1 if you haven't already.

Thanks!

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.