创建telegram机器人教程

telegram目前有两种api,

一种是bot api, bot api是基于http访问

第二种是基于mtproto访问,访问要加密,相对要复杂一些。 后者也可以实现传送讯息等功能

这里我只说第一种bot api

首先建立一个bot

tg内搜索botfather,开启与之聊天框,然后输入

/newbot

机器人会反馈

Alright, a new bot. How are we going to call it? Please choose a name for your bot.
 

然后输入你想建立的机器人昵称

回车后你就要输入你需要建立的机器人名字,例如

example_bot

机器人名称必须以_bot结尾

如果名称已被注册会提示Sorry, this username is already taken. Please try something different. [/c-alert]

成功后机器人会反馈类似如下信息

BotFather, [16.02.17 14:23]
Done! Congratulations on your new bot. You will find it at t.me/Gz_David_Bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when youve finished creating your cool bot, ping our
Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.

Use this token to access the HTTP API:
xxx:xxx

For a description of the Bot API, see this page: https://core.telegram.org/bots/api

上述信息里API:后边标红的信息就是你的token,我这里只是示例

输入/token 可以重新生成一个token,/revoke  可以撤销一个token

获取UserID

TG内搜索userinfobot

开启聊天后回复/start

机器人的ID就是你需要的ID号码

使用bot

TG内搜索你建立的机器人名称example_bot

开始对话

再需要推送信息的地方填入API以及ID号,在这个机器人就能收到推送了

技术杂烩

推荐一个好看的主页

2022-5-6 11:21:22

技术杂烩

wordpress评论回复的两种插件

2022-5-9 12:33:36

重要声明

本站资源大多来自网络,如有侵犯你的权益请联系管理员,我们会第一时间进行审核删除。站内资源为网友个人学习或测试研究使用,未经原版权作者许可,禁止用于任何商业途径!请在下载24小时内删除!


如果遇到付费才可观看的文章,建议升级会员或者成为认证用户。全站所有资源任意下免费看”。本站资源少部分采用7z压缩,为防止有人压缩软件不支持7z格式,7z解压,建议下载7-zip,zip、rar解压,建议下载WinRAR

2 条回复 A文章作者 M管理员
  1. […] 创建telegram机器人教程 […]

  2. 学习了。

个人中心
今日签到
有新私信 私信列表
搜索