Archived
1
0
Fork 0
This repository has been archived on 2020-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
news-script/Publisher/Mastodon.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'
]);
}
}