Is it possible to find out a person location each time when user sends a message to bot. Or how can I find out the user's location? I would like to do this without sending the key position. Thanks
No you can't get user locations without their permission unless you use request_location in your keyboard, then it will show a message and asks user for the permission.
https://core.telegram.org/bots/api/#keyboardbutton
Related
I can’t figure out how to make two people communicate through the bot? That is, user1 >message> bot>message>user2 It turns out that the bot acts as an intermediary, passing messages from one user to another
I was thinking of making a database with a user ID, and if a person clicks on the "find a friend" button, the status of his ID = True And if 2 people with the True status, then they can communicate with each other, but there are no further thoughts at all .... Please help((
Remember, the Telegram bot will never be able to write to the user, if he himself did not activate this bot before.
So. Your idea can be implemented as follows. The user enters the bot and is offered a choice (two buttons). The first button is "connect with a random user", and the second is "connect by id".
The first option: you accept a message from that user and duplicate it to another (and vice versa).
The second option: if the user enters the correct id of another user, he receives a notification about a successful connection, and then everything is the same as in the first option. If the id is incorrect - an error message.
For navigation I would use InlineKeyboard (or alternatively ReplyKeyboard). It turns out that the bot will be an intermediary between users.
Disadvantages for users: you (an outsider) will be able to save all correspondence and view them. View complete information about the user's account.
Benefits for users: They will be completely anonymous to each other.
I could say more about this, but I don't quite understand the point of creating a bot for such things
do someone know if there is a way to open a URL when someone write /start or some command.
I already tried with requests, but it hasnt worked.
Thanks!
You can redirect users to other groups/chats by providing them with an invite link or the username of the group/channel in the #username format. If you want that to happen on the press of a button, you can use InlineKeyboardButton by passing the invite link directly to the button, i.e. InlineKeyboardButton(text='some_text', url='http://t.me/…'). The URL will open (i.e. redirect the user to the target chat), when the button is clicked.
I am making the inviting friend into the bot.
InlineKeyboardButton('👬 Invite Friend', switch_inline_query = 'https://t.me/xxxx?start=friend-' + str(user['id']))
After the click, the button and I choose the chat on my contacts.
But on a friend's chat, the bot's username is inserted. I want to send only the link.
I want to remove this.
or I want to make like this.
There is no way to remove the username of the bot from the message itself.
Altough many bots use a workaround where you are prompted with a username and a special identifier which allows the bot to prompt the InlineQuery mode and show up a button which can send any text you want
(I've found this simple bot that does this too, you can try it here)
Here's also an example found on the official python_telegram_bot repo
I'm developing a matchmaking bot for discord. I read through the documentation and looked through stack exchange, I can't find relevant information on this. I'm trying to eliminate clutter and make it easier for a users to accept and decline a matchmaking request. The bot would listen for a "!match #user" and handle the event. I only want the #user to see and accept it and the user that sent the message to see it (obviously). Right now, I believe it's not possible unless it assigns a secret role and deletes these roles after they are finished; this wouldn't be ideal though. Any information or forward to a post, that would help tremendously. Thanks in advance.
You can not currently hide messages for any specific user/role.
You can try 2 approaches:
Send Message in User DMs
Make a channel and set it permissions for a specific role and assign that role to the user
I am going to make a telegram bot in Python 3 which is a random chat bot. As I am new in telegram bots, I don't know how to join two different people in a chat bot. Is there a guide available for this?
If I understood the question, this isn't really about the code but the idea behind it, right?
My way would be:
Someone start the bot (ill call it 'current user' from now on), you get the userID of the new user and store it somewhere (a json file will do the trick)
The current user wanna talk with some other user so you pull off a random userID from the json file and you store it in some variables that are unique for the current user. You also do the same thing for the receiving user
Any new message from the current user will go through the bot and will be replied to the receving user
Quick tip: Use a python wrapper of the Telegram Bots Api, my suggestion would be python telegram bot. Its really good and offers some really neat features to help you (for example you can set user-specific data with pass_user_data). Feel free to check it out!
You need to make a database with chatID as primary column. and another column as partner. which stores his/her chat partner chatID.
now when a user sends a message to you bot you just need to check the database for that user and send the message to her chat partner.
after the chat is done you should empty partner fields of both users.
And for the picking part. when a user wants to find a new partner, choose a random row from your database WHERE partnerChatID is Null and set them to first users ID and vise versa.
I am not sure to understand your question, can you give us what you pretend to do more explained?
You have a few options, creating a group and adding the bot to it.
In private chat you only can talk with a single user at a time.