Esempio n. 1
0
        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);
        }
Esempio n. 3
0
        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();
            }
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        private void setupDefaultBehavior()
        {
            TelegramBotInstanceNode telegramBotInstance = this.InParameters["telegramBot"].GetValue() as TelegramBotInstanceNode;

            telegramBotInstance.Bot.OnMessage += Bot_OnMessage;
        }
Esempio n. 6
0
        public override void OnStop()
        {
            TelegramBotInstanceNode telegramBotInstance = this.InParameters["telegramBot"].GetValue() as TelegramBotInstanceNode;

            telegramBotInstance.Bot.OnMessage -= Bot_OnMessage;
        }
Esempio n. 7
0
        public override void SetupEvent()
        {
            TelegramBotInstanceNode telegramBotInstance = this.InParameters["telegramBot"].GetValue() as TelegramBotInstanceNode;

            this.setupDefaultBehavior();
        }