From ecef0cf994afa1adb54a0e32c6fb7b9cae44366a Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 29 Apr 2023 16:01:10 +0800 Subject: [PATCH] up --- .../startup/extend/client_change_username.py | 31 ------------- .../startup/extend/client_check_member.py | 44 +++++++++++++++++++ 2 files changed, 44 insertions(+), 31 deletions(-) delete mode 100644 plugins/tgclient/startup/extend/client_change_username.py create mode 100644 plugins/tgclient/startup/extend/client_check_member.py diff --git a/plugins/tgclient/startup/extend/client_change_username.py b/plugins/tgclient/startup/extend/client_change_username.py deleted file mode 100644 index e450b8abd..000000000 --- a/plugins/tgclient/startup/extend/client_change_username.py +++ /dev/null @@ -1,31 +0,0 @@ -import sys -import io -import os -import time -import re -import json -import base64 -import threading -import asyncio - -sys.path.append(os.getcwd() + "/class/core") -import mw - -import telebot -from telebot import types -from telebot.util import quick_markup - - -chat_id = -1001578009023 - - -async def run(client): - while True: - - await client.send_message(chat_id, 'Hello, group!') - print("123123" + str(time.time())) - await asyncio.sleep(1) - - -if __name__ == "__main__": - pass diff --git a/plugins/tgclient/startup/extend/client_check_member.py b/plugins/tgclient/startup/extend/client_check_member.py new file mode 100644 index 000000000..0f0dd519a --- /dev/null +++ b/plugins/tgclient/startup/extend/client_check_member.py @@ -0,0 +1,44 @@ +# coding:utf-8 + +# func: 自动检测已经注销群成员 + +import sys +import io +import os +import time +import re +import json +import base64 +import threading +import asyncio + +sys.path.append(os.getcwd() + "/class/core") +import mw + +import telebot +from telebot import types +from telebot.util import quick_markup + + +# 指定群ID +chat_id = -1001578009023 + +async def run(client): + while True: + s = await client.send_message(chat_id, '开始自动检测已经注销群成员...') + count = 0 + async for user in client.iter_participants(chat_id): + if user.deleted: + count += 1 + msg = await client.kick_participant(chat_id, user) + + await client.edit_message(chat_id, s.id, '已经检测到有(%d)个账户已失效' % (count)) + await asyncio.sleep(3) + await client.edit_message(chat_id, s.id, '自动检测已经注销群成员完毕!!!') + await asyncio.sleep(3) + await client.delete_messages(chat_id, s) + await asyncio.sleep(300) + + +if __name__ == "__main__": + pass