private static BaseEventsBotRequest <TRequestBody> CreateRequest <TRequestBody>(BaseEventsBotRequest <JToken> request, TRequestBody requestBody)
 {
     return(new BaseEventsBotRequest <TRequestBody>(request.botEvent, requestBody, request.lng, request.token));
 }
 protected override bool TryGetProcessor(BaseEventsBotRequest <JToken> request,
                                         out Func <BaseEventsBotRequest <JToken>, Task <BaseEventsBotResponse <IBotEventsResponseBody> > > func)
 {
     return(_eventProcessors.TryGetValue(request.botEvent, out func));
 }
 /// <summary>
 /// message
 /// </summary>
 public virtual Task <BaseEventsBotResponse <PostMessageResponse> > ProcessAsync(BaseEventsBotRequest <PostMessageRequest> request)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// update group event with task
 /// </summary>
 public virtual Task <BaseEventsBotResponse <PostGroupDicussResponse> > ProcessAsync(BaseEventsBotRequest <UpdateGroupEventWithTaskRequest> arg)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public override async Task <BaseEventsBotResponse <PostGroupDicussResponse> > ProcessAsync(BaseEventsBotRequest <PostGroupEventRequest> arg)
 {
     await new MessageApi("botToken").BotPostAsync(new BotPostMessageForm
     {
         postText = arg.request.message,
         corsWmid = new List <string> {
             "wmid"
         }
     });
     return(null);
 }
Example #6
0
 public override Task <BaseEventsBotResponse <PostGroupDicussResponse> > ProcessAsync(BaseEventsBotRequest <PostGroupDicussRequest> request)
 {
     return(Task.FromResult(
                new BaseEventsBotResponse <PostGroupDicussResponse>(new PostGroupDicussResponse
     {
         postText = "I am bot!",
         attachedActions = new List <AttachmentEntityCreateForm>
         {
             new AttachmentEntityCreateForm
             {
                 title = "Would you like to create a bot?",
                 type = AttachmentEntityType.Regular,
                 uid = "yourUid",
                 actions = new List <AttachmentEntityActionCreateForm>
                 {
                     new AttachmentEntityActionCreateForm
                     {
                         type = AttachmentEntityActionType.Button,
                         uid = "yourUid",
                         data = new AttachmentEntityActionButtonView
                         {
                             style = AttachmentEntityActionButtonStyle.Success,
                             text = "Yes"
                         }
                     },
                     new AttachmentEntityActionCreateForm
                     {
                         type = AttachmentEntityActionType.Button,
                         uid = "yourUid1",
                         data = new AttachmentEntityActionButtonView
                         {
                             style = AttachmentEntityActionButtonStyle.Normal,
                             text = "No"
                         }
                     }
                 }
             }
         }
     }, request.token)));
 }