我是电报中的新手,我正在尝试用它来完成我的第一步.
我在这里找到了一个很好的教程https://www.youtube.com/watch?v=hJBYojK7DO4:我用PHP和SSL配置了我的Apache 2.4,一切正常,也是教程中的示例.
当我尝试放入浏览器时,麻烦正在使用setWebhook方法....
https://api.telegram.org/<my_bot_code>/setWebHook?url=https://localhost/Telegram/MyYouTubeTutorialBot/YouTubeTutorialBot.php
Run Code Online (Sandbox Code Playgroud)
反应是
{"ok":false,"error_code":400,"description":"Error: Bad webhook: Error: Ip is reserved"}
Run Code Online (Sandbox Code Playgroud)
请注意,我正在使用自生成的证书....
我在api Telegram文档中找到了(参考https://core.telegram.org/bots/faq#i-39m-having-problems-with-webhooks),
" .....要使用自签名证书,您需要使用setWebhook中的certificate参数上传您的公钥证书.请上传为InputFile,发送字符串将无效. "
我不明白如何上传我的公钥证书文件......任何地方的例子?
问题可能是因为我使用localhost和我的本地Apache 的默认IP地址127.0.0.1?我应该使用每次连接到网络时更改的当前更改我的IP地址(我使用互联网密钥将我连接到网络.....)?
非常感谢你提前
当右键点击电报频道帖子并以这种形式发布时,它会有帖子链接:https: //telegram.me/channel_name/post_ID
问题是我们如何使用服务器上的机器人读取帖子的内容(文本,图像,视频,音频)?
I've downloaded this open-source code from GitHub which is written in Python(that I'm pretty new to it), I wanted to make my bot to have a Custom-Keyboard instead of letting users say whatever they wanted. for instance if user start the chat with my bot, they will automatically send /start
and when this happens I want my bot to give them two to three options ['Option One'], [Option Two],
on keyboard, when they choose one of those options, I want …
我正在使用 Telepot 模块使用 python 创建电报机器人。我需要获取传出消息的消息 ID,以便能够检查用户是否会回复该消息。下面的一段代码阐明了我想要做什么:
import telepot
bot = telepot.Bot('Some Token')
def handle(msg):
chat_id = msg['chat']['id']
message_id = msg['message_id'] # I can get Id of incoming messages here
command = msg['text']
if command == '/command': # Message (incoming) 1 sent by user
bot.sendMessage(chat_id, 'Some message') # Message (outgoing) 2 sent by bot
elif ('''msg was in reply of message 2'''): # Message (incoming) 3 sent by user (MY PROBLEM IS HERE!!!)
# Do something
pass
bot.message_loop(handle, run_forever = 'Running …
Run Code Online (Sandbox Code Playgroud) 我想使用 python-telegram-bot 参考此页面在 Python 脚本中打印用户信息
但是当我输入
print update.message.from
关键字.from
被识别为内部保留关键字,我收到无效的语法错误。
我该如何解决?
谢谢。
在私人聊天(用户和Bot)中,是否可以删除用户消息(或按下自定义键盘按钮后的文本命令)以保持聊天清洁和可读性?我正在寻找一种类似于内联键盘机制的解决方案(按钮的标签和要发送的命令).我测试了deletemessageasync
,我能够删除Bot发送的消息,但无法删除用户消息.任何的想法?
我正在通过使用制作电报机器人python-telegram-bot
并将其添加到组中。
我想指定一个列表,如果列表中的句子发送到组中,则电报的机器人将从组中删除该消息。我应该使用哪些模块和代码来做到这一点?
请给我一个完整的描述。我是新来的
我只需要删除URL即可删除ReplyKeyboard。
我正在使用Python,但未使用Python BotLibrary。我会处理所有请求,因为我想要完全的灵活性。
如何使用开源 Python 库Requests将 MP3 音频文件发送到 Telegram Bot ?
我写了以下代码:
URL = 'api.telegram.org/bot'+TOKEN+'/sendAudio'
af = open("temp.mp3", 'rb')
params = {'chat_id' : 421087308, 'audio' : af}
req = requests.post(URL, params)
af.close()
Run Code Online (Sandbox Code Playgroud) 我最近注册了使用电报机器人 API,但是当我查看每个示例时,它说要包含我们自己的 API TOKEN,但没有提到如何获取令牌。
当我访问 Telegram 站点时,它向我显示的只是一些 api id、hash 和一个 RSA 密钥对。
如何生成电报 API令牌或如何以及从何处获取?
telegram-bot ×10
python ×6
telegram ×5
apache2.4 ×1
c# ×1
channel ×1
hyperlink ×1
php ×1
python-2.7 ×1
ssl ×1