22 lines
539 B
PHP
22 lines
539 B
PHP
<?php
|
|
class Mastodon extends Publisher {
|
|
protected $client;
|
|
|
|
public function __construct($config) {
|
|
super::__construct($config);
|
|
if ($config['MASTODON'] === true) {
|
|
$guzzle = new GuzzleClient([
|
|
'timeout' => 30,
|
|
]);
|
|
$this->client = new MastodonClient($guzzle);
|
|
$this->client->domain($config['MASTODON_SERVER'])->token($config['MASTODON_ACCESS_TOKEN']);
|
|
}
|
|
}
|
|
|
|
protected function _publish(string $text): void {
|
|
$this->client->createStatus($text, [
|
|
'language' => 'en'
|
|
]);
|
|
}
|
|
}
|