Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Sno

#1
Since the new versions of TS don't seem to have anywhere that displays the channel ID # (and not even a serverquery window in the client) I had been finding them by logging in an old client that does show them. But now the newest server version won't let older clients connect, so finding those #'s for config purposes is impossible with a standard client. So I wrote function for the bot that tells the bot's admin those numbers that you might want to include. Here's the code:
Add this to JTS3ServerMod.handleChatMessage():

} else if (msg.toLowerCase().startsWith("!channels")) {
chatCommands.handleChannels(eventInfo);


And stick this somewhere in ChatCommands.java:
void handleChannels(HashMap<String, String> eventInfo) {
modClass.addLogEntry("COMMAND", "Got command from " + eventInfo.get("invokername"), false);
Vector<HashMap<String, String>> channelList = queryLib.getList(JTS3ServerQuery.LISTMODE_CHANNELLIST);
StringBuilder msg = new StringBuilder(1023);
Integer lastPid = 0;
Integer newPid;
Integer indent = 0;
Vector<Integer> indentLvls = new Vector<Integer>(10);
for (HashMap<String, String> channel : channelList) {
msg.append("\n");
newPid = Integer.parseInt(channel.get("pid"));
if (newPid == 0) {
indent = 0;
indentLvls.clear();
} else if (newPid > lastPid) {
indentLvls.add(newPid);
indent++;
} else if (newPid < lastPid) {
indent = indentLvls.indexOf(newPid) + 1;
indentLvls.setSize(indent);
}
lastPid = newPid;
if (indent > 0) {
for (int i = 0; i < indent; i++) {
msg.append("\t");
}
}
msg.append(channel.get("channel_name") + ": " + channel.get("cid"));
if (msg.length() + 42 + indent > 1023) {
queryLib.sendTextMessage(Integer.parseInt(eventInfo.get("invokerid")), JTS3ServerQuery.TEXTMESSAGE_TARGET_CLIENT, msg.toString());
msg = new StringBuilder(1023);
}
}
if (msg.length() > 0)
queryLib.sendTextMessage(Integer.parseInt(eventInfo.get("invokerid")), JTS3ServerQuery.TEXTMESSAGE_TARGET_CLIENT, msg.toString());
}


Now bot admins can get a nicely formatted list of the channels with their ID's which are needed to config many of the bot's functions by messaging the bot with "!channels".
Cheers  8)
#2
Howdy,
I've heavily extended  JTS3ServerMod with a bunch of  features. One of  them  reports clan battle schedules for the game "World of tanks," and I was wondering if it's possible to find out what timezone a client is in? So when the clients send it a !battles command it can adjust the battle times to match their time zone in the response. It also pushes notifications to clients when the battle schedule changes and it'd be nice to have the notifications be adjusted to each client's timezone.

I've figured out how  to get what country a client is in by using eventInfo.get("invokerid") to lookup a client in a list created by:Vector<HashMap<String,String>> clientList = queryLib.getList(JTS3ServerQuery.LISTMODE_CLIENTLIST, "-uid,-country");But can't find anything about the timezone they're in.  ???

If timezone info isn't available in teamspeak, how do I retrieve a client's ip address using JTS3ServerMod/JTS3ServerQuery? I know that info is available in a normal TS client by right clicking a user and hitting "connection info." If I can get their ip address i can find thier timezone using http://ipinfodb.com/ip_location_api.php

Cheers,
8)
#3
Is there a way to return a client's ip, and/or add a ban? Can't find any methods for that in  JTS3ServerQuery
#4
First I'd like to say outstanding work! I've used the bot for a day and it's already proven to be invaluable.

I especially like the autoidle and autoaway features. A suggestion I have is to add the auto-move-back functionality that autoaway can have to the autoidle feature. If a clan member gets flagged as being idle too long because they haven't said anything in a while (I'm aware that detecting an idle mouse/keyboard can only be done client-side and isn't possible for the bot) during a clan battle, they have to minimize the game in order to switch back to the appropriate channel. This could cause disaster for the battle! If an auto-move-back were to be implemented, when they get moved due to not speaking in a while, all they need to do is say something and they'd be placed back in the battle channel.

Some questions I have are:

  • Does the channel that the bot is in effect any of it's features? If so an auto-follow feature would be useful so you could tell the bot to follow you around if you switch channels
  • Is it possible to send messages to channels in response to things people type in them even if the bot isn't in that channel? If so, features similar to other plugins people have made would be possible like !dice, !slap, !trivia, etc. But would be more powerful since they could be done from anywhere on the server instead of needing someone with a plugin installed to be present in the channel you're in.
  • If an !exec  command is sent, what kind of command should be used? Is this for TS server query commands or system/shell commands?

My clan plays a game where in-game-currency is given to the clan based on territories it owns. Twice a month we disperse the currency to our members and each member receives a percentage of what is given out based on their attendance during prime battle hours. The way it's calculated is by a program I wrote that scans the mumble log (we've been using mumble and would like to switch to teamspeak), and if a member joins the "staging area" channel during prime battle hours it updates a google spreadsheet doc indicating that member was present for that day. A formula in the spreadsheet then adds together all the times that member was present during the "pay period" and divides it by the total number of times people showed up for that period to get that person's percentage. The total amount of currency to be given out is multiplied by that percentage in another formula which lets us know exactly how much currency that person should receive. Teamspeak's server logs don't record people entering or leaving a channel (or perhaps I just haven't been able to figure out how to have it record that), so we need another method to record attendance. I'm thinking about extending/adding a feature to JTS3ServerMod that would do this, and am hoping you could offer advice or tips on how to go about making it. I'm slightly new to java, but understand the basics fairly well and know several other languages (python being my strongest).

Thanks again for your wonderful bot! Keep up the good work!