dement0r/tg-messenger

一个简单的Telegram消息发送组合包

dev-master 2022-11-23 09:18 UTC

This package is auto-updated.

Last update: 2024-09-23 13:31:48 UTC


README

一个简单的Telegram消息发送组合包

安装

使用composer

composer require dement0r/tg-messenger:dev-master

要求

  • PHP 7.4或更高版本
  • ext-curl
  • ext-json

使用

创建对象

$bot = new Messenger('BOT_TOKEN')

设置webhook

$bot->setWebhook('url' ?? null)

获取webhook信息

$bot->getWebhook()

移除webhook

$bot->removeWebhook()

从webhook URL获取消息

$bot->getMessage()

发送消息

$bot->sendMessage('chat_id', 'text', 'message_id', $markupArray)

标记示例

$markupArray = [
    'keyboard'          => [['Info', 'Test', 'Help']],
    'one_time_keyboard' => false,
    'resize_keyboard'   => true,
],