Пример #1
0
 private void OnTextMessage(TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs args)
 {
     if (MessageReceived != null)
     {
         MessageReceived(this, args);
     }
 }
Пример #2
0
        private void onClientMessage(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs e)
        {
            //throw new NotImplementedException();

            if (e.Message == "!scan")
            {
                ScanRooms();

                //TS3QueryLib.Core.Common.Entities.SpacerInfo test;
                //list.Values[0]
            }
            else if (e.Message == "!getusers")
            {
                ClientDbEntryListResponse      list     = queryRunner.GetClientDatabaseList();
                ListResponse <ClientListEntry> userlist = queryRunner.GetClientList(true);
                ClientInfoResponse             user     = queryRunner.GetClientInfo(2);

                foreach (ClientDbEntry item in list)
                {
                }
                foreach (ClientListEntry item in userlist)
                {
                }
            }
        }
Пример #3
0
        private void onClientMessage(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs e)
        {
            //throw new NotImplementedException();

            if (e.Message == "!getusers")
            {
                ClientDbEntryListResponse      list     = queryRunner.GetClientDatabaseList();
                ListResponse <ClientListEntry> userlist = queryRunner.GetClientList(true);
                ClientInfoResponse             user     = queryRunner.GetClientInfo(2);

                foreach (ClientDbEntry item in list)
                {
                }
                foreach (ClientListEntry item in userlist)
                {
                }
            }

            //should not double-fire
        }
Пример #4
0
        private void ServerQueryConnection_BotCommandReceived(object sender, TS3QueryLib.Core.CommandHandling.CommandParameterGroup cmd, TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs e)
        {
            logger.Info("Command objects are tricky business! This command was: {0}", cmd[0].Name);

            if (cmd[0].Name.ToLower() == "kickall")
            {
                ServerQueryConnection.QueryRunner.PokeClient(e.InvokerClientId, "Go away, that's dangerous");
                ServerQueryConnection.QueryRunner.KickClient(e.InvokerClientId, KickReason.Server);
                logger.Warn("That's some dangerous stuff, you better leave.");
            }
            else if (cmd[0].Name.ToLower() == "coolcommand")
            {
                // Both lines below do the same thing, but ServerQueryConnection.TextReply from the AddonBase class tries to make it more convenient for replies :-)

                //this.ServerQueryConnection.queryRunner.SendTextMessage(MessageTarget.Client, e.InvokerClientId, "That's a nice test you have there..");
                ServerQueryConnection.TextReply(e, "That's a nice test you have there..");

                CommandParameter someparam = null;

                if (cmd.Exists(c => (someparam = c).Name == "someparam"))
                {
                    ServerQueryConnection.TextReply(e, String.Format("Nice, a parameter! BTW, If you encode it, it will look like this: {0}", someparam.EncodedValue));
                }
            }
        }
Пример #5
0
 private void HandleTextMessage(CommandParameterGroupList parameterGroupList)
 {
     TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs eventArgs = new TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs(parameterGroupList);
     OnTextMessage(eventArgs);
 }
Пример #6
0
        private void onBotCommandAttempt(object sender, TS3QueryLib.Core.CommandHandling.CommandParameterGroup cmd, TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs e)
        {
            try
            {
                CommandParameterGroupWithRules theCmd = null;
                var theSchema = commands.SingleOrDefault(x => x.Commands.Any(y => (theCmd = (CommandParameterGroupWithRules)y).First().Name == cmd.First().Name));

                if (theSchema != null)
                {
                    // Find owner addon
                    var addon = CoreList.SingleOrDefault(a => a.Name == theSchema.CoreName);

                    // Validate command data
                    theCmd.ValidateAddData(cmd);

                    // Invoke defined method linked to command
                    theSchema.Method.Invoke(new BotCommandEventArgs(theCmd, e));
                }

                // Notify parent
                //onBotCommand.Invoke(sender, new BotCommandEventArgs(theCmd, e));
            }
            catch (Exception ex)
            {
                logger.Warn(ex, "Command failed to execute");

                if (onFailedBotCommand != null)
                {
                    onFailedBotCommand.Invoke(sender, new FailedBotCommandEventArgs(cmd, e));
                }
            }
        }
Пример #7
0
 private void onServerMessage(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs e)
 {
 }
Пример #8
0
 private void HandleTextMessage(CommandParameterGroupList parameterGroupList)
 {
     TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs eventArgs = new TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs(parameterGroupList);
     OnTextMessage(eventArgs);
 }
Пример #9
0
 /// <summary>
 /// Event MessageReceived
 /// Sends TalkEvent to Text synthesiser
 /// </summary>
 private void Notifications_MessageReceived(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs e)
 {
     TeamspeakReader.ChatReader.AddTextToQueue(e.InvokerNickname + " " + e.Message, e.InvokerNickname);
 }
 /// <summary>
 /// Event MessageReceived
 /// Will change TextMessage to "nickname: message"
 /// starts a timer that will clear the message after 1 minute
 /// </summary>
 private void Notifications_MessageReceived(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.MessageReceivedEventArgs e)
 {
     TextMessage = e.InvokerNickname + ":\r\n" + e.Message;
     chatTimer.Start();
 }