mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
up
This commit is contained in:
@@ -21,7 +21,7 @@ from telebot.util import quick_markup
|
||||
|
||||
|
||||
# 指定群ID
|
||||
chat_id_list = [-1001578009023, -953760154]
|
||||
chat_id_list = [-1001578009023, -1001979545570]
|
||||
|
||||
async def run(client):
|
||||
while True:
|
||||
|
||||
@@ -16,18 +16,42 @@ sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
|
||||
from telethon import utils
|
||||
|
||||
|
||||
from telethon import functions, types
|
||||
from telethon.tl.functions.messages import AddChatUserRequest
|
||||
from telethon.tl.functions.channels import InviteToChannelRequest
|
||||
# 指定群ID
|
||||
chat_id = -953760154
|
||||
chat_id = -1001979545570
|
||||
filter_user_id = 5568699210
|
||||
|
||||
async def run(client):
|
||||
info = await client.get_dialogs()
|
||||
for chat in info:
|
||||
if chat.is_group:
|
||||
print('name:{0} ids:{1} is_user:{2} is_channel{3} is_group:{4}'.format(
|
||||
while True:
|
||||
info = await client.get_dialogs()
|
||||
for chat in info:
|
||||
print('name:{0} ids:{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):
|
||||
# print(chat.id, user.id, user.first_name)
|
||||
if filter_user_id != user.id and user.username != None and user.bot == False:
|
||||
# print(user.first_name)
|
||||
list_user.append(user.username)
|
||||
# await client(AddChatUserRequest(
|
||||
# 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:
|
||||
await client(InviteToChannelRequest(
|
||||
channel=chat_id, # chat_id
|
||||
users=list_user, # 被邀请人id
|
||||
))
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
|
||||
await asyncio.sleep(80000)
|
||||
await asyncio.sleep(80000)
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user