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

7th
Aug 2016
Henny022
@Henny022
Aug 07 2016 21:12
when i want to send a private message to the bot, i get an error, because the querry client is not registered for private messages. how can i change that?
Or just registerAllEvents if you don't mind getting more events than you need :stuck_out_tongue:
Henny022
@Henny022
Aug 07 2016 21:14
thanks
i did not use registerAllEvents becase aof events triggering twice
Roger Baumgartner
@rogermb
Aug 07 2016 21:15
Why would they trigger twice?
or "where"?
Henny022
@Henny022
Aug 07 2016 21:16
i dont know anymore
Roger Baumgartner
@rogermb
Aug 07 2016 21:17
If you've been using this API for a long time, it might've been fixed by now :smile:
But eh, it's better if you only register for those kinds of events that you actually need, anyways ^^
Henny022
@Henny022
Aug 07 2016 21:17
on joining and leving the sever
Roger Baumgartner
@rogermb
Aug 07 2016 21:18
Oh, and if your current channel is also the default channel
I think we might have fixed that? If two events are completely identical, they should get filtered out now
Henny022
@Henny022
Aug 07 2016 21:19
i tried it just now
but my api ist not exactly up to date i think
Roger Baumgartner
@rogermb
Aug 07 2016 21:21
Hmm, it should be fixed in v1.0.12 and v1.0.13
Henny022
@Henny022
Aug 07 2016 21:23
where can i see which version i have?
i downloaded it so no maven or something like that
Roger Baumgartner
@rogermb
Aug 07 2016 21:24
Well, the version string should be included in the filename
You know, it's probably best if you just downloaded the newest version anyways ^^
Henny022
@Henny022
Aug 07 2016 21:25
thats just TeamSpeak-3-Java-API-master
Roger Baumgartner
@rogermb
Aug 07 2016 21:25
that must've been quite some time ago then O.o
Henny022
@Henny022
Aug 07 2016 21:26
im not using it very long
and if i download it again, it names it the same
Roger Baumgartner
@rogermb
Aug 07 2016 21:26
Wait, are you downloading the repository as a zip file or something like that?
Henny022
@Henny022
Aug 07 2016 21:26
zip yeah
Roger Baumgartner
@rogermb
Aug 07 2016 21:27
but.... why?
Henny022
@Henny022
Aug 07 2016 21:27
was that wrong?
Roger Baumgartner
@rogermb
Aug 07 2016 21:27
There's multiple links to a .jar download and there's even a releases page now ^^
Henny022
@Henny022
Aug 07 2016 21:28
just saw that ;)
havent used github very often by now
Roger Baumgartner
@rogermb
Aug 07 2016 21:30
It's more of a Java thing than a GitHub thing ^^
Henny022
@Henny022
Aug 07 2016 21:30
downloading the wrong thing?
Roger Baumgartner
@rogermb
Aug 07 2016 21:31
Libraries are almost always distributed as a JAR file ^^
Henny022
@Henny022
Aug 07 2016 21:31
thats why i couldn#t use the zip as a library
my bad
Roger Baumgartner
@rogermb
Aug 07 2016 21:32
No worries ^^
It might get a bit complicated if you update to a new version of the API, though
Like, with a proper JAR file :stuck_out_tongue:
Henny022
@Henny022
Aug 07 2016 21:33
i couldn't use the jar library anyway, because i edited the LogHandler to filter the whoami's
Roger Baumgartner
@rogermb
Aug 07 2016 21:34
Oh, right, I remember
You could still achieve the same thing via the java.lang.reflect Reflection, though
Henny022
@Henny022
Aug 07 2016 21:35
it also gives me two events if I switch channels
Roger Baumgartner
@rogermb
Aug 07 2016 21:35
Huh, that's strange
Henny022
@Henny022
Aug 07 2016 21:36
im not bad wit java, but i know nothing about java.lang.reflect, but i will look int that, if it helps
Roger Baumgartner
@rogermb
Aug 07 2016 21:36
Would you mind posting that section of the communications log of those two events here?
Henny022
@Henny022
Aug 07 2016 21:36
[2016-08-07 23:36:36.114] < [event] notifyclientmoved ctid=27 reasonid=0 clid=8
[2016-08-07 23:36:36.177] < [event] notifyclientmoved ctid=27 reasonid=0 clid=8
that one?
Roger Baumgartner
@rogermb
Aug 07 2016 21:36
Yup ^^
Despite getting 2 events in the comms log, you should still only get 1 call in the API, though
Henny022
@Henny022
Aug 07 2016 21:37
ok
can i register different eventListeners for server and channel events?
Roger Baumgartner
@rogermb
Aug 07 2016 21:38
This function in SocketReader is called every time a new event arrives. If it's exactly the same as the last event, it will be filtered out
Henny022
@Henny022
Aug 07 2016 21:38
ok
Roger Baumgartner
@rogermb
Aug 07 2016 21:38
wait, wrong function
Henny022
@Henny022
Aug 07 2016 21:38
but still two entrys in the console
;(
Roger Baumgartner
@rogermb
Aug 07 2016 21:39
Yeah, we don't filter out the communication
Why should we? That's just verbatim what arrives at our end and what we send out
Henny022
@Henny022
Aug 07 2016 21:39
i like a console with only the information that i need for testeing my bot
Roger Baumgartner
@rogermb
Aug 07 2016 21:39
the second event that arrives just "doesn't do anything" internally :stuck_out_tongue:
and yeah, you can add multiple event listeners, but they'll all get all events you've registered
I assume you're creating a listener by overriding TS3EventAdapter, so you could just only override those onXYZ methods you need in that handler

i like a console with only the information that i need for testeing my bot

You'll probably have to program something like that yourself. There's no way we could create a "console" that fits everyone's needs

Henny022
@Henny022
Aug 07 2016 21:45
of course not
i create the listener with api.addTS3Listeners
Roger Baumgartner
@rogermb
Aug 07 2016 21:47
That's how you add one, but not how you create one ^^
Henny022
@Henny022
Aug 07 2016 21:47
then i dont know how
Roger Baumgartner
@rogermb
Aug 07 2016 21:47
Are you just creating an anonymous instance of TS3Listener? That would get extremely verbose, though, no?
Henny022
@Henny022
Aug 07 2016 21:48
api.addTS3Listeners(new TS3Listener() {
thats all i do
then the methods of cause
Roger Baumgartner
@rogermb
Aug 07 2016 21:48
O.o again
Those event listeners usually get quite long. Having one be an anonymous class works, sure, but it's probably also quite an eyesore

I'd recommend you create a new class

public class YourEventHandlerClassNameGoesHere extends TS3EventAdapter {

somewhere and only override the functions you actually need
Henny022
@Henny022
Aug 07 2016 21:51
how do i call the adapter then
Roger Baumgartner
@rogermb
Aug 07 2016 21:51
Cause I doubt you're actually using onPrivilegeKeyUsed(PrivilegeKeyUsedEvent e) or onChannelPasswordChanged(ChannelPasswordChangedEvent e) :stuck_out_tongue:
Henny022
@Henny022
Aug 07 2016 21:51
yeah i dont
Roger Baumgartner
@rogermb
Aug 07 2016 21:51
api.addTS3Listeners(new YourEventHandlerClassNameGoesHere());
Henny022
@Henny022
Aug 07 2016 21:51
ok
Roger Baumgartner
@rogermb
Aug 07 2016 21:52
It's also much easier to keep track of your event handler that way
you can assign it to a field before you pass the reference on to addTS3Listeners
Henny022
@Henny022
Aug 07 2016 21:53
but i dont have the main class variables
Roger Baumgartner
@rogermb
Aug 07 2016 21:53
?
Henny022
@Henny022
Aug 07 2016 21:53
like api
spi.getWhatever
Roger Baumgartner
@rogermb
Aug 07 2016 21:54
Pass them along in the constructor ^^
Henny022
@Henny022
Aug 07 2016 21:54
yeah
Roger Baumgartner
@rogermb
Aug 07 2016 21:54
Sorry, should've thought about that :smile:
Henny022
@Henny022
Aug 07 2016 21:54
thats good prgramming
i hte that
*hate
Roger Baumgartner
@rogermb
Aug 07 2016 21:55
Why would you hate good programming? It makes it easier to work with your code for others and yourself
Henny022
@Henny022
Aug 07 2016 21:56
i myself usually get along with my code
and i really like to confuse aothers with my cod
e
Roger Baumgartner
@rogermb
Aug 07 2016 21:56
... while you're currently working on it. Try coming back a few weeks / months later and having to fix something in it, though ^^
Henny022
@Henny022
Aug 07 2016 21:57
thats no problem for me
Roger Baumgartner
@rogermb
Aug 07 2016 21:57
Alright then ^^
If you ever want to get into a programming job though, you'll have to shake that attitude :stuck_out_tongue:
Henny022
@Henny022
Aug 07 2016 21:58
the main problem is, im to lazy for good programming
especially in a fun project like this bot
in my other, bigger projects i try harder to make good code
Roger Baumgartner
@rogermb
Aug 07 2016 22:01
kk ^^
Henny022
@Henny022
Aug 07 2016 22:01
i should go to bed now, my english starts to get really bad
Roger Baumgartner
@rogermb
Aug 07 2016 22:02
Same :/
Cya, have a good night!
Henny022
@Henny022
Aug 07 2016 22:02
im starting to use google translate...
Roger Baumgartner
@rogermb
Aug 07 2016 22:02
#absolute_madman
Henny022
@Henny022
Aug 07 2016 22:03
yeah
i'll se you when i have another problem, or i know how to help someone else here, so bye an good night
Roger Baumgartner
@rogermb
Aug 07 2016 22:04
Thanks, you too!