summaryrefslogtreecommitdiff
path: root/localwebsite/classes/TelegramBotClient.php
diff options
context:
space:
mode:
Diffstat (limited to 'localwebsite/classes/TelegramBotClient.php')
-rw-r--r--localwebsite/classes/TelegramBotClient.php37
1 files changed, 0 insertions, 37 deletions
diff --git a/localwebsite/classes/TelegramBotClient.php b/localwebsite/classes/TelegramBotClient.php
deleted file mode 100644
index b9583ee..0000000
--- a/localwebsite/classes/TelegramBotClient.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-class TelegramBotClient {
-
- protected string $token;
-
- public function __construct(string $token) {
- $this->token = $token;
- }
-
- public function sendMessage(int $chat_id, string $text): bool {
- $ch = curl_init();
- $url = 'https://api.telegram.org/bot'.$this->token.'/sendMessage';
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- curl_setopt($ch, CURLOPT_POSTFIELDS, [
- 'chat_id' => $chat_id,
- 'text' => $text,
- 'parse_mode' => 'html',
- 'disable_web_page_preview' => 1
- ]);
- $body = curl_exec($ch);
- curl_close($ch);
-
- $resp = jsonDecode($body);
- if (!$resp['ok']) {
- debugError(__METHOD__ . ': ' . $body);
- return false;
- }
-
- return true;
- }
-
-} \ No newline at end of file