mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
up
This commit is contained in:
@@ -22,26 +22,26 @@ from telethon.tl.functions.channels import InviteToChannelRequest
|
|||||||
# 指定群ID
|
# 指定群ID
|
||||||
chat_id = -1001979545570
|
chat_id = -1001979545570
|
||||||
filter_user_id = 5568699210
|
filter_user_id = 5568699210
|
||||||
|
filter_g_id = [-1001771526434]
|
||||||
|
|
||||||
|
|
||||||
async def run(client):
|
async def run(client):
|
||||||
while True:
|
while True:
|
||||||
info = await client.get_dialogs()
|
info = await client.get_dialogs()
|
||||||
for chat in info:
|
for chat in info:
|
||||||
print('name:{0} ids:{1} is_user:{2} is_channel:{3} is_group:{4}'.format(
|
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))
|
chat.name, chat.id, chat.is_user, chat.is_channel, chat.is_group))
|
||||||
if chat.is_group and chat.id != chat_id:
|
if chat.is_group and chat.id != chat_id:
|
||||||
list_user = []
|
list_user = []
|
||||||
async for user in client.iter_participants(chat.id):
|
async for user in client.iter_participants(chat.id):
|
||||||
# print(chat.id, user.id, user.first_name)
|
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:
|
if filter_user_id != user.id and user.username != None and user.bot == False:
|
||||||
# print(user.first_name)
|
|
||||||
list_user.append(user.username)
|
list_user.append(user.username)
|
||||||
# await client(AddChatUserRequest(
|
print(list_user)
|
||||||
# chat_id=chat_id, # chat_id
|
|
||||||
# user_id=user.username, # 被邀请人id
|
|
||||||
# fwd_limit=1000 # Allow the user to see the 10 last messages
|
|
||||||
# ))
|
|
||||||
# print(list_user)
|
|
||||||
try:
|
try:
|
||||||
await client(InviteToChannelRequest(
|
await client(InviteToChannelRequest(
|
||||||
channel=chat_id, # chat_id
|
channel=chat_id, # chat_id
|
||||||
@@ -49,9 +49,8 @@ async def run(client):
|
|||||||
))
|
))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(str(e))
|
print(str(e))
|
||||||
|
if is_sleep:
|
||||||
await asyncio.sleep(80000)
|
await asyncio.sleep(90000)
|
||||||
await asyncio.sleep(80000)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ import asyncio
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
# python /Users/midoks/Desktop/mwdev/server/tgclient/tgclient.py
|
# python /Users/midoks/Desktop/mwdev/server/tgclient/tgclient.py
|
||||||
# cd /www/server/mdserver-web && python3 /www/server/tgclient/tgclient.py
|
|
||||||
|
'''
|
||||||
|
cd /www/server/mdserver-web && source bin/activate && python3 /www/server/tgclient/tgclient.py
|
||||||
|
'''
|
||||||
|
|
||||||
from telethon import TelegramClient
|
from telethon import TelegramClient
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user