These are chat archives for TheHolyWaffle/TeamSpeak-3-Java-API

11th
Dec 2017
astrolamb-gaming
@astrolamb-gaming
Dec 11 2017 18:12
So the permission "i_icon_id" is only for channel groups, not the channels themselves. I haven't found a command yet that will let me change the channel's icon id.
astrolamb-gaming
@astrolamb-gaming
Dec 11 2017 18:20
Ah, I've found it! TS3Api#ChannelEdit(), duh.
Roger Baumgartner
@rogermb
Dec 11 2017 19:19
@astrolamb-gaming No, that's not it. You're looking for TS3Api#addChannelPermission
astrolamb-gaming
@astrolamb-gaming
Dec 11 2017 20:47
One of the channel properties is CHANNEL_ICON_ID, and is changeable via ChannelEdit().
TS3Api#addChannelPermission can change channel group icons but apparently not channel icons.
astrolamb-gaming
@astrolamb-gaming
Dec 11 2017 21:11
What I did, and this works, is like this:
long[][] channelIconIds = {{longOldIconId, longNewIconId},{longOldIconId2, longNewIconId2}};

public void changeServerIcons() {
    List<Channel> channels = TS3Api#getChannels();
    HashMap<ChannelProperty, String> options;
    for (Channel c : channels) {
        for (int i = 0; i < channelIconIds.length; i++) {
            if (c.getIconId() == channelIconIds[i][0]) {
                options = new HashMap<>();
                options.put(ChannelProperty.CHANNEL_ICON_ID, String.valueOf(channelIconIds[j][1]));
                TS3Api#editChannel(c.getId(), options);
            }
        }
    }
}
Roger Baumgartner
@rogermb
Dec 11 2017 21:14

So I opened up telnet:

channeladdperm cid=5 permsid=i_icon_id permvalue=500
error id=0 msg=ok

And it changed the channel's icon

However, this seems to work as well:
channeledit cid=5 channel_icon_id=200
error id=0 msg=ok
And I checked, this changed the icon, as well
astrolamb-gaming
@astrolamb-gaming
Dec 11 2017 21:17
So two ways to change the channel icon. I was having issues with the java api with getting the addChannelPermission() to work.
Roger Baumgartner
@rogermb
Dec 11 2017 21:17
In other words, both addChannelPermission("i_icon_id", 1234) and editChannel(...) should work
Can you elaborate on what those issues were?
astrolamb-gaming
@astrolamb-gaming
Dec 11 2017 21:19
Oh, know what, I think I must've been using the wrong icon id for my test. I double checked that when trying to figure out the editChannel() version and changed it, so that probably was the issue.
Roger Baumgartner
@rogermb
Dec 11 2017 21:20
Ah lol ^^
One thing, though. If you want to remove an icon, you could do editChannel and a value of 0. That still keeps the permission "i_icon_id" with the value of 0 around, though.
Because again, internally, icons are handled via the permissions system
The only way to really get rid of those permissions are by using deleteChannelPermission
Sorry, wrong method name. It's deleteChannelPermission
astrolamb-gaming
@astrolamb-gaming
Dec 11 2017 21:22
Ah, I see. Interesting. That's kind of obnoxious.
Fortunately for what I'm doing, only changing the icons is necessary, not removing them :P
Roger Baumgartner
@rogermb
Dec 11 2017 21:23
Alright :)
astrolamb-gaming
@astrolamb-gaming
Dec 11 2017 21:24
Thanks for the help anyways though. It's really useful to have outside resources! Keeps you from getting stuck in a rut.
Roger Baumgartner
@rogermb
Dec 11 2017 21:24
Yeah, I can imagine :)
Especially with how "well documented" the server query interface itself is :P
astrolamb-gaming
@astrolamb-gaming
Dec 11 2017 21:25
:laughing: