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)); } }
public static TelegramBotReply ReplyBotNoContact(TelegramBotReply reply, Chat originalGroup, User user) { reply.Tag = new NoContactHandler(reply, originalGroup, user, Spoilerbot); return reply; }
internal MessageHandlerResult(bool success, TelegramBotReply reply = null) { Success = success; Reply = reply; }