telegram-bot

How can I send a message to someone with my telegram bot using their Username

Deadly 提交于 2019-12-05 00:43:19
I am using the telepot python library, I know that you can send a message when you have someone's UserID(Which is a number). I wanna know if it is possible to send a message to someone without having their UserID but only with their username(The one which starts with '@'), Also if there is a way to convert a username to a UserID. You can't send message to users using their username that is in form of @username , you can just send messages to channel usernames which your bot is administrator of it. Telegram bot api uses chat_id identifier for sending messages. If you want to achieve chat_id of

How can I redirect messages from telegram channels that are in certain format?[telegram bot]

丶灬走出姿态 提交于 2019-12-04 21:11:57
I have many telegram channels, 24\7 they send messages in the format "buy usdjpy sl 145.2 tp 167.4" "eurusd sell sl 145.2 tp 167.4" "eurusd sl 145.2 tp 167.4 SELL" or these words in some order My idea is to create app that checks every channel's message, and redirects it to my channel if it is in the above format. Does telegram api allow it? I solved a similar problem with TdLib . Their GitHub site has full C++, Java and C# examples that you can just modify. I worked on the Java example, and applied most of my changes to the UpdatesHandler.onResult method (line 353). The C++ and C# examples

Telegram bot - receive photo URL

元气小坏坏 提交于 2019-12-04 16:37:09
When a user send an image via Telegram bot it there any way to get the image URL? or I just need to save the image somewhere? In the message array you receive you can find the key photo . There you will find multiple arrays with the following format "file_id" : "XXXX", "file_size" : 1107, "width" : 90, "height" : 51 From one of those array you need to take the file_id . You can then request the file_path with a simple get get on the url https://api.telegram.org/bot<token>/getFile?file_id=<file_id> You will receive an array that looks as following "ok" : true, "result" : { "file_id" : "XXXX",

telegram bot - keep questions and answers

廉价感情. 提交于 2019-12-04 15:22:14
My telegram bot is a dialog and it needs to keep the questions and the answers (like TriviaBot). What is the best (most efficient) method to do this? A database with the user id as key? There is a lot of telegram bots, but where are examples with the source code to get ideas? Your question is not really related to the telegram bot API. You are essentially asking: I have an application that has to keep an history of user interactions, how to do this (efficient)? To answer that: you could use a database and insert an entry for each conversation using an unique identifier. Since telegram has a

How to hide ReplyKeyboardMarkup after user click in Telegram Bot API

扶醉桌前 提交于 2019-12-04 11:16:54
问题 I am using Node.js telegram-bot-api. Idea: Show a custom keyboard with one button - "Share my phone number". When user clicks this button, contact should be sent and button should be removed from screen. Here is a code I am using right now: bot.sendMessage({ text: 'Please give us your phone number', reply_markup: JSON.stringify({ keyboard: [ [{ text: 'Share my phone number', request_contact: true }] ], resize_keyboard: true, one_time_keyboard: true }) }); Problems: When user clicks "Share my

Telegram Bot How to delete or remove a message or media from a channel or group

让人想犯罪 __ 提交于 2019-12-04 08:57:42
问题 I want to know an example of removing message or file like a photo I did not find any functional tutorial in this regard, 回答1: There is no such functionality in Telegram Bot API right now. UPD 2017-05-19: There is an official method deleteMessage , more info: https://core.telegram.org/bots/api#deletemessage https://stackoverflow.com/a/43965602/1140438 回答2: There is an official support of deleteMessage method in Bot API 3.0. More details here: https://core.telegram.org/bots/api#deletemessage

Telegram Bot API: getChatMember throws USER_ID_INVALID for valid user

女生的网名这么多〃 提交于 2019-12-04 07:34:39
I'm trying to find out if a specific User is present in a supergroup, in order to keep track of those who left. For that, I'm calling the Bot API method getChatMember for each User and checking if their status is either Left or Kicked . However, I noticed that (recently?) I'm getting USER_ID_INVALID errors for many valid users that are either in the supergroup or have been in the past and then left. I also confirmed that those accounts are still active on Telegram. Here's the HTTP request I'm sending: POST https://api.telegram.org/botXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX/getChatMember HTTP/1.1

always failed to send image using telegram API using PHP

被刻印的时光 ゝ 提交于 2019-12-04 06:48:39
问题 I want to make a function to send an image using Telegram API (reference API: https://github.com/mgp25/Telegram-Bot-API/), but when I try to run this, I always get an error like this: Message: file_get_contents(''): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request Here is my code [updated]: <?php require 'Telegram.php'; $tele = new telegramBot('token'); //$info = $tele->sendMessage('218945828',"wadaw"); $url= 'image/maldini.jpg'; $info = $tele->sendPhoto('chatid',$url);

How to join my Telegram Bot to PUBLIC channel

久未见 提交于 2019-12-04 02:47:48
My question is: how to join my telegram bot to a telegram public channel that I am not administrator of it, and without asking the channel's admin to add my bot to the channel? maybe the chatId of channel or thru link of channel? Thank you in advance :) edit------ I have heard that some people claim to do this join their bot to channels, and scrape data. So if Telegram does not allow it, how can they do it? can you think of any work around? Appreciate your time? Till today, only the Channel Creator can add a bot (as Administrator or Member) to the Channel, whether public or private. Even the

Telegram inline keyboard and keyboard

人走茶凉 提交于 2019-12-04 00:23:00
问题 I have question about Telegram bot. I want keyboard and inline keyboard, Can I enable both of the features at the same time ? 回答1: According to Telegram documentation, it's currently impossible to pass two or more objects for reply_markup at the same time. reply_markup only accepts one of these objects at the same time: InlineKeyboardMarkup ReplyKeyboardMarkup ReplyKeyboardRemove ForceReply And of course you cannot combine two or more objects together. If you wanna show keyboard and have