private void SetMetaData() { var af = bot.ConfigManager.GetDataStruct <AudioFrameworkData>("AudioFramework", true); var qc = bot.ConfigManager.GetDataStruct <Ts3FullClientData>("QueryConnection", true); var metaData = "\nQueryConnection::AudioBitrate=" + qc.AudioBitrate; metaData += "\nAudioFramework::AudioMode=" + af.AudioMode; metaData += "\nAudioFramework::DefaultVolume=" + af.DefaultVolume; metaData += "\nQueryConnection::Address=" + qc.Address; metaData += "\nQueryConnection::DefaultNickname=" + qc.DefaultNickname; metaData += "\nQueryConnection::IdentityLevel=" + qc.IdentityLevel; lib.Send("clientupdate", new CommandParameter("client_meta_data", metaData)); }
public string Poke(int ClientId, [Consume] string Message = "test") { if (!client.Connected) { return("Not connected!"); } client.Send("clientpoke", new ICommandPart[] { new CommandParameter("msg", Message), new CommandParameter("clid", ClientId) }); return("OK"); }
public void Poke(Client client, string msg) { var msgs = Regex.Split(msg, @"(.{1,100})(?:\s|$)|(.{100})").Where(x => x.Length > 0); foreach (var _msg in msgs) { lib.Send("clientpoke", new CommandParameter("clid", client.Id), new CommandParameter("msg", _msg)); } }
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 static IEnumerable <ResponseDictionary> SetClientChannelGroup(Ts3FullClient cli, ChannelGroupIdT cgid, ChannelIdT cid, ClientDbIdT cldbid) { Console.WriteLine($"Trying to set channelgroup {cgid} for client {cldbid} in channel {cid}"); try { return(cli.Send("setclientchannelgroup", new CommandParameter("cgid", cgid), new CommandParameter("cid", cid), new CommandParameter("cldbid", cldbid) )); } catch { return(null); } }
private static void CreateTempChannel(int count) { client.Send("channelcreate", new CommandParameter("clid", client.ClientId), new CommandParameter("msg", ""), new CommandParameter("msg", ""), new CommandParameter("msg", ""), new CommandParameter("msg", ""), new CommandParameter("msg", ""), new CommandParameter("msg", ""), new CommandParameter("msg", "") ); }
public R <ClientList, LocalStr> GetFallbackedClientById(ushort id) { var result = ClientBufferRequest(client => client.ClientId == id); if (result.Ok) { return(result); } Log.Warn("Slow double request due to missing or wrong permission configuration!"); var result2 = tsFullClient.Send <ClientList>("clientinfo", new CommandParameter("clid", id)).WrapSingle(); if (!result2.Ok) { return(new LocalStr(strings.error_ts_no_client_found)); } ClientList cd = result2.Value; cd.ClientId = id; clientbuffer.Add(cd); return(cd); }
public void CommandTPRequest(ExecutionInformation info, string message) { lib.Send("clientupdate", new CommandParameter("client_talk_request", 1), new CommandParameter("client_talk_request_msg", message = message ?? "")); }
public static ClientUidT ClientGetUidFromClid(Ts3FullClient cli, ClientIdT clid) { return(cli.Send("clientgetuidfromclid", new CommandParameter("clid", clid)).FirstOrDefault()["cluid"].Replace("\\", "")); }
public static IEnumerable <ChannelListResponse> GetChannelList(Ts3FullClient client) { return(client.Send <ChannelListResponse>("channellist")); }
public static IEnumerable <ChannelGroupListResponse> GetAllChannelGroups(Ts3FullClient client) { return(client.Send <ChannelGroupListResponse>("channelgrouplist")); }
private void PlayManager_AfterResourceStarted(object sender, PlayInfoEventArgs e) { if (!Settings.Default.Enabled) { return; } PluginLog(Log.Level.Debug, "Track changed. Applying now playing values"); if (!string.IsNullOrWhiteSpace(Settings.Default.Description)) { try { bot.QueryConnection.ChangeDescription(ParseNowPlayingString(Settings.Default.Description, e)); } catch (Exception ex) { PluginLog(Log.Level.Warning, "Exeption thrown while trying to change Description: " + ex.Message); } } if (!string.IsNullOrWhiteSpace(Settings.Default.ServerChat)) { try { bot.QueryConnection.SendServerMessage(ParseNowPlayingString(Settings.Default.ServerChat, e)); } catch (Exception ex) { PluginLog(Log.Level.Warning, "Exeption thrown while trying to send Server Message: " + ex.Message); } } if (!string.IsNullOrWhiteSpace(Settings.Default.ChannelChat)) { try { bot.QueryConnection.SendChannelMessage(ParseNowPlayingString(Settings.Default.ChannelChat, e)); } catch (Exception ex) { PluginLog(Log.Level.Warning, "Exeption thrown while trying to send Channel Message: " + ex.Message); } } if (!string.IsNullOrWhiteSpace(Settings.Default.PrivateChat)) { try { var clientbuffer = lib.ClientList(ClientListOptions.uid).ToList(); foreach (var client in clientbuffer) { foreach (var uid in Settings.Default.PrivateChatUIDs) { if (client.Uid == uid) { bot.QueryConnection.SendMessage(ParseNowPlayingString(Settings.Default.PrivateChat, e), client.ClientId); } } } } catch (Exception ex) { PluginLog(Log.Level.Warning, "Exeption thrown while trying to send private Message: " + ex.Message); } } if (!string.IsNullOrWhiteSpace(Settings.Default.NickName)) { try { bot.QueryConnection.ChangeName(ParseNowPlayingString(Settings.Default.NickName, e)); } catch (Exception ex) { PluginLog(Log.Level.Warning, "Exeption thrown while trying to change nickname: " + ex.Message); } } if (!string.IsNullOrWhiteSpace(Settings.Default.PluginCommand)) { try { lib.Send("plugincmd", new CommandParameter("name", "TS3AudioBot"), new CommandParameter("targetmode", 0), new CommandParameter("data", ParseNowPlayingString(Settings.Default.PluginCommand, e))); } catch (Exception ex) { PluginLog(Log.Level.Warning, "Exeption thrown while trying to send Plugin Command: " + ex.Message); } } if (!string.IsNullOrWhiteSpace(Settings.Default.MetaData)) { try { /* TODO: Append Meta Data * var clid = lib.ClientId; * var ownClient = lib.Send<ClientData>("clientinfo", new CommandParameter("clid", clid)).FirstOrDefault(); * ownClient.*/ lib.Send("clientupdate", new CommandParameter("client_meta_data", ParseNowPlayingString(Settings.Default.MetaData, e))); } catch (Exception ex) { PluginLog(Log.Level.Warning, "Exeption thrown while trying to set Meta Data: " + ex.Message); } } var ownChannelId = lib.WhoAmI().ChannelId; if (!string.IsNullOrWhiteSpace(Settings.Default.ChannelName)) { try { lib.Send("channeledit", new CommandParameter("cid", ownChannelId), new CommandParameter("channel_name", ParseNowPlayingString(Settings.Default.ChannelName, e))); } catch (Exception ex) { PluginLog(Log.Level.Warning, "Exeption thrown while trying to set channel name: " + ex.Message); } } if (!string.IsNullOrWhiteSpace(Settings.Default.ChannelTopic)) { try { lib.Send("channeledit", new CommandParameter("cid", ownChannelId), new CommandParameter("channel_topic", ParseNowPlayingString(Settings.Default.ChannelTopic, e))); } catch (Exception ex) { PluginLog(Log.Level.Warning, "Exeption thrown while trying to set channel topic: " + ex.Message); } } if (!string.IsNullOrWhiteSpace(Settings.Default.ChannelDescription)) { try { lib.Send("channeledit", new CommandParameter("cid", ownChannelId), new CommandParameter("channel_description", ParseNowPlayingString(Settings.Default.ChannelDescription, e))); } catch (Exception ex) { PluginLog(Log.Level.Warning, "Exeption thrown while trying to set channel description: " + ex.Message); } } }