Scordo / TS3QueryLib.Net

This library allows you to query team speak 3 servers using the query port. All queries are implemented type safe and the library is written to work with .Net 3.5 SP1 or higher inluding support for silverlight 3.0 or higher and windows phone 7.1.
BSD 3-Clause "New" or "Revised" License
51 stars 15 forks source link

ChannelMessageReceived for all channels? #18

Closed Arefu closed 7 years ago

Arefu commented 8 years ago

Currently I have

QueryRunner.Notifications.ChannelMessageReceived += Notifications_ChannelMessageReceived;
foreach (ChannelListEntry Channel in QueryRunner.GetChannelList())
{
    QueryRunner.RegisterForNotifications(ServerNotifyRegisterEvent.TextChannel, Channel.ChannelId);
}

I know the QueryRunner only joins the default channel, and I can make it move channels, however I am wondering if there is a way that I can get it to register all messages that get sent to any channel.

Yet again, I know I can use this

QueryRunner.Notifications.ServerMessageReceived += Notifications_ServerMessageReceived;
QueryRunner.RegisterForNotifications(ServerNotifyRegisterEvent.TextServer, 1);

And that will throw if a server message is received, but I am already using that for something special. So, yeah, if there is a way to either get the bot to join all channels, or at least catch if a message is received that would be great (short of moving channels every waking second of course, unless this is the only way)

XoMEX commented 8 years ago

You can only receive ChannelMessages from the channel the QueryClient is currently in (answered here) Also the second Parameter (cid) is optional, and in most cases not needed...

You can move the QueryClient to a specific channel and could tell your users to send ChannelMessages there. You could filter the ServerMessages so that you could use the ServerMessages for both, but personally I'd not recommend that since all users receive them, and (I don't know what you are planning to do) the Server might end up being spammed...

You could use TextPrivate so that clients have to send Messages directly to the QueryClient. To get your users to do that I recommend a (private) Welcome Message from the QueryClient to connected Clients, so that they have a chat-tab open with the Queryclient. Alternatively you could allow users to see QueryClients, but most users don't know how to use that feature. Or you could use TextPrivate on a normal Client. For that you'd need to start a normal TS3client with the ClientQuery Plugin enabled and connect your Programm to the client. Sadly this repo doesen't have all the ClientQuery commands implemented, you'd have to do that by yourself.

Or you could create one QueryClient for each channel... theoretically...