mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
up
This commit is contained in:
@@ -70,22 +70,21 @@ async def send_msg(client, chat_id, tag='ad', trigger_time=300):
|
||||
|
||||
|
||||
async def run(client):
|
||||
while True:
|
||||
client.parse_mode = 'html'
|
||||
# for chat_id in chat_id_list:
|
||||
# await send_msg(client, chat_id)
|
||||
# await asyncio.sleep(30)
|
||||
client.parse_mode = 'html'
|
||||
# for chat_id in chat_id_list:
|
||||
# await send_msg(client, chat_id)
|
||||
# await asyncio.sleep(30)
|
||||
|
||||
info = await client.get_dialogs()
|
||||
for chat in info:
|
||||
await writeLog('name:{0} id:{1} is_user:{2} is_channel:{3} is_group:{4}'.format(
|
||||
chat.name, chat.id, chat.is_user, chat.is_channel, chat.is_group))
|
||||
if chat.is_group and not chat.id in filter_g_id:
|
||||
try:
|
||||
await send_msg(client, chat.id, 'ad_' + str(chat.id))
|
||||
await asyncio.sleep(3)
|
||||
except Exception as e:
|
||||
await writeLog(str(e))
|
||||
info = await client.get_dialogs()
|
||||
for chat in info:
|
||||
await writeLog('name:{0} id:{1} is_user:{2} is_channel:{3} is_group:{4}'.format(
|
||||
chat.name, chat.id, chat.is_user, chat.is_channel, chat.is_group))
|
||||
if chat.is_group and not chat.id in filter_g_id:
|
||||
try:
|
||||
await send_msg(client, chat.id, 'ad_' + str(chat.id))
|
||||
await asyncio.sleep(3)
|
||||
except Exception as e:
|
||||
await writeLog(str(e))
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
||||
@@ -24,21 +24,20 @@ from telebot.util import quick_markup
|
||||
chat_id_list = [-1001578009023, -1001979545570]
|
||||
|
||||
async def run(client):
|
||||
while True:
|
||||
for chat_id in chat_id_list:
|
||||
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)
|
||||
for chat_id in chat_id_list:
|
||||
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)
|
||||
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__":
|
||||
|
||||
@@ -26,31 +26,30 @@ filter_g_id = [-1001771526434]
|
||||
|
||||
|
||||
async def run(client):
|
||||
while True:
|
||||
info = await client.get_dialogs()
|
||||
for chat in info:
|
||||
is_sleep = True
|
||||
print('name:{0} id:{1} is_user:{2} is_channel:{3} is_group:{4}'.format(
|
||||
chat.name, chat.id, chat.is_user, chat.is_channel, chat.is_group))
|
||||
if chat.is_group and chat.id != chat_id:
|
||||
list_user = []
|
||||
async for user in client.iter_participants(chat.id):
|
||||
if chat.id in filter_g_id:
|
||||
is_sleep = False
|
||||
continue
|
||||
info = await client.get_dialogs()
|
||||
for chat in info:
|
||||
is_sleep = True
|
||||
print('name:{0} id:{1} is_user:{2} is_channel:{3} is_group:{4}'.format(
|
||||
chat.name, chat.id, chat.is_user, chat.is_channel, chat.is_group))
|
||||
if chat.is_group and chat.id != chat_id:
|
||||
list_user = []
|
||||
async for user in client.iter_participants(chat.id):
|
||||
if chat.id in filter_g_id:
|
||||
is_sleep = False
|
||||
continue
|
||||
|
||||
if filter_user_id != user.id and user.username != None and user.bot == False:
|
||||
list_user.append(user.username)
|
||||
print(list_user)
|
||||
try:
|
||||
await client(InviteToChannelRequest(
|
||||
channel=chat_id, # chat_id
|
||||
users=list_user, # 被邀请人id
|
||||
))
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
if is_sleep:
|
||||
await asyncio.sleep(90000)
|
||||
if filter_user_id != user.id and user.username != None and user.bot == False:
|
||||
list_user.append(user.username)
|
||||
print(list_user)
|
||||
try:
|
||||
await client(InviteToChannelRequest(
|
||||
channel=chat_id, # chat_id
|
||||
users=list_user, # 被邀请人id
|
||||
))
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
if is_sleep:
|
||||
await asyncio.sleep(90000)
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user