I am trying to make this bot send a custom message like so
This is an embed and 'ALERT - BOUGHT' is bold but the rest of the text is normal. How can I achieve this?
I have been looking up how to do it all day.
I will be very grateful.
You can make a text in discord bold by surrounding it with double asterix: **
So that embed's description is: ":bell: **ALERT** - **BOUGHT** - HD AUG etc"
It's called markup and theres more fun to be had with it
I have been trying to send custom emojis with my bot, but instead of showing the emoji it just says "None". I tried other ways but none worked.. I am a beginner so sorry if it's a dumb mistake.
The code:
#client.command()
async def sendemoji(ctx):
emoji = client.get_emoji(802812170672275467)
await ctx.send(f'{emoji}')
Custom emotes are represented internally in the following format:
<:name:id>
Where the name is the name of the custom emote, and the ID is the id of the custom emote.
You can quickly obtain the <:name:id> format by putting a backslash in front of the custom emoji when you put it in your client.
Example: :python3: would give you the <:name:id> format.
Animated emojis are the same as above but have an a before the name- ie: <a:name:id>
Example:
await ctx.send('Python 3 emoji: <:python3:232720527448342530> !')
For example, if the emoji is called xyz,
you do '<:xyz:id>'
If xyz is an animated emoji,
you do '<a:xyz:id>'
Also, make sure that the bot is in the server where this emoji is from.
I hope this is helpful
I need send an image url to telegram without display image url and hidden url. I see a telegram bot and it's do it very well and send long message with image I'm attach this bot result image see it.
Now how can do it in my custom bot? It's possible hidden url with MARKDOWN style or any way? I want hidden image url in my text but telegram display my image. see my sample attach image.
thank you
Most of them use the dot (or some things like this character) for link description and you thought there is no link.
You can type the following line and select custom markdown:
#bold [.](http://www.planwallpaper.com/static/images/i-should-buy-a-boat.jpg)
If you want to add text to your link, you need to create a bot and use this approach in the bot.
Edit:
For sending hyperlink with the bot api you can simply send html markup and using parse_mode. See telegram documents:
To use this mode, pass HTML in the parse_mode field when using sendMessage. The following tags are currently supported:
<b>bold</b>, <strong>bold</strong>
<i>italic</i>, <em>italic</em>
inline URL
inline mention of a user
<code>inline fixed-width code</code>
<pre>pre-formatted fixed-width code block</pre>
sample:
According to the Telegram API, it seems if you set disable_web_page_preview to true, you should get the result you want.
The final message should look something like this:
{
chat_id: 1235,
message: "http://your/url",
disable_web_page_preview: true,
}
EDIT:
It seems I misunderstood the question, and you actually want the image to appear by itself rather than the url by itself.
Again, as per the Telegram API you can send an image directly. But as far as I can tell, you can't use a URL to do it. You would have to upload the photo from your telegram server directly. You could use the caption property to send text with it.
Here is an example of how you might be able do this in python. You will need to tweak this to whichever language you are using, but the concept is the same.
import requests
response = requests.post(
"https://your.bot.url.com/sendPhoto",
data={
"chat_id": 1234,
"caption": "Your extra text here"
}
files={
"photo": (
"image_name.jpg",
"contents of image",
"image/jpg",
{},
)
}
)
The caption property has a limit of 200 characters, so if you want to send more characters then that, you'll have to send two messages.
You can always ask Telegram to add this type of functionality in the future
The answer is zero-width non-joiner (ZWNJ) character. ZWNJ is encoded in Unicode as U+200C ZERO WIDTH NON-JOINER (HTML , ).
HTML mode:
MARKDOWN mode:
[](https://example.com)
Update 2021:
The answer is still working but telegram doesn't let you send an empty text message that include only this character anymore, so you have to add at least one character in the whole text message. In addition you can also use the character Unicode Character 'WORD JOINER' (U+2060) instead.
You can use character as hidden character.
This might help:
It works for both:
web links
telegram links
import requests
def telegram(channel,bot,text,img):
if(text==""):text="Refer - "
r = requests.get('https://api.telegram.org/bot'+bot+'/sendMessage?chat_id=#'+channel+'&parse_mode=markdown&text='+"[]("+img+")"+text)
Use the above function. It will work perfectly. In case, there is no text and only image, it should break. So it will show a "." (dot) in those cases.
Now use the function -
telegram(your_channel_name,your_token_here,description,image_url)
To correctly send an image hosted on a website without showing any reference link, you must use the "html" parsing mode.
And in the content to send, for example, something like this (Python mode):
# We take the html address of the image.
image_address = 'https://picsum.photos/100.jpg'
# The unicode character to prevent the words from
# being separated, in this case, we take advantage
# of it so that the Telegram API accepts it and
# incidentally so that it does not take up space
# when including text in the message.
word_joiner = '⁠'
# This would be the final pattern.
html_pattern = f'{word_joiner}'
With HTML parse mode. Keep empty space between the opening and closing tag.
I have a tumblr account that has submission enabled, and I have a short description with a form in the "description" area that appears on the sidebar. However, this description also appears on myblog.tumblr.com/submit. I'd like to remove it.
I looked at the documentation on http://www.tumblr.com/docs/en/custom_themes#navigation, but haven't been able to figure out how to prevent the sidebar description from showing at the top of the submit page.
Can anyone help?
I'm not sure if I understood your question correctly. But if I did, a work around would be using jQuery to check if the current url contains the string /submit and simply disable the sidebar, or the element that contains the description.
I don't know jQuery but I know it's possible. I'd suggest you to look into this post:
How to check if the URL contains a given string?
and combine it with this line (replace the "alert part")
$("#sidebardescription).hide();
Another solution would be if Tumblr provided you with a way to only render for specific pages. They usually do that. I'd look into this part {block:SubmissionsEnabled} {/block:SubmissionsEnabled} before I go with the workaround.
I have an ecommerce gift store where users can fill out a gift-card for their recipient.
In order to fill out the card, I have the users enter text into a multiline textbox.
When I display the gift-card on the final review page, I have to spit out the information with Html.Raw so that Newlines are being displayed properly. I'm doing this:
#(Model.GiftCard.Text != null ? Html.Raw(Model.GiftCard.Text.Replace(char.ConvertFromUtf32(13),"<br />")) : Html.Raw(""))
I'm frightened that i'm entering dangerous territory using Html.Raw on values that were user-entered. However, when I go back to the gift-card entry page, the page breaks when I try to do something like "This is my gift card! (scripttag)alert('test');(/scripttag)"... so I feel like .net will catch any malicious entries during that point.
Am I safe to proceed like this? It seems that since the gift-card entry page is running validations against malicious code, I should be okay to use HtmlRaw later to display newline html that I'm putting in myself...
(I replaced the actual script tag with this (scripttag) thing above so it will show in stackoverflow)
Use a regular expression in your view model to make sure people only enter A-Za-z0-9 and whatever else you think should use such as :) =] type of stuff. Screening this stuff front end is better than second guessing it on the way out.
How about using a
<pre></pre>
tag instead? This would allow returns to display in HTML without the need for Html.Raw?