Exemplo n.º 1
0
        /// <summary>
        /// Invoked when a MESSAGE_CREATE event is fired from Discord's WebSocket server.
        /// </summary>
        /// <param name="response">JSON response.</param>
        public void MessageReceived(string response)
        {
            MessageCreate             message = serializer.Deserialize <MessageCreate>(response);
            DiscordOnMessageEventArgs args    = new DiscordOnMessageEventArgs()
            {
                Message = message.EventData
            };

            OnMessageNotify(args);
        }
Exemplo n.º 2
0
 public void ReadMessage(object sender, DiscordOnMessageEventArgs e)
 {
     if (e.Message != null)
     {
         if (!string.IsNullOrEmpty(e.Message.Content))
         {
             foreach (KeyValuePair <string, string> command in commands)
             {
                 if (command.Key == e.Message.Content)
                 {
                     channelManager.CreateMessage(token, e.Message.ChannelId, command.Value);
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
        protected void OnMessageNotify(DiscordOnMessageEventArgs e)
        {
            EventHandler <DiscordOnMessageEventArgs> handler = OnMessage;

            handler?.Invoke(this, e);
        }