public override bool OnExecution() { TelegramBotInstanceNode telegramBotInstance = this.InParameters["telegramBot"].GetValue() as TelegramBotInstanceNode; telegramBotInstance.Bot.SendTextMessageAsync(int.Parse(this.InParameters["chatId"].GetValue().ToString()), this.InParameters["message"].GetValue().ToString()); return(true); }
public override bool OnExecution() { TelegramBotInstanceNode telegramBotInstance = this.InParameters["telegramBot"].GetValue() as TelegramBotInstanceNode; telegramBotInstance.Bot.SendTextMessageAsync(long.Parse(this.InParameters["chatId"].GetValue().ToString()), this.InParameters["message"].GetValue().ToString(), global::Telegram.Bot.Types.Enums.ParseMode.Html); return(true); }
private void Bot_OnMessage(object sender, global::Telegram.Bot.Args.MessageEventArgs e) { TelegramBotInstanceNode telegramBotInstance = this.InParameters["telegramBot"].GetValue() as TelegramBotInstanceNode; if (e.Message.Text == "id") { telegramBotInstance.Bot.SendTextMessageAsync(e.Message.Chat.Id, "The chat ID is : " + e.Message.Chat.Id).Wait(); } }
private void Bot_OnMessage(object sender, global::Telegram.Bot.Args.MessageEventArgs e) { TelegramBotInstanceNode telegramBotInstance = this.InParameters["telegramBot"].GetValue() as TelegramBotInstanceNode; if (e.Message.Text == "id") { telegramBotInstance.Bot.SendTextMessageAsync(e.Message.Chat.Id, "The chat ID is : " + e.Message.Chat.Id).Wait(); } else { var instanciatedParameters = this.InstanciateParametersForCycle(); instanciatedParameters["message"].SetValue(e.Message.Text); instanciatedParameters["chatId"].SetValue(e.Message.Chat.Id); instanciatedParameters["fromId"].SetValue(e.Message.From.Id); instanciatedParameters["from"].SetValue(e.Message.From.Username); this.Graph.AddCycle(this, instanciatedParameters); } }
private void setupDefaultBehavior() { TelegramBotInstanceNode telegramBotInstance = this.InParameters["telegramBot"].GetValue() as TelegramBotInstanceNode; telegramBotInstance.Bot.OnMessage += Bot_OnMessage; }
public override void OnStop() { TelegramBotInstanceNode telegramBotInstance = this.InParameters["telegramBot"].GetValue() as TelegramBotInstanceNode; telegramBotInstance.Bot.OnMessage -= Bot_OnMessage; }
public override void SetupEvent() { TelegramBotInstanceNode telegramBotInstance = this.InParameters["telegramBot"].GetValue() as TelegramBotInstanceNode; this.setupDefaultBehavior(); }