public NoContactHandler(TelegramBotReply reply, Chat originalGroup, User u, TelegramBot.TelegramBot bot)
 {
     reply.OnMessageNotSent += OnMessageNotSent;
     this.originalGroup = originalGroup;
     user = u;
     this.bot = bot;
 }
 private void OnMessageNotSent(System.Net.Http.HttpResponseMessage response, TelegramBotReply reply)
 {
     if (response.StatusCode == System.Net.HttpStatusCode.Forbidden || response.StatusCode == System.Net.HttpStatusCode.BadRequest)
     { 
         var userName = user.Username == null ? user.ToString() : $"@{user.Username}";
         var newMessage = Message(originalGroup.ID, $"I'm sorry {userName}. You must first start the  @{bot.Bot.Username}!");
         bot.AddQueuedMessage(newMessage.HandleReply(bot));
     }
 }
Exemplo n.º 3
0
 public static TelegramBotReply ReplyBotNoContact(TelegramBotReply reply, Chat originalGroup, User user)
 {
     reply.Tag = new NoContactHandler(reply, originalGroup, user, Spoilerbot);
     return reply;
 }
Exemplo n.º 4
0
 internal MessageHandlerResult(bool success, TelegramBotReply reply = null)
 {
     Success = success;
     Reply = reply;
 }