我们可以格式化一个彩色短信和sendFormattedMessage吗?
使用JavaScript + Google与电报机器人进行交互。
function sendFormattedMessage( chat_id, text, parse_mode, disable_web_page_preview, disable_notification ) {
var encodedText = encodeURIComponent(text);
var response = UrlFetchApp.fetch(vUrlTelegram + "/sendMessage?chat_id=" + chat_id + "&text=" + encodedText + "&parse_mode=" + parse_mode );
// Logger.log(response.getContentText());
}
function telegramBotMachine( id, chat_id, text, name ) {
var sUpperText = text.toUpperCase();
if ( sUpperText.substr( 0, 4 ) === "MENU" ) {
sendFormattedMessage( chat_id, menu(), "HTML", "false", "false" );已经获得了电报Bot文档,无法找到HTML标签来颜色格式化文本?
附近有工作吗?
HTML样式
若要使用此模式,请在parse_mode字段中传递HTML。目前支持下列标记:
<b>bold</b>, <strong>bold</strong>
<i>italic</i>, <em>italic</em>
<u>underline</u>, <ins>underline</ins>
<s>strikethrough</s>, <strike>strikethrough</strike>, <del>strikethrough</del>
<b>bold <i>italic bold <s>italic bold strikethrough</s> <u>underline italic bold</u></i> bold</b>
<a href="http://www.example.com/">inline URL</a>
<a href="tg://user?id=123456789">inline mention of a user</a>
<code>inline fixed-width code</code>
<pre>pre-formatted fixed-width code block</pre>
<pre><code class="language-python">pre-formatted fixed-width code block written in the Python programming language</code></pre>发布于 2020-09-22 15:49:35
我不确定它是否仍然与您相关,但是他们有一个API方法来启用htmlMode。
例如,在java中将是:
message.enableHtml(true);您可以用html标记和css样式包装您的消息。
String message_text = "<b>" + update.getMessage().getFrom().getFirstName() + "</b>" + " Said what? \n" + update.getMessage().getText();https://stackoverflow.com/questions/60735800
复制相似问题