mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-01-22 10:38:14 -05:00
feat: allow admin/staff unbind a user
This commit is contained in:
parent
a60b23b17d
commit
e2262f1435
@ -12,11 +12,17 @@ class UnBind extends Telegram {
|
|||||||
|
|
||||||
public function handle($message, $match = []) {
|
public function handle($message, $match = []) {
|
||||||
if (!$message->is_private) return;
|
if (!$message->is_private) return;
|
||||||
$user = User::where('telegram_id', $message->chat_id)->first();
|
if (!isset($message->args[0])) {
|
||||||
$telegramService = $this->telegramService;
|
$user = User::where('telegram_id', $message->chat_id)->first();
|
||||||
if (!$user) {
|
} else {
|
||||||
$telegramService->sendMessage($message->chat_id, '没有查询到您的用户信息,请先绑定账号', 'markdown');
|
$chat = User::where('telegram_id', $message->chat_id)->first();
|
||||||
return;
|
if (!$chat) return;
|
||||||
|
if (!($chat->is_admin || $chat->is_staff)) return;
|
||||||
|
if (strpos($message->args[0], '@') !== true) {
|
||||||
|
$user = User::where('email', $message->args[0])->first();
|
||||||
|
} else {
|
||||||
|
$user = User::where('telegram_id', $message->args[0])->first();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$user->telegram_id = NULL;
|
$user->telegram_id = NULL;
|
||||||
if (!$user->save()) {
|
if (!$user->save()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user