Skip to main content

Gummibeer/gummibeer.de

11 stars
2 code files
View Gummibeer/gummibeer.de on GitHub

app/Console/Commands/PromotePost.php

Open in GitHub
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use Spatie\Emoji\Emoji;
 
class PromotePost extends Command
{
public function handle(): int
{
//
$response = Http::post(
sprintf('https://api.telegram.org/bot%s/sendMessage', config('services.telegram.bot_token')),
[
'chat_id' => config('services.telegram.chat_id'),
'text' => Emoji::orangeBook().' '.$post->title.PHP_EOL.$post->url,
]
);
//
}
}

config/services.php

Open in GitHub
return [
'telegram' => [
'bot_token' => env('TELEGRAM_BOT_TOKEN'),
'chat_id' => '-1001286676640', // Http::get(sprintf('https://api.telegram.org/bot%s/getUpdates', $token))->json()['result'][0]['channel_post']['chat']['id']
],
];

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.