当前位置: 首页 > news >正文

苏州园区做网站有搜索引擎作弊的网站

苏州园区做网站,有搜索引擎作弊的网站,怎么查网站找谁做的,广东珠海网站建设接上一篇文章,我们在创建好telegram机器人后,开始开发小游戏或者mini App,那就避免不了登录功能。 公开链接 bot设置教程:https://lengmo714.top/6e79860b.html 参考教程参考教程,telegram已经给我们提供非常多的api,我们在获取用…

接上一篇文章,我们在创建好telegram机器人后,开始开发小游戏或者mini App,那就避免不了登录功能。

公开链接
bot设置教程:https://lengmo714.top/6e79860b.html
参考教程参考教程,telegram已经给我们提供非常多的api,我们在获取用户信息的时候只需要调用对应的api即可。

拉起登录

我这里主要是获取头像、id、名字和状态。
用到2个api,getChatMembergetUserProfilePhotos
用法分别如下:
获取头像:

  // 初始化头像URL为空字符串let photoUrl = '';try {// 获取头像const profilePhotos = await bot.api.getUserProfilePhotos(userId, { limit: 1 });if (profilePhotos.total_count > 0) {const fileId = profilePhotos.photos[0][0].file_id;const file = await bot.api.getFile(fileId);photoUrl = `https://api.telegram.org/file/bot${TOKEN}/${file.file_path}`;}} catch (error) {console.error("获取头像失败: ", error);}

获取登录id:

  let userInfo = '';let id = "";let name = "";try {const chatMember = await bot.api.getChatMember(ctx.chat.id, userId);id = chatMember.user.id;name = chatMember.user.first_name;userInfo = `信息:\nID: ${chatMember.user.id}\n名字: ${chatMember.user.first_name}\n用户名: ${chatMember.user.username}\n状态: ${chatMember.status}`;} catch (error) {console.error("获取信息失败: ", error);}if (photoUrl) {await ctx.reply(`头像链接: ${photoUrl}`);} else {await ctx.reply("未能获取头像。");}await ctx.reply(userInfo || "未能获取信息。");

完整代码

import { Bot, InlineKeyboard } from "https://deno.land/x/grammy@v1.25.0/mod.ts";const TOKEN = '';  // bot机器人的token
const bot = new Bot(TOKEN);// 处理 /start 命令
bot.command("start", async (ctx) => {const firstName = ctx.update.message.from.first_name;const userId = ctx.from.id;// 初始化头像URL为空字符串let photoUrl = '';try {// 获取头像信息const profilePhotos = await bot.api.getUserProfilePhotos(userId, { limit: 1 });if (profilePhotos.total_count > 0) {const fileId = profilePhotos.photos[0][0].file_id;const file = await bot.api.getFile(fileId);photoUrl = `https://api.telegram.org/file/bot${TOKEN}/${file.file_path}`;}} catch (error) {console.error("获取头像失败: ", error);}// 获取用户登录信息let userInfo = '';let id = "";let name = "";try {const chatMember = await bot.api.getChatMember(ctx.chat.id, userId);id = chatMember.user.id;name = chatMember.user.first_name;userInfo = `信息:\nID: ${chatMember.user.id}\n名字: ${chatMember.user.first_name}\n用户名: ${chatMember.user.username}\n状态: ${chatMember.status}`;} catch (error) {console.error("获取信息失败: ", error);}if (photoUrl) {await ctx.reply(`头像链接: ${photoUrl}`);} else {await ctx.reply("未能获取头像。");}await ctx.reply(userInfo || "未能获取信息。");
});// 启动机器人
bot.start();

运行代码看先现象

执行下面命令,运动代码

deno run --allow-net ts脚本.ts
http://www.yayakq.cn/news/156563/

相关文章:

  • 力杨网站建设硬件开发管理流程
  • 网站 建站模式wordpress订单邮件内容修改
  • 网站访问密码西安搬家公司收费价目表2021
  • 描述网站建设的具体流程专业上海网站建设公司哪家好
  • 广东网站建设968网站建设技术工具
  • 怎么建网站青州问枫莱芜官网
  • 代刷网站系统怎么做网站建设设计公司 知乎
  • 景区网站策划书万盛建设局官方网站
  • 贵州整站优化seo平台湛江网红打卡餐厅
  • 设计好网站建设一个网站报价
  • 荆门做网站的公司陕西网
  • 古镇小企业网站建设百度搜索关键词查询
  • 做译员的网站在网站建设中什么用于搭建页面结构
  • 有哪些中文域名网站功能性的网站设计制作
  • 南阳网站建设推广网站后台流程图
  • 邵阳汽车网站建设建一个网络商城的网站素材搜集预算是什么
  • 萧山网站优化短视频代运营
  • 网站整站开发视频教程移动互联网开发实训报告
  • 建设网站所采用的技术方案百度小程序怎么打开
  • 网站源码配置数据库在拿做文件的wordpress
  • 网站一般在哪建设小程序开发公司网站源码下载
  • 聊城手机网站昆山注册公司流程费用
  • wordpress嵌入flash镇江网站优化哪家好
  • wordpress 收费阅读廊坊短视频优化案例
  • 企业网站建站方案赤峰做网站的
  • 网站推广怎么样东莞网站排名推广
  • 天津网站建设公司最好网站新闻模板
  • 找人给公司做网站去哪找wordpress 4.1 搜索框
  • 设计的有趣的网站河北省住房和建设厅网站首页
  • 江门企业模板建站站长资讯