How to sendMessage link with # in telegram bot link - bots

Good day everyone.
I'm trying to send a link like this:
https://docs.google.com/spreadsheets/d/1wBFnSDkGjX1xdiP2ModkTpF_aLvEg1qWU7bQPpBD02Q/edit#gid=251685643&range=AF4 via bot. But it does not reach completely, it is cut off starting with "#".
It comes like this: https://docs.google.com/spreadsheets/d/1wBFnSDkGjX1xdiP2ModkTpF_aLvEg1qWU7bQPpBD02Q/edit
Please tell me how to send so that the link is not cut off?
The question boils down to making the bot not cut off the "#" and everything after. Escaping with "#" doesn't help.
If I understand correctly, everything after # is always ignored. https://core.telegram.org/api/links
The #fragment part is always ignored.
Hope there is a solution!

It was a good question
For this problem, the only way is to use hyperlink
step 1: specifying 'parse_mode' => 'HTML' in send_message()
step2: send your text with a tag :
text="<a href='https://docs.google.com/spreadsheets/d/1wBFnSDkGjX1xdiP2ModkTpF_aLvEg1qWU7bQPpBD02Q/edit#gid=251685643&range=AF4'>my GooGle Docs</a>"

Related

Enter for message telegram bot

Currently, I am developing telegram bot to send message to all member in group chat.
My difficulty right now I cannot make a message with enter.
I already tried adding \n however it wont worked.
this is what I want for example.
message:
Good morning,
Have good day.
when the message need to have enter it cannot send with enter. the result will be like this.
Good morning,/n/n Have good day.
does anyone know how telegram read enter which can be used in python code.
Ok, to send multiline messages, you can use the multiline strings like this:
bot.send_message('chat-id', """
Good morning,
Have good day.
""")
and enable the markup also, so that it dose not interfere the empty lines.

Any shorter way to post emojis in Discord.py?

When posting Discord emojis in the server, it seems to go much easier if I can somehow copy and paste the emoji directly into my code and then post them in my message:
await my_channel.send("Hey this is a đŸŸ© emoji")
As opposed to <:emoji_name:emoji_id> which is often much longer. I end up running into message-too-long errors when I do it this way because the emoji_id's in particular are looooooong. Is there a shorter way to post lots of custom emojis in a message like the direct copy-paste method without it eating up message space?
Unfortunately, custom emotes cannot be shortened.
However, Ɓukasz KwieciƄski's comment gives a hint.
If you want to use Discord's emotes you can easily transform them for your code. Use the following format:
\:EmoteName:
With the \ the emote will be converted directly to fit your code, you can now copy and paste it perfectly.
If you want a "simpler" way you can have a look at: https://unicode.org/emoji/charts/full-emoji-list.html

Discord JS - How to get image url from JSON?

Hello I am trying to isolate a image - src=\"https:\/\/steamcommunity-a.akamaihd.net\/economy\/image\/6TMcQ7eX6E0EZl2byXi7vaVKyDk_zQLX05x6eLCFM9neAckxGDf7qU2e2gu64OnAeQ7835Ff5GLNfCk4nReh8DEiv5dbPK47pbcyR_m4DQ68Ofs\/62fx62f\" from https://steamcommunity.com/market/listings/252490/Alien%20Red/render?currency=1&format=json and put it into a embed, I am using node fetch to get the overall json from the site how would I go about doing this? I currently have a inefficient way of doing it (getting every character) and it does not work at some points. Any help is appreciated.
There will probably be a better way to do this, but I've thrown this together:
/(?!src=\\?)\"(.*?)\"/g
Just match this with the return and you will have your URL.
If you are making this a static thing (ie. it will be ONLY this image, and will not be editable depending on a command or variable, then just put it as a string & make that the embed's image.
If not, then fetch the contents, then get the results_html portion of it. Then, find where it says "<img" and isolate it until the next ">". Sub string that bad boy from where is says src= to when it sees \" . (or " depending on how it interprets this), and use that sub string as the embed's image attachment.

Discord bot can't show emote "sometimes"

As a french Gwent player, I built a discord bot (using node.js and discord.js) to show the infos of a card when you name it. It uses some custom emotes to show some part of it.
It worked well for a few weeks, but recently some cards don't show the emotes when called.
I have no clue about what could be wrong. The emotes work if you use it yourself on the channel. Some cards show the emotes, others don't, even if they use the same emotes. And it's always all emotes or none for each card.
I checked different cards from my database : with or without emotes, I can't get any specific element which can explain why some cards can have emotes and why some cannot.
Is there something to know here that can explain this situation ?
Although this a late answer and you may have found an answer to the question but I'm going to post an answer anyways for others.
First in the chat you have to type:
\:custom_emote_here:
so in your case, you want it to show
and the name of it was :number5:, you would type :number5:.
You would get something like this:
(of course, it would say :number5: and the start and the numbers would be different)
You can copy and paste that into your code.
For example:
message.channel.send("<:super_magical:366208548914331659>")
would show this:
Hope this helps!
javascriptdiscorddiscord.jsemote
The developers of Discord have recently changed the way bots work with regards to custom emoji.
Before May 16th, bots could use any custom emoji from any server provided they are used inside rich embeds, as shown in your screenshot.
After that date, bots can use custom emoji from shared servers, but do not have to limit it to rich embeds only.
If you have the bot join all the servers that these custom emoji are being hosted on then it will be able to start using the emotes again.
I know that this question was asked quite a whiles ago but I thought I'd offer a solution I found after recently running into this issue myself for anyone else also facing this problem.
Normally, when you send an emoji in a message or embed via the <:name:id> format, Discord will convert it to a custom emoji. However, there are two cases where it represents all custom emojis in a message in the :name: format as shown in your example.
If one of the custom emojis you are trying to send are no longer active in the server (i.e. you have removed it from the server).
If you are trying to send an animated emoji via the <:name:id> format.
If either of the above two conditions are met, it seems like Discord defaults to converting all emojis in the message to :name: rather than the actual custom emoji.
I fixed it for myself by making sure that all of the emojis currently exist in the server emoji list before sending them. For animated emoji, you should send it via the <:a:name:id> format instead.

How to write text values in masked field?

i need some help related to masked field in web form. Syntax of phone field is (___)___-_____, if i execute this code in ruby shell
browser.text_field(:id => 'txtphone').set '7893457889'
... nothing has been added in the phone field.
then i find this solution in one blog, someone said first unmask this field using this code.
browser.text_field(:id,'txtphone').fire_event("unmask")
then write the above code again.
browser.text_field(:id => 'txtphone').set '7893457889'
but still nothing has happened. kindly help me out...am i doing right or still there is a mistake.
If you could provide some sample of the page HTML it will be easier to give you an answer more likely to work.
Given what you have provided us to work from, we have to go with the normal way that such masked input fields typically work and go from there. Usually pages with this kind of thing are calling a javascript function which is triggered by a specific event. Most often this is an event such as onchange but it may be something like keypress or any other even that happens when a normal user types or pasts text into the cell.
You likely need to experiment with using the '.fire_event' method to fire the proper javascript event, or if that fails entirely making a direct call to execute the proper script
When doing this do not confuse the name of a script such as 'applymask' or somesuch with the javascript event which causes that script to be invoked.
The answers to this question How to find out which JavaScript events fired? include some good information on how to use firebug or the chrome developer tools to figure out what events are being fired when you interact with an object on the browser screen.
Update: instead of responding here to indicate if this answer was of any use the OP reposted their question here Masked Text Box issue and by digging around on the vendor's demo site (since that time he actually had posted some of the HTML when we asked for it) I was able to find a solution using watir-webdriver that worked for him.

Resources