V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Alex76
V2EX  ›  Telegram

大佬们,有对 TG 很熟吗, TG(telegram)最新群消息有自动通知接口吗,还是自己去定时去 pull 呢

  •  
  •   Alex76 · 2023-03-22 11:13:12 +08:00 · 971 次点击
    这是一个创建于 373 天前的主题,其中的信息可能已经有所发展或是发生改变。
    大佬们,有对 TG 很熟吗,TG(telegram)最新群消息有自动通知接口吗,还是自己去定时去 pull 消息呢,哪个实现好,并且稳定
    7 条回复    2023-03-22 19:40:19 +08:00
    ospider
        1
    ospider  
       2023-03-22 11:16:55 +08:00   ❤️ 1
    不要滥用爬虫这个词,“拉”(pull) 不更好么?
    Alex76
        2
    Alex76  
    OP
       2023-03-22 11:20:56 +08:00
    @ospider 感谢,改了
    xycool
        3
    xycool  
       2023-03-22 11:30:35 +08:00
    创建一个 bot ,把 bot 拉到群里面去就可以了。然后设置 bot 的 webhook 地址,就能收到群消息然后处理了,具体的可以看 bot 开发文档
    Alex76
        4
    Alex76  
    OP
       2023-03-22 11:48:30 +08:00
    @xycool 感谢,周末研究研究
    ongongethan
        5
    ongongethan  
       2023-03-22 13:13:21 +08:00
    使用 bot 的话, 有两种方法可以接受的消息:
    1. pull 方式,使用 getUpdates(),文档 https://core.telegram.org/bots/api#getupdates
    2. push 方式,使用 webhook ,文档 https://core.telegram.org/bots/api#setwebhook
    ongongethan
        6
    ongongethan  
       2023-03-22 13:15:39 +08:00
    @ongongethan 接受的消息 - > 接收到消息
    Alex76
        7
    Alex76  
    OP
       2023-03-22 19:40:19 +08:00
    @ongongethan 谢谢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2864 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 14:25 · PVG 22:25 · LAX 07:25 · JFK 10:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.