dr-white87 / skype-bot-php
Skype Bot CLI 及库客户端
1.0.1
2018-05-25 11:53 UTC
Requires
- php: >=5.6
- guzzlehttp/guzzle: ^6.2
- mattketmo/camel: ~1.1
- padraic/phar-updater: ^1.0
- phpdocumentor/reflection-docblock: ~4.0
- rybakit/arguments-resolver: ~0.5.0
- symfony/console: ^2.8|^3
- symfony/filesystem: ^2.8|^3
- symfony/yaml: ^2.8|^3
This package is not auto-updated.
Last update: 2024-09-29 06:02:31 UTC
README
API 文档:https://developer.microsoft.com/en-us/skype/bots/docs
安装
有两种安装方式
- 作为 Composer 包安装
作为 Composer 包安装
$ composer require dr-white87/skype-bot-php --dev
用法
程序化
<?php use Skype\Client; $client = new Client([ 'clientId' => '<yourClientId>', 'clientSecret' => '<yourClientSecret>', ]); $api = $client->authorize()->api('conversation'); // Skype\Api\Conversation $api->activity('29:<skypeHash>', 'Your message');
命令行界面
以下是一些用法示例。
$ bin/skype auth <yourClientId>
$ bin/skype conversation:activity <to> <message>
或者使用 phar 文件。
php skype.phar auth <yourClientId>
php skype.phar conversation:activity <to> <message>
提示
-
如果用作库,当 access_token 在接下来的 10 分钟内将过期时,HTTP Guzzle 客户端将自动尝试使用 Guzzle 中间件重新认证。
-
如果用作 phar,您可以使用
skype.phar self-update
更新到最新版本。 -
如果用作库,您可以将令牌配置存储在自己的首选文件路径中,如下所示
$client = new Client([ 'clientId' => '<yourClientId>', 'clientSecret' => '<yourClientSecret>', 'fileTokenStoragePath' => '<yourOwnPath>', ]);
-
您也可以编写自己的
TokenStorageInterface::class
$client = new Client([ 'clientId' => '<yourClientId>', 'clientSecret' => '<yourClientSecret>', 'tokenStorageClass' => DatabaseTokenStorage::class ]);
更多文档即将推出。