What kind of event should trigger the functionality?
A user presses an InlineKeyboardButton within the bot itself
What kind of chat is the functionality supposed to work in?
The button is on a message that is from a bot to the user. (i.e inside chat with a bot. NOT in a group/channel)
How do you want your bot to react?
I wish to read the text of the message using text = str(update['callback_query']['message']['text'])
I then wish to edit that message using query.edit_message_text(text=text, reply_markup = keyboard)
What is the problem?
In step 1, that 'text' field is completely missing in the 'Update' dictionary.
As a result, the 'edit_message' in step 2 dont work and throw "Message to edit not found telegram"
The above behavior occurs for posts about 48hours from today. Meaning the inlinebutton works normally first, then after ____ period of time passed, the error described above is observed.
What is my hypothesis?
Telegram side deletes that information and dont allow me to call it after ____ period in time.
Related
At first i should emphasis that this is a question about telegram GROUP NOT CHANNEL.I need to get group id to send message via telgram api.
I have review this link .
using #rawDataBot needs to add bot to group, that is not possible most of the times. CuteGram does not login (does not send login code) .so i can say none of the proposed method works.
so is there a new method -except adding a bot to the group- to get telgram group ID ?
if the answer is no, i need to know if it is possible to send message to group by using group name?!
the easiest way is to add #chatBotRaw the bot will dump raw data, and you can copy their chat_id or anything else you need,
Remember to remove the bot afterwards because it dumps raw data of every message sent/received in the group.
the simplest way i found is
open web-telegram in a browser
right click on the group name on the left menu
click 'inspect' button
you will see the group id in the attribute data-peer-id="-xxxxxxxxxx" or peer="-xxxxxxxxxx"
You can get chat id throw object "chat"
You can set middleware which handle new update
Example on Node.JS: bot.on('text', ctx => console.log('Chat id is:', ctx.chat.id))
P.S. group id and chat id are same
if using a bot is acceptable, you can use #username_to_id_bot - no need to add it to a group, just send username or invite link and get the id
There is an answerCallbackQuery that allows you to create an alert reaction on user pressing InlineKeyboardButton. Is there any possibility to create simillar alert but with the input field to prompt user to enter some text and send it to bot?
Nope, you can't do that with answerCallbackQuery, at least for now.
Possible workarounds - send a new InlineKeyboard with desired options, or mutate an existing one using editMessageReplyMarkup.
i find new_chat_participant or left_chat_participant but that work only in group chat.
I've used the new_chat_members event to know weather a new user joined the bot or not. But seems that this event will not be emitted.
But using the message event I will get the below result:
{"message_id":4,"from":{"id":324299944,"is_bot":false,"first_name":"foo","last_name":"bar","language_code":"en"},"chat":{"id":324299944,"first_name":"foo","last_name":"bar","type":"private"},"date":1513786467,"text":"/start","entities":[{"offset":0,"length":6,"type":"bot_command"}]
i write bot with java script and in the google app script .
my oreginal problem is how to find out a user stop or left the bot
For some reason that I was not able to find in the docs telegram doesn't send updates when user leaves the private group. It only does it for public groups (ex supergroups). Another curious thing is that the update message contains "left_chat_participant" and "left_chat_member" objects with the exact same info, probably for some bc
unfortunately currently there is no way to found out the user block the bot. new_chat_participant or left_chat_participant presented in telegram bot API v3 for completely another purpose.
I'm looking to have the information submitted on a google form to be on the email notification that I receive. I have tried several things but I can't seem to get it to work. Any ideas?
Create a new form in Google Docs, if you haven’t done that yet, add the necessary fields to the form and save your changes. Now go back to Google Docs and open the spreadsheet corresponding to that particular form.
Choose Tools > Notification rules... and select the option that says Notify me when... A user submits a form. You can also set how frequently you would like to be notified – right away or with daily digest.
Reference: https://support.google.com/docs/answer/91588
To get the notification in your email, you can refer to the this Google add-on.
Also to enable the data or responses to appear in notification you have to enter a script in the form. which basically tries to extract the columns from the spreadsheet. Sample:
var p = SpreadsheetApp.getActiveSheet();
var column = p.getRange(1,1,1,s.getLastColumn()).getValues()[0];
I hope you build the script by yourself!
I'm in a situation in which i need to be able to create a topics using self created bot. My forum has a special category and user, which can create a topics in that category.
Technology i'm using to create that bot is ruby + mechanize gem but it's not important right now. That bot works in a following way:
Sign in as previously mentioned user:
visit - /ucp.php?mode=login
fill the sign-in form using user credentials
if, after submiting a form, there is a sign-out link somewhere on the page, threat this whole process as "successfull"
Create a topic
visit - /posting.php?mode=post&f=21
fill subject field with desired subject
fill message field with desired message
submit a form using Submit button
And now, while first point works just great, the second one behaves in a strange way. After submiting a form, there is no error message or anything like that, i'm just getting redirected to /viewforum.php?f=21 (log's says that it's 302 Moved Temporarily status) page and the topic is not there.
Can anyone tell me what such behaviour means? Is there any security mechanism i don't know about? Please also note that the new topic form has form_token and creation_time fields filled correctly while form is beeing submited.
Thanks in advance for any clues.
According to this thread: https://stackoverflow.com/a/11713867/552936, user is treated as a bot if he sends a form without any delay (and it end's up with a 302 redirect). I can't find any info on google what's the exact delay, carck3r says that it's 8 seconds but for me, it was 2 seconds.