some changes to add a list
This commit is contained in:
parent
fc70cc988b
commit
54d3c24764
|
@ -125,3 +125,4 @@ dmypy.json
|
|||
.pyre/
|
||||
*.session
|
||||
spam/config.py
|
||||
*.session-journal
|
||||
|
|
|
@ -9,6 +9,7 @@ from spam.config import Config
|
|||
|
||||
StartTime = time.time()
|
||||
log = logging.getLogger()
|
||||
clients = []
|
||||
|
||||
ENABLE = Config.ENABLE
|
||||
|
||||
|
@ -26,40 +27,13 @@ if ENABLE:
|
|||
user1_api_id = Config.user1_api_id
|
||||
user1_api_hash = Config.user1_api_hash
|
||||
|
||||
# if Config.user2_api_id and Config.user2_api_hash:
|
||||
# user2_api_id = Config.user2_api_id
|
||||
# user2_api_hash = Config.user2_api_hash
|
||||
|
||||
# if Config.user3_api_id and Config.user3_api_hash:
|
||||
# user3_api_id = Config.user3_api_id
|
||||
# user3_api_hash = Config.user3_api_hash
|
||||
|
||||
# if Config.user4_api_id and Config.user4_api_hash:
|
||||
# user4_api_id = Config.user4_api_id
|
||||
# user4_api_hash = Config.user4_api_hash
|
||||
|
||||
# if Config.user5_api_id and Config.user5_api_hash:
|
||||
# user5_api_id = Config.user5_api_id
|
||||
# user5_api_hash = Config.user5_api_hash
|
||||
|
||||
# if Config.user6_api_id and Config.user6_api_hash:
|
||||
# user6_api_id = Config.user6_api_id
|
||||
# user6_api_hash = Config.user6_api_hash
|
||||
|
||||
# if Config.user7_api_id and Config.user7_api_hash:
|
||||
# user7_api_id = Config.user7_api_id
|
||||
# user7_api_hash = Config.user7_api_hash
|
||||
|
||||
# if Config.user8_api_id and Config.user3_api_hash:
|
||||
# user8_api_id = Config.user8_api_id
|
||||
# user8_api_hash = Config.user8_api_hash
|
||||
|
||||
Command = Config.Command
|
||||
else:
|
||||
print('Enable me first in config.py')
|
||||
|
||||
if user1_api_id and user1_api_hash:
|
||||
user1 = Client("user1", api_id=user1_api_id, api_hash=user1_api_hash)
|
||||
clients += [Client("spambot", api_id=user1_api_id, api_hash=user1_api_hash)]
|
||||
|
||||
|
||||
# if user2_api_id and user2_api_hash:
|
||||
# user2 = Client("user2", api_id=user2_api_id, api_hash=user2_api_hash)
|
||||
|
|
|
@ -4,8 +4,8 @@ import sys
|
|||
import time
|
||||
import traceback
|
||||
|
||||
from spam import user1
|
||||
# user2, user3, user4, user5, user6, user7, user8
|
||||
from spam import clients
|
||||
|
||||
from spam.modules import ALL_MODULES
|
||||
|
||||
BOT_RUNTIME = 0
|
||||
|
@ -18,27 +18,15 @@ async def get_runtime():
|
|||
return BOT_RUNTIME
|
||||
|
||||
async def reload_userbot():
|
||||
await user1.start()
|
||||
# await user2.start()
|
||||
# await user3.start()
|
||||
# await user4.start()
|
||||
# await user5.start()
|
||||
# await user6.start()
|
||||
# await user7.start()
|
||||
# await user8.start()
|
||||
await clients[0].start()
|
||||
|
||||
|
||||
for modul in ALL_MODULES:
|
||||
imported_module = importlib.import_module("spam.modules." + modul)
|
||||
importlib.reload(imported_module)
|
||||
|
||||
async def reinitial():
|
||||
await user1.start()
|
||||
# await user2.start()
|
||||
# await user3.start()
|
||||
# await user4.start()
|
||||
# await user5.start()
|
||||
# await user6.start()
|
||||
# await user7.start()
|
||||
# await user8.start()
|
||||
await clients[0].start()
|
||||
|
||||
|
||||
async def start_bot():
|
||||
|
@ -46,14 +34,6 @@ async def start_bot():
|
|||
print("----- Checking user and bot... -----")
|
||||
await reinitial()
|
||||
print("----------- Check done! ------------")
|
||||
# userbot
|
||||
# await user2.start()
|
||||
# await user3.start()
|
||||
# await user4.start()
|
||||
# await user5.start()
|
||||
# await user6.start()
|
||||
# await user7.start()
|
||||
# await user8.start()
|
||||
for modul in ALL_MODULES:
|
||||
imported_module = importlib.import_module("spam.modules." + modul)
|
||||
if hasattr(imported_module, "__MODULE__") and imported_module.__MODULE__:
|
||||
|
@ -69,7 +49,7 @@ async def start_bot():
|
|||
print("SpamProtection modules: " + str(ALL_MODULES))
|
||||
print("-----------------------")
|
||||
print("Bot run successfully!")
|
||||
await user1.idle()
|
||||
await clients[0].idle()
|
||||
|
||||
if __name__ == '__main__':
|
||||
BOT_RUNTIME = int(time.time())
|
||||
|
|
|
@ -5,7 +5,7 @@ from pyrogram import Filters, User
|
|||
from pyrogram.api import functions
|
||||
from pyrogram.errors import PeerIdInvalid
|
||||
|
||||
from spam import user1, Command
|
||||
# from spam import clients, Command
|
||||
|
||||
__MODULE__ = "Whois"
|
||||
__HELP__ = """
|
||||
|
@ -80,7 +80,7 @@ def ProfilePicUpdate(user_pic):
|
|||
return datetime.fromtimestamp(user_pic[0].date).strftime("%d.%m.%Y, %H:%M:%S")
|
||||
|
||||
|
||||
@user1.on_message(Filters.me & Filters.command(["whois"], Command))
|
||||
# @clients.on_message(Filters.me & Filters.command(["whois"], Command))
|
||||
async def whois(client, message):
|
||||
cmd = message.command
|
||||
if not message.reply_to_message and len(cmd) == 1:
|
||||
|
|
Loading…
Reference in New Issue