private void RemoveByType(GatewayCommandCode code)
 {
     lock (_syncRoot)
     {
         _pendingCommands.RemoveAll(c => c.OpCode == code);
     }
 }
示例#2
0
        /// <summary>
        /// Send a command to discord over the websocket
        /// </summary>
        /// <param name="opCode">Command code to send</param>
        /// <param name="data">Data to send</param>
        public void Send(GatewayCommandCode opCode, object data)
        {
            CommandPayload payload = new CommandPayload
            {
                OpCode  = opCode,
                Payload = data
            };

            _commands.Enqueue(payload);
        }