forked from Bluscream/TS3AudioBotPlugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample.cs
33 lines (32 loc) · 1.18 KB
/
Example.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using TS3AudioBot;
using TS3AudioBot.Plugins;
using TS3Client;
using TS3Client.Commands;
using TS3Client.Full;
namespace Example
{
public class Example : ITabPlugin {
private MainBot bot;
private Ts3FullClient lib;
public void Initialize(Core mainBot)
{
bot = mainBot.Bots.GetBot(0);
lib = bot.QueryConnection.GetLowLibrary<Ts3FullClient>();
lib.OnClientMoved += Lib_OnClientMoved;
}
private void Lib_OnClientMoved(object sender, System.Collections.Generic.IEnumerable<TS3Client.Messages.ClientMoved> e) {
foreach (var client in e)
{
lib.SendPrivateMessage("Hello, you just moved to another channel", client.ClientId);
try {
lib.Send("clientpoke", new CommandParameter("clid", client.ClientId),
new CommandParameter("msg", "Oh,\\sno\\swhat\\sare\\syou\\sdoing?"));
} catch (Exception ex) { Log.Write(Log.Level.Warning, string.Format("Exception thrown while trying to poke client #{0}: {1}", client.ClientId, ex.Message)); }
}
}
public void Dispose() {
lib.OnClientMoved -= Lib_OnClientMoved;
}
}
}