How to make user hyperlink in python telegram bot? - python

Stack overflow!
I'm using telebot module for my telegram bot (from telebot import types).
I want to send messages to telegram users.
In this messages I want to paste a link to another telegram users.
My code is:
linked_user = '[username](tg://user?id=999999999)'
bot.send_message(
admin_chat_id, f'{linked_user}',
parse_mode='MarkdownV2',
disable_web_page_preview=True)
I expect that admin will receive a message with username in it.
And if admin will click on the text, he will be redirected to the linked_user's profile...
The problem is:
It's not always a hyperlinked text. It can be a plain text...
With some user's chat.id's it works well, with other - don't!
I tried to make decisions from the fact, than not every telegram user have 9-digit chat.id - but it's not the reason too...
So I want to make hyperlink for EVERY user... don't know how to do that, so please help me!)

Some Users have specific privacy settings. So even though you can pm them, you cant "publish" their usernames so anyone else can Contact them. So you are not doing anything wrong.

Related

Sending requests to Midjourney from my website

I need to send requests from my website to Midjourney on Discord. The user will attach a photo and text with information about the image he wants to get. Then this information needs to be sent to midjourney in discord. After midjourney generates the image, it must be sent back to the website. How can I do this? I couldn't find a way to send the command /imagine to midjourney with python. Is this even possible?
Yes, it is, and by the way, this is a duplicate of my question I think...
anyway try this https://github.com/Wildric-Auric/MidJourney-Wrapper
It's a wrapper, it is a bot that can call the /imagine command, I'm currently having problems with it on my other questions in StackOverflow.
you can add functionality to it and make it send its commands automatically

print when a person posts on soundcloud

I'm trying to make it alert me (in console, I am later going to add a discord bot to it) whenever my friend posts to SoundCloud, I would preferably like to get the song link and information about it but I cant do that without getting the basics done.
I've looked through SoundCloud API documentation, and the closest to this is to list the songs.
I don't know where to start.
I'm not a developper but personnaly I would create a database with the actual song of a profile, then check if a new one appeared every x time.
Have you checked really easy solution like Zapier or IFTTT ? They may offer that kind of service. And they can directly make a webhook to a discord bot.

Getting Discord html with python?

I'm trying to get the html from https://discord.com/channels/#me the problem i'm running into is that there has to be some kind of login procedure that i can't figure out how to do with requests. the only information i have to login is the token(my friend doesn't trust me with his login info), so I can't just login with the user and pass, I've attempted to figure out if i can change local storage of the site so i can put in the token but to no avail, any ideas?
The token you want to use to log into discord might have a time validity. (that's the token security) for example, you can use it for 1 hour an not after.
The easiest way to log you on discord would be to use Selenium in order to automate tasks of your browser.

Python Telegram Bot open URL/join another Telegram Group after pressing telegram.KeyoardButton

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.

How to don't send the bot's username in python telegram bot switch_inline_query

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

Categories

Resources