首次提交 Laravel 專案
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace App\Services;
|
||||
class TgApi{
|
||||
|
||||
public static function GetChatInfo($msg){
|
||||
$ApiUrl= "https://api.telegram.org/bot{$msg['token']}/getChat?chat_id={$msg['message_chat_id']}";
|
||||
|
||||
$ChatInfo=UserFun::CurlGet($ApiUrl);
|
||||
if($ChatInfo['ok'] && isset($ChatInfo['result']['id'])){
|
||||
$ApiUrl= "https://api.telegram.org/bot{$msg['token']}/getChatAdministrators?chat_id={$ChatInfo['result']['id']}";
|
||||
$AdminInfo=UserFun::CurlGet($ApiUrl);
|
||||
if ($AdminInfo['ok'] && isset($AdminInfo['result'])) {
|
||||
foreach ($AdminInfo['result'] as $admin) {
|
||||
if (isset($admin['status']) && $admin['status'] === 'creator') {
|
||||
// 找到群主,提取 user_id
|
||||
$ChatInfo['result']['creator'] = $admin['user']['id'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ChatInfo;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user