コード例 #1
0
<?php

declare (strict_types=1);
use VkCallback\CallbackServer;
use VkCallback\Client;
require __DIR__ . '/../vendor/autoload.php';
$server = new CallbackServer();
$client = new Client('your token');
$server->confirm('your confirm callback token');
$server->on('wall_reply_new', function (array $data) use($client) {
    yield from $client->call('wall.deleteComment', ['owner_id' => -$data['group_id'], 'comment_id' => $data['object']['id']]);
});
$server->run(7070);
コード例 #2
0
ファイル: echo_bot.php プロジェクト: ezaki113/vk-callback
<?php

declare (strict_types=1);
use VkCallback\CallbackServer;
use VkCallback\Client;
require __DIR__ . '/../vendor/autoload.php';
$server = new CallbackServer();
$client = new Client('your group token');
$server->confirm('your confirm callback token');
$server->on('message_new', function (array $data) use($client) {
    yield from $client->call('messages.send', ['user_id' => $data['object']['user_id'], 'message' => $data['object']['body']]);
});
$server->run(7070);