Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

channel.getTotalClients() showing wrong numbers #405

Open
qeinz opened this issue Jan 6, 2022 · 2 comments
Open

channel.getTotalClients() showing wrong numbers #405

qeinz opened this issue Jan 6, 2022 · 2 comments

Comments

@qeinz
Copy link

qeinz commented Jan 6, 2022

My bot gives me -1 as client value, but we are 4 clients in the channel.

I use the latest API version.

@astrolamb-gaming
Copy link

I'm not sure what the purpose of the TOTAL_CLIENTS flag in the teamspeak api is, but it wouldn't surprise me if it has some obscure function aside from conveying the number of clients in a channel. For this java wrapper api, the Channel objects aren't updated all the time, nor are client objects, as they are merely local java representations of the channel or client at a particular instant. You'll want to make sure that you have the most up-to-date info by calling TS3Api#getChannels() or #getChannelByName, or whatever method you choose, then perhaps that method will return a useful value. I'm more partial to using TS3Api#getClients(), then filtering by channel instead, since I will use other client info, but I don't know what your intent is for that information.

@qeinz
Copy link
Author

qeinz commented Aug 4, 2023

it was intended, if someone has a music bot in the channel, that this, if all other users leave the channel, he was moved back to his home.

Have solved it so:

    public static void moveTeamBots() {

        for (Client clients : Main.api.getClients()) {
            if (clients.isInServerGroup(GroupIdService.teammusic) && (clients.getChannelId() != ChannelIdService.musikAfkChannel_ID)) {
                String tmp = "alone";

                for (Client clients2 : Main.api.getClients()) {
                    if (!clients2.isInServerGroup(GroupIdService.teammusic)) {
                        if (clients.getChannelId() == clients2.getChannelId()) {
                            tmp = "not";
                        }
                    }
                }

                if (tmp.equalsIgnoreCase("alone")) Main.api.moveClient(clients.getId(),
                        ChannelIdService.musikAfkChannel_ID);

            }


        }
    }

i know, funny way to solve my problem xD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants