Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 24 12:16
    Angxstupst edited #395
  • Jul 24 12:16
    Angxstupst edited #395
  • Jul 24 12:15
    Angxstupst closed #395
  • Jul 23 20:45
    Angxstupst opened #395
  • Jul 14 20:06
    Galileon-venta closed #318
  • Jul 11 19:46
    yannicklamprecht commented #394
  • Jul 11 08:41
    TruaYT opened #394
  • Jul 06 22:39
    rogermb closed #349
  • Jul 06 13:34
    rogermb commented #393
  • Jul 06 11:47
    akaJonas opened #393
  • May 31 21:15
    NoJokeFNA closed #392
  • May 28 17:05
    rogermb closed #310
  • May 28 17:05
    rogermb closed #309
  • May 28 17:05
    rogermb closed #308
  • May 28 17:05
    rogermb closed #300
  • May 28 17:05
    rogermb closed #298
  • May 28 17:04
    rogermb closed #267
  • May 28 17:03
    rogermb closed #221
  • May 28 17:03
    rogermb closed #181
  • May 28 16:53

    rogermb on master

    Set version to 1.4.0-SNAPSHOT Fix deprecation in FileCommands… Auto-format FileCommandsTest to… (compare)

oniBlock1
@oniBlock1
but when i doo this, the errer is
Roger Baumgartner
@rogermb
Well, make sure that the IP and query port of the TS3 server are correct and that you're actually able to connect to it
You can use telnet to try it manually, if you want to
oniBlock1
@oniBlock1
Can I write the port into the config.setHost as normal?
Roger Baumgartner
@rogermb
No, use setQueryPort
oniBlock1
@oniBlock1
i meen the normal port
Roger Baumgartner
@rogermb
The voice port?
Use selectVirtualServerByPort
Ausgeben
@Ausgeben
Hey there, Ive got some questions about non working features.
The first one is:
@Override
public void onClientJoin(ClientJoinEvent event) {
Configs configs = new ConfigManager().readConfig();
if (configs.getModuleWelcomeMessages()) {
api.sendPrivateMessage(event.getInvokerId(), configs.getWelcomeMessage());
}
}
why does he send no message
Ausgeben
@Ausgeben
@rogermb
Also: somehow I can connect with my coded query bot to my (seperate) test server, but for my customer this aint works (livingboost provider)
Roger Baumgartner
@rogermb
@Ausgeben regarding your first issue: If I had to guess, you probably forgot to register the events you want to receive. Use TS3Api#registerEvent or TS3Api#registerAllEvents. Also, parsing a config file in an event handler is probably not a smart thing to do. Move that into some initialization code somewhere else. See also: https://github.com/TheHolyWaffle/TeamSpeak-3-Java-API/blob/master/example/ChatBotExample.java
Regarding your second issue: Make sure that the IP and query port are correct, make sure that the TS3 server query is even enabled, and make sure that your TS3 hosting provider allows you to connect to your TS3 server this way
Ausgeben
@Ausgeben
all events are registered
Roger Baumgartner
@rogermb
Another issue: event.getInvokerId() is wrong, what you're looking for is event.getClientId()
The invoker is a separate client that caused that event to happen, for example by kicking or banning someone, or by moving them to a different channel.
Can you check whether the onClientJoin method actually gets called in that event handler? I.e. put a System.out.println or similar on the first line; or use a debugger
oniBlock1
@oniBlock1
One time a question, can anyone help me and tell me how I can connect the bot to a standard chnnel?
Roger Baumgartner
@rogermb
I'm not 100% sure what you mean @oniBlock1
Do you just want to switch to a different channel? If so, use moveQuery(channelId)
oniBlock1
@oniBlock1
Yes, thank you, that was what I was looking for
Roger Baumgartner
@rogermb
You're welcome :smile:
oniBlock1
@oniBlock1
one more small question ^^, if I let the bot join, let it reconect, then the error code comes and I always have to change the name, how can I fix it?
error code https://prnt.sc/1a8pa58
Roger Baumgartner
@rogermb
Yeah, I'm not sure what causes that. The server seems to think that the nickname is still in use
oniBlock1
@oniBlock1
Yes, every time I have to change the username, can that be fixed?
Roger Baumgartner
@rogermb
You could try to increase the reconnect delay, i.e. wait until the old client got kicked for inactivity
Or you could change the nickname to something different that looks the same :smile:
for instance by adding a zero-width space somewhere inside your name
Can't be at the start or the end of the name, though, those automatically get removed
oniBlock1
@oniBlock1
Even after waiting several minutes, the error code comes up
Roger Baumgartner
@rogermb
¯\_(ツ)_/¯
oniBlock1
@oniBlock1
Anyway thank you!
Roger Baumgartner
@rogermb
No worries :smile:
Ausgeben
@Ausgeben

The invoker is a separate client that caused that event to happen, for example by kicking or banning someone, or by moving them to a different channel.

Could be the reason I was searching for a getClientId in textmessage event xD
should be working now, thanks for the help

Still working on the issue with onClientJoin, dont know rn if it works

could be the cause of the getInvoker method
Roger Baumgartner
@rogermb
@Ausgeben Gotcha. Let me know if you need help with anything else :smiley:
Ausgeben
@Ausgeben
            public void onClientMoved(ClientMovedEvent event) {
                Configs configs = new ConfigManager().readConfig();
                if (configs.getModuleSupport()) {
                    if (event.getTargetChannelId() == configs.getSupportChannelId()) {
                        String clientName = api.getClientInfo(event.getClientId()).getNickname();
                        final Map<ChannelProperty, String> settings = new HashMap<>();
                        settings.put(ChannelProperty.CHANNEL_FLAG_PERMANENT, "1");
                        settings.put(ChannelProperty.CHANNEL_PASSWORD, api.getClientInfo(event.getClientId()).getUniqueIdentifier());
                        int newOrderId = api.getChannelInfo(configs.getSupportChannelId()).getOrder() + 1;
                        System.out.println("Support OrderId before create: " + newOrderId);
                        settings.put(ChannelProperty.CHANNEL_ORDER, "" + newOrderId);
                        int supportId = api.createChannel(configs.getSupportChannelName().replace("%p", clientName), settings);
                        api.addChannelPermission(supportId, "i_channel_needed_modify_power", 75);
                        api.addChannelPermission(supportId, "i_channel_needed_join_power", 50);
                        api.addChannelPermission(supportId, "i_channel_needed_subscribe_power" , 50);
                        api.addChannelPermission(supportId, "i_channel_needed_delete_power", 75);
                        api.moveClient(event.getClientId(),supportId);
                        int i = 0;
                        for (Client client : api.getClients()) {
                            if (client.isInServerGroup(configs.getSupportNotifyGroupId())) {
                                api.sendPrivateMessage(client.getId(), configs.getSupportNotifyMessage().replace("%p", clientName));
                                i++;
                            }
                        }
                        api.sendPrivateMessage(event.getClientId(), configs.getSupportUserMessage().replace("%t", Integer.toString(i)));
                    }
                }
                if (configs.getModuleApplication()) {
                    if (event.getTargetChannelId() == configs.getApplicationChannelId()) {
                        String clientName = api.getClientInfo(event.getClientId()).getNickname();
                        final Map<ChannelProperty, String> appsettings = new HashMap<>();
                        appsettings.put(ChannelProperty.CHANNEL_FLAG_PERMANENT, "1");
                        appsettings.put(ChannelProperty.CHANNEL_PASSWORD, api.getClientInfo(event.getClientId()).getUniqueIdentifier());
                        int newOrderId = api.getChannelInfo(configs.getApplicationChannelId()).getOrder() + 1;
                        System.out.println("Application OrderId before create: " + newOrderId);
                        appsettings.put(ChannelProperty.CHANNEL_ORDER, "" + newOrderId);
                        int applicationId = api.createChannel(configs.getApplicationChannelName().replace("%p", clientName), appsettings);
                        api.addChannelPermission(applicationId, "i_channel_needed_modify_power", 75);
                        api.addChannelPermission(applicationId, "i_channel_needed_join_power", 50);
                        api.addChannelPermission(applicationId, "i_channel_needed_subscribe_power" , 50);
                        api.addChannelPermission(applicationId, "i_channel_needed_delete_power", 75);
                        api.moveClient(event.getClientId(), applicationId);
                        int i = 0;
                        for (Client client : api.getClients()) {
                            if (client.isInServerGroup(configs.getApplicationNotifyGroupId())) {
                                api.sendPrivateMessage(client.getId(), configs.getApplicationNotifyMessage().replace("%p", clientName));
                                i++;
                            }
                        }

```Application OrderId before create: 895
[pool-1-thread-3] ERROR com.github.theholywaffle.teamspeak3.EventManager - Event listener threw an exception
com.github.theholywaffle.teamspeak3.api.exception.TS3CommandFailedException: A "channelcreate" command returned with a server error.
>> invalid channel order (ID 779)
at com.github.theholywaffle.teamspeak3.api.CommandFuture.checkForFailure(CommandFuture.java:415)
at com.github.theholywaffle.teamspeak3.api.CommandFuture.getUninterruptibly(CommandFuture.java:356)
at com.github.theholywaffle.teamspeak3.TS3Api.createChannel(TS3Api.java:709)
at Main$1.onClientMoved(Main.java:138)
at com.github.theholywaffle.teamspeak3.api.event.ClientMovedEvent.fire(ClientMovedEvent.java:56)
at com.github.theholywaffle.teamspeak3.EventManager$ListenerTask.run(EventManager.java:169)
at com.github.theholywaffle.teamspeak3.TS3Query.lambda$submitUserTask$0(TS3Query.java:232)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)```
Why does the application module throw this
support is working fine
Ausgeben
@Ausgeben
@rogermb
Roger Baumgartner
@rogermb
Hi @Ausgeben, sorry for the late reply, I'm on holiday
The issue is that "order" is not a number representing the position of the channel in the list. Instead, in TS3, "order" is the ID of the channel immediately preceding it on the same level. If the channel is at the top of the list (i.e. it's directly below its parent channel), the "order" is 0
Ausgeben
@Ausgeben
then how do I get this to work?
astrolamb-gaming
@astrolamb-gaming
So assuming I understand what you're trying to do, and that I'm following your code correctly, I"m pretty sure you should just change this line:
int newOrderId = api.getChannelInfo(configs.getSupportChannelId()).getOrder() + 1;
To
int newOrderId = api.getChannelInfo(configs.getSupportChannelId()).getOrder(); @Ausgeben
Assuming you want the support channel directly above the new channel
Ausgeben
@Ausgeben
nope, I want to get it under the channel