如何提及没有用户名的电报用户? [英] How can I mention Telegram users without a username?

查看:406
本文介绍了如何提及没有用户名的电报用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提到的用户甚至是没有用户名的用户.

I want mention users even those which do not have a username.

如果用户设置了用户名,我将返回

If a user has set up a username I return

Hi @username 

作为答案,但是如果用户没有答案,我将无法做到.

as an answer but if a user does not have one I can't do that.

我尝试使用唯一的用户ID,例如

I tried using the unique User ID e.g.

@5642166

但是那没用.

我该如何实现?

推荐答案

根据官方文档,可以通过带有标记的数字ID来提及用户:

According to official documentation it is possible to mention user by its numerical id with markup:

降价样式

要使用此模式,请在parse_mode字段中传递Markdown 使用sendMessage时.在您的消息中使用以下语法:

To use this mode, pass Markdown in the parse_mode field when using sendMessage. Use the following syntax in your message:

[inline mention of a user](tg://user?id=123456789)

,您还可以使用HTML样式:

HTML样式

要使用此模式,请在使用sendMessage时在parse_mode字段中传递HTML.当前支持以下标签:

To use this mode, pass HTML in the parse_mode field when using sendMessage. The following tags are currently supported:

<a href="tg://user?id=123456789">inline mention of a user</a>

这篇关于如何提及没有用户名的电报用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆