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.
Related
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>"
I want to be able to create a command that lets me get a response from a user which will then be saved as a variable, that'll be saved into another file for safekeeping.
(an example would be making a character sheet in direct messages, where you need to input multiple messages to get the desired outcome.)
I'm stuck and need help with finding a reliable way to make replies and to be able to stock the ones sent by the user. Thank you in advance.
I am not sure, but i think what you are looking for is wait_for
There are two examples in the discord.py docs, the first example covers wait_for message. It can be found on this url: https://discordpy.readthedocs.io/en/latest/api.html?highlight=wait_for#discord.Client.wait_for
Telegram bot sends me a message with a text snippet, which I want to edit, and send back to the bot for further processing.
Copy and paste takes time. Typing message anew takes time.
Ideally I'd like to press an inline button "Edit" on the bot's message and get the message text appear in my reply input box for editing.(A message id attached to my reply somehow would be a plus).
I tried to use deep linking with parameters other than /start*, but that doesn't seem to work.
Can I use bot API (or any other telegram API) to have text ready for editing in my input box?
It's impossible in official apps yet. Your question is about working with drafts - there are no methods in both API to create them or clear.
Nevertheless, you could fork any official app stored on GiHub and implement what you need if you would prefer a hard way, but compared to that copy/past solution seems much more easier, isn't it?
UPD
I can offer to you a new idea how to solve your problem - hope it will be helpful.
This is about switch_inline_query_current_chat field of InlineKeyboardButton. Just attach an inline button to messages you need to edit. Set a text for this field gotten from recieved message and after pressing you will get this text to your input area. All seems good, but you will take bot's username before the text also.
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.
Example: I send /weather to a bot and he asked me city. How to make him wait to reply?
ConversationHandler can be used to achieve the purpose. Python-telegram-bot conversationbot2.py example gives a good reference.
You can use the InlineKeyboardButton for that. It pops up a button for the user to press on. You can 'wait' for the user to input the data that way