Click here to Skip to main content
15,881,898 members
Home / Discussions / C#
   

C#

 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
Richard MacCutchan15-Jul-20 5:31
mveRichard MacCutchan15-Jul-20 5:31 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
OriginalGriff15-Jul-20 5:37
mveOriginalGriff15-Jul-20 5:37 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
#realJSOP15-Jul-20 23:45
mve#realJSOP15-Jul-20 23:45 
GeneralRe: Padding a string with integers on its right keeping string length fixed Pin
Daniel Pfeffer16-Jul-20 1:15
professionalDaniel Pfeffer16-Jul-20 1:15 
QuestionZkteco get device operation logs Pin
Member 1488936814-Jul-20 7:45
Member 1488936814-Jul-20 7:45 
AnswerRe: Zkteco get device operation logs Pin
OriginalGriff14-Jul-20 8:21
mveOriginalGriff14-Jul-20 8:21 
AnswerRe: Zkteco get device operation logs Pin
ZurdoDev15-Jul-20 6:16
professionalZurdoDev15-Jul-20 6:16 
QuestionTelegram.Bot doesn't invoke Bot.OnMessage Pin
SezzRS14-Jul-20 7:35
SezzRS14-Jul-20 7:35 
I want to do a telegram bot that answers messages and get updates. I created web application on Visual Studio 2015 Express. I write my codes to global.asax. I have installed Telegram.Bot package. I can run the program but program doesn't anything. What may be the problem? Thanks for asistance.

My codes are below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Threading;
using System.Threading.Tasks;
using System.Net;

using Telegram.Bot;
using Telegram.Bot.Args;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
using Telegram.Bot.Types.ReplyMarkups;
using System.IO;



namespace EC
{

public class Global : System.Web.HttpApplication
    {

        Telegram.Bot.TelegramBotClient Bot = new TelegramBotClient("xxxxxx");

        protected void Application_Start()
        {
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            Bot.OnMessage += Bot_OnMessage;
            Bot.OnUpdate += Bot_OnUpdate;
            Bot.StartReceiving();

        }

        private void Bot_OnMessage(object sender, MessageEventArgs messageEventArgs)
        {
            var message = messageEventArgs.Message;

            if (message == null || message.Type != MessageType.Text) return;

            if (message.Text.Contains("/start"))
            {
                string Str = "Start Received";

                Bot.SendTextMessageAsync(message.Chat.Id, Str);

            }
            else if (message.Text.Contains("/Stop"))
            {
                string Str = "Stop Received";
                Bot.SendTextMessageAsync(message.Chat.Id, Str);
            }
        }
 }

AnswerRe: Telegram.Bot doesn't invoke Bot.OnMessage Pin
ZurdoDev15-Jul-20 6:17
professionalZurdoDev15-Jul-20 6:17 
QuestionMessage Closed Pin
13-Jul-20 21:16
umeshamin13-Jul-20 21:16 
AnswerRe: Former English teacher solves a math problem with Python. Pin
Pete O'Hanlon13-Jul-20 21:22
mvePete O'Hanlon13-Jul-20 21:22 
AnswerRe: Former English teacher solves a math problem with Python. Pin
OriginalGriff13-Jul-20 21:50
mveOriginalGriff13-Jul-20 21:50 
QuestionActive Directory Question Pin
Kevin Marois13-Jul-20 10:15
professionalKevin Marois13-Jul-20 10:15 
AnswerRe: Active Directory Question Pin
Richard Deeming13-Jul-20 22:25
mveRichard Deeming13-Jul-20 22:25 
GeneralRe: Active Directory Question Pin
Kevin Marois14-Jul-20 7:47
professionalKevin Marois14-Jul-20 7:47 
GeneralRe: Active Directory Question Pin
Richard Deeming14-Jul-20 23:04
mveRichard Deeming14-Jul-20 23:04 
Questionwhich website learn and solution C# window Application Pin
KNOWEDGE SHARE12-Jul-20 2:50
KNOWEDGE SHARE12-Jul-20 2:50 
AnswerRe: which website learn and solution C# window Application Pin
OriginalGriff12-Jul-20 4:29
mveOriginalGriff12-Jul-20 4:29 
GeneralRe: which website learn and solution C# window Application Pin
Gerry Schmitz12-Jul-20 6:28
mveGerry Schmitz12-Jul-20 6:28 
AnswerRe: which website learn and solution C# window Application Pin
Richard MacCutchan12-Jul-20 6:35
mveRichard MacCutchan12-Jul-20 6:35 
AnswerRe: which website learn and solution C# window Application Pin
Dave Kreskowiak12-Jul-20 7:36
mveDave Kreskowiak12-Jul-20 7:36 
GeneralRe: which website learn and solution C# window Application Pin
OriginalGriff12-Jul-20 9:10
mveOriginalGriff12-Jul-20 9:10 
AnswerRe: which website learn and solution C# window Application Pin
Super Lloyd12-Jul-20 15:21
Super Lloyd12-Jul-20 15:21 
AnswerRe: which website learn and solution C# window Application Pin
Member 1480992814-Jul-20 21:06
Member 1480992814-Jul-20 21:06 
QuestionDns.GetHostAddresses Question Pin
pkfox11-Jul-20 6:19
professionalpkfox11-Jul-20 6:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.