标签: telegram-bot

如何在Telegram中使用setWebhook和Windows 7和PHP上的自我证书?

我是电报中的新手,我正在尝试用它来完成我的第一步.

我在这里找到了一个很好的教程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地址(我使用互联网密钥将我连接到网络.....)?

非常感谢你提前

php ssl apache2.4 telegram telegram-bot

1
推荐指数
2
解决办法
1万
查看次数

如何通过帖子链接阅读电报频道帖子的内容?

当右键点击电报频道帖子并以这种形式发布时,它会有帖子链接:https: //telegram.me/channel_name/post_ID

问题是我们如何使用服务器上的机器人读取帖子的内容(文本,图像,视频,音频)?

channel hyperlink telegram telegram-bot

1
推荐指数
1
解决办法
2406
查看次数

Telegram Bot: Custom Keyboard [Python]

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 …

python python-telegram-bot telegram-bot

1
推荐指数
1
解决办法
7946
查看次数

如何在 Telepot 模块中获取传出消息 ID?

我正在使用 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 python-telegram-bot telegram-bot

1
推荐指数
1
解决办法
4052
查看次数

Python与电报机器人中的关键字“from”冲突

我想使用 python-telegram-bot 参考页面在 Python 脚本中打印用户信息

但是当我输入

print update.message.from

关键字.from被识别为内部保留关键字,我收到无效的语法错误。

我该如何解决?

谢谢。

python python-telegram-bot telegram-bot

1
推荐指数
1
解决办法
295
查看次数

Telegram Bot api删除用户消息

在私人聊天(用户和Bot)中,是否可以删除用户消息(或按下自定义键盘按钮后的文本命令)以保持聊天清洁和可读性?我正在寻找一种类似于内联键盘机制的解决方案(按钮的标签和要发送的命令).我测试了deletemessageasync,我能够删除Bot发送的消息,但无法删除用户消息.任何的想法?

c# telegram-bot

1
推荐指数
1
解决办法
2616
查看次数

使用 python-telegram-bot 删除群组消息

我正在通过使用制作电报机器人python-telegram-bot并将其添加到组中。

我想指定一个列表,如果列表中的句子发送到组中,则电报的机器人将从组中删除该消息。我应该使用哪些模块和代码来做到这一点?

请给我一个完整的描述。我是新来的

python python-telegram-bot telegram-bot

1
推荐指数
1
解决办法
1万
查看次数

如何删除回复键盘(Telegram Bot)

我只需要删除URL即可删除ReplyKeyboard。

我正在使用Python,但未使用Python BotLibrary。我会处理所有请求,因为我想要完全的灵活性。

python-2.7 telegram telegram-bot

1
推荐指数
1
解决办法
1997
查看次数

我如何使用电报机器人用 python 发送 mp3 文件

如何使用开源 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)

python python-requests telegram-bot

1
推荐指数
1
解决办法
6389
查看次数

在哪里可以找到 Telegram bot API TOKEN?

我最近注册了使用电报机器人 API,但是当我查看每个示例时,它说要包含我们自己的 API TOKEN,但没有提到如何获取令牌。

当我访问 Telegram 站点时,它向我显示的只是一些 api id、hash 和一个 RSA 密钥对。

如何生成电报 API令牌或如何以及从何处获取?

python telegram python-telegram-bot telegram-bot

1
推荐指数
1
解决办法
1万
查看次数