(Update 2020) Create basic Messaging Telegram Bot with c# .net

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024
  • In this video I show you how to create a basic telegram bot that sends messages to the user according to his input
    / medukrin

Комментарии • 73

  • @MrMirco2012
    @MrMirco2012 3 года назад +4

    Thank you!! Very helpful tutorial, I always look at it when implementing Telegram in my projects. Also your English improved a lot!

  • @SwubleStudio
    @SwubleStudio 2 года назад +1

    That's guide nice for begginers!
    Thanks Bro!

  • @ercankaradas1164
    @ercankaradas1164 2 года назад

    Thanks Ibrahim, I can listen to a group through a program, but I want to listen to the same group with more than one program at the same time.

  • @teseeral-khatib400
    @teseeral-khatib400 3 года назад +1

    To those who are facing a problem with the connection between the bot and the program
    you need to create Console Application .Net Core (not Framework).

    • @sahelraziq9368
      @sahelraziq9368 3 года назад +1

      Thanks Bro

    • @teseeral-khatib400
      @teseeral-khatib400 3 года назад

      @@sahelraziq9368
      Welcome ❤️

    • @Junaid_Umer
      @Junaid_Umer 3 года назад

      Hi, Brother I am still having the same problem, my breakpoint not gonna hit, I tried making console application for both Core3.1 and Core 2.1

  • @thelonelyguy1742
    @thelonelyguy1742 4 года назад

    Hey bro very good tutorial and video in general, I will look forward to a new video on this topic. Thank you

  • @BarneyMyBoy
    @BarneyMyBoy 3 года назад

    Thanks Ibrahim, this is what I have been looking for.

  • @SandeepGulati05
    @SandeepGulati05 3 года назад

    Thanks, Ibrahim. Very informative and it works for me very well!

  • @mohammadhassan4299
    @mohammadhassan4299 3 года назад

    Very helpful, Thank you sir

  • @alcxander
    @alcxander 3 года назад +2

    just gotta say I really appreciate you mentioning what shortcuts you are using as you are doing the coding. Primo behaviour that is :)

  • @mohammadalkhbaz4650
    @mohammadalkhbaz4650 3 года назад

    Thank you!! Very helpful tutorial,

  • @Revalium
    @Revalium 2 года назад

    Nice explained

  • @VladisS.Vostok2000
    @VladisS.Vostok2000 3 года назад

    Great!
    That's guide pretty good for begginers!
    Thanks!

  • @user-rc3ey4yb2q
    @user-rc3ey4yb2q 2 года назад

    Thank you so much for your work

  • @kabeernarang3936
    @kabeernarang3936 Год назад

    can you post a call back query tutorial video

  • @xdbehzad
    @xdbehzad 4 года назад

    Thank you for your good tutorials
    I have a question, how do I make the bot only respond to replies, or ignore them?

  • @vronghel
    @vronghel 2 года назад

    Is it possible to make an video for texting an emoji?
    Thanks in advance!!

  • @turkiyenet845
    @turkiyenet845 3 года назад

    يسلمو معلم بس ياريت شارح بالعربي كان احسن 😂

  • @barakkadosh
    @barakkadosh 3 года назад

    Thank you very good tutorial but i have some issu can you help please i want to create buttom in web page tath if i click it will send message to the bot group i make in the telegram how can i do it ?

  • @wymowaiyan6505
    @wymowaiyan6505 3 года назад

    Thank you for this! Can I check how to retrieve multiple responses. Example
    bot ask what is your name?
    User response “John”
    Bot ask where do u live?
    User response “England”
    How can I retrieve these two responses or more?

    • @codewithibrahim9995
      @codewithibrahim9995  3 года назад

      Hi, you have to save the responses of the users per user Id, Simple case: use a map which maps userId to {message,date} array, or use a database (sqlite)

    • @wymowaiyan6505
      @wymowaiyan6505 3 года назад

      @@codewithibrahim9995 thank you for your reply. I think I may have asked wrongly. It’s just for a single user

    • @codewithibrahim9995
      @codewithibrahim9995  3 года назад

      WYMO Wai Yan in all cases you have to maintain the user Id in order to answer this exact user and avoid strangers

    • @wymowaiyan6505
      @wymowaiyan6505 3 года назад

      @@codewithibrahim9995 noted with thanks. where/how would you recommend to deploy this .net to a server?

  • @paladin117
    @paladin117 3 года назад

    Hi
    thanks for this video its so helpful.
    I have a question if I want my Bot delete The join massage in group What I should Write or if is so long get me a link for help me .
    thanks again and sorry for my language I can not write good.

  • @Revalium
    @Revalium 2 года назад

    is it possible to get all my channel member ids and add it to a List with api ?

  • @leekaixiang9674
    @leekaixiang9674 3 года назад

    Thank you. How can i hold for user input?

  • @mooshsmb5512
    @mooshsmb5512 2 года назад

    finally

  • @thanhphungnguyen8161
    @thanhphungnguyen8161 4 года назад +1

    i dont know why, i make exact like this video but my bot doesnt run. I have check break point but it doesnt even step into the function Bot_OnMessage(object sender, Telegram.Bot.Args.MessageEventArgs e).

    • @codewithibrahim9995
      @codewithibrahim9995  4 года назад

      Make sure you add Bot.StartReceiving()

    • @thanhphungnguyen8161
      @thanhphungnguyen8161 4 года назад

      @@codewithibrahim9995
      static TelegramBotClient Bot = new TelegramBotClient("");
      static void Main(string[] args)
      {
      Bot.StartReceiving();
      Bot.OnMessage += Bot_OnMessage;
      Console.ReadLine();
      }
      private static void Bot_OnMessage(object sender, Telegram.Bot.Args.MessageEventArgs e)
      {
      if (e.Message.Type == Telegram.Bot.Types.Enums.MessageType.Text)
      Bot.SendTextMessageAsync(e.Message.Chat.Id, "hello");
      }
      i surely put it in. Here is my code

    • @codewithibrahim9995
      @codewithibrahim9995  4 года назад +1

      put “await” before Bot.SendTextMessageAsync(). Also make the function async by writing private static async void Bot_OnMessage

    • @thanhphungnguyen8161
      @thanhphungnguyen8161 4 года назад +1

      @@codewithibrahim9995 it does not work at all

    • @codewithibrahim9995
      @codewithibrahim9995  4 года назад

      Ok. Please double check your bot token, add a Console.WriteLine() to confirm that you are receiving messages from your bot.

  • @cheqamarul6431
    @cheqamarul6431 3 года назад

    got a video about API request/response?

  • @stefano19951995
    @stefano19951995 4 года назад

    Hello. How do i implement listening after the user has already typed a listened answer?

  • @Rahulsapkota
    @Rahulsapkota 2 года назад

    is there any way to integrate it in web api

  • @CristianRamirez-lw8js
    @CristianRamirez-lw8js 3 года назад

    Thank you, great tutorial, i have a cuestion, How can I get the users (chat id) who use the bot?

  • @younessesoft
    @younessesoft 3 года назад

    how can get phone number for sender ???

  • @firdausahmad760
    @firdausahmad760 3 года назад

    any reference for java??

  • @MrRehaan786
    @MrRehaan786 2 года назад

    How can we host the Application to keep it running.

    • @codewithibrahim9995
      @codewithibrahim9995  2 года назад

      If you built the application on .net core you can host it on any operating system (linux based servers for example)

  • @omercimen2303
    @omercimen2303 3 года назад

    How to send picture?

  • @DrWambua
    @DrWambua 2 года назад

    So how do you deploy it to the users?

    • @codewithibrahim9995
      @codewithibrahim9995  2 года назад

      You need a server, aka a computer connected to the internet 7/24

  • @mohammadalkhbaz4650
    @mohammadalkhbaz4650 3 года назад

    you can give me the code or book

  • @ekremkoz549
    @ekremkoz549 4 года назад

    hello bro how can we make this bot run continuously so even if the program is not running

    • @octavylon9008
      @octavylon9008 4 года назад

      You cant, if the program isnt running how will the bot know what to do? If you really need to have it running 24/7 then ull need to get a machine which u can always keep on and run the program on

    • @furkankaraca2211
      @furkankaraca2211 3 года назад

      Use raspberry pi. It is a small cpu which works 7/24 for you.

  • @mohammedhussein4738
    @mohammedhussein4738 2 года назад

    i write this code but not work why??????

    • @codewithibrahim9995
      @codewithibrahim9995  2 года назад

      Share any errors or output please, if none, share your code.

  • @raulcuello2529
    @raulcuello2529 3 года назад

    Not work for me, I did all that you say

    • @raulcuello2529
      @raulcuello2529 3 года назад +2

      I fixed the error using async and await. And was necessary to write something more. Thank you Ibrahim Sammour for your video and your support throw Telegram, this video was introduction for mi.

    • @teseeral-khatib400
      @teseeral-khatib400 3 года назад

      @@raulcuello2529
      send me the code plz, still not working for me !!!

    • @raulcuello2529
      @raulcuello2529 3 года назад

      ​ @Teseer Al-khatiB Follow this video (ruclips.net/video/49iaHuzPvwg/видео.html), upon you add ServicesPointManager need to write 'async' betwwen private and statict word in OnMessage method, also write await before Bot.SentTextMessageAsync(... Try this and let mi know. Apologie fore the code, but at this time I haven't the code on my hand.

    • @teseeral-khatib400
      @teseeral-khatib400 3 года назад

      @@raulcuello2529
      Thx