oreolek
/
news-script
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/src/Publisher/Mastodon.php

25 lines
597 B
PHP

<?php
namespace Oreolek\Publisher;
use \Oreolek\Publisher;
class Mastodon extends Publisher {
protected $client;
public function __construct($config) {
Publisher::__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'
]);
}
}