We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
try { // Bot API key and username $bot_api_key = 'xxx'; $bot_username = 'xxx'; // Create Telegram API object $telegram = new Telegram($bot_api_key, $bot_username); // 设置 MySQL $mysql_credentials = [ 'host' => env('database.hostname'), 'port' => 3306, // optional 'user' => env('database.username'), 'password' => env('database.password'), 'database' => env('database.database'), ]; // Enable MySQL // $telegram->enableMySql($mysql_credentials, 'kf_' . $bot_username . '_'); // echo "MySQL 是否启用: " . ($telegram->isDbEnabled() ? "是" : "否"); // 发送消息 $result = Request::sendMessage([ 'chat_id' => 'xxxx', 'text' => 'Your utf8 text 😜 ...', ]); $telegram->enableAdmin('6264203299'); // 检查消息发送结果 if ($result->isOk()) { Log::write('Message sent successfully: ' . $result->getDescription()); } else { Log::write('Failed to send message: ' . $result->getDescription()); } // 处理 Telegram webhook 请求 $telegram->handleGetUpdates(); } catch (Longman\TelegramBot\Exception\TelegramException $e) { // 记录 Telegram 错误 Log::write('TelegramException错误:'.$e->getMessage()); echo 'Error: ' . $e->getMessage(); } catch (Exception $e) { // 记录其他错误 Log::write('其他错误:'.$e->getMessage()); echo 'Error: ' . $e->getMessage(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: