Example #1
0
 public virtual void OnButtonClick(BaseChat chat, User user, KeyboardButtonPayload payload)
 {
     if (!OnButtonClick(new ButtonClickEventArgs(chat, user, payload)))
     {
         return;
     }
     chat.InvokeButton(user, payload);
 }
Example #2
0
 public virtual void OnButtonClick(BaseChat chat, User user, string message, KeyboardButtonPayload payload, Message messageData)
 {
     if (!OnButtonClick(new ButtonClickEventArgs(chat, user, message, payload, messageData)))
     {
         return;
     }
     chat.InvokeButton(user, payload);
 }
Example #3
0
 private bool ClickButton(User user, string message, BaseChat chat, Message messageData)
 {
     if (!string.IsNullOrEmpty(messageData.Payload))
     {
         try
         {
             var payload = KeyboardButtonPayload.Deserialize(messageData.Payload);
             if (payload != null && payload.IsValid())
             {
                 if (payload.GroupId == VkApi.GroupId || payload.GroupId == 0)
                 {
                     OnButtonClick(chat, user, message, payload, messageData);
                 }
                 return(true);
             }
         }
         catch (Exception e)
         {
             VkApi.Core.Log.Error(e.ToString());
         }
     }
     return(false);
 }
Example #4
0
 internal bool ClickButton(BaseChat chat, User user, EventId eventId, string payload)
 {
     if (!string.IsNullOrEmpty(payload))
     {
         try
         {
             var _payload = KeyboardButtonPayload.Deserialize(payload);
             if (_payload != null && _payload.IsValid())
             {
                 _payload.EventId = eventId;
                 if (_payload.GroupId == VkApi.GroupId || _payload.GroupId == 0)
                 {
                     OnButtonClick(chat, user, _payload);
                 }
                 return(true);
             }
         }
         catch (Exception e)
         {
             VkApi.Core.Log.Error(e.ToString());
         }
     }
     return(false);
 }