Upload 2 files
Browse files- Akeno/utils/__init__.py +60 -0
- Akeno/utils/__main__.py +66 -0
Akeno/utils/__init__.py
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import logging
|
3 |
+
import time
|
4 |
+
import pyrogram
|
5 |
+
import string
|
6 |
+
import random
|
7 |
+
from inspect import getfullargspec
|
8 |
+
from os import path
|
9 |
+
from random import choice
|
10 |
+
import aiohttp
|
11 |
+
import re
|
12 |
+
import os
|
13 |
+
|
14 |
+
from datetime import datetime as dt
|
15 |
+
from pyrogram import Client
|
16 |
+
from pyrogram.types import *
|
17 |
+
from pyrogram import filters
|
18 |
+
from pyrogram.raw.all import layer
|
19 |
+
from pyrogram.handlers import MessageHandler
|
20 |
+
from config import API_HASH, API_ID, SESSION
|
21 |
+
from pytgcalls import GroupCallFactory
|
22 |
+
from aiohttp import ClientSession
|
23 |
+
from Akeno.utils.logger import LOGS
|
24 |
+
from platform import python_version
|
25 |
+
from pyrogram import __version__ as pyrogram_version
|
26 |
+
|
27 |
+
logging.getLogger("pyrogram").setLevel(logging.WARNING)
|
28 |
+
logging.basicConfig(level=logging.INFO)
|
29 |
+
|
30 |
+
if not BOT_TOKEN:
|
31 |
+
print("Warning no bot token")
|
32 |
+
|
33 |
+
logger = logging.getLogger(__name__)
|
34 |
+
|
35 |
+
StartTime = time.time()
|
36 |
+
START_TIME = dt.now()
|
37 |
+
CMD_HELP = {}
|
38 |
+
clients = []
|
39 |
+
ids = []
|
40 |
+
act = []
|
41 |
+
db = {}
|
42 |
+
|
43 |
+
SUDOERS = filters.user()
|
44 |
+
|
45 |
+
aiohttpsession = ClientSession()
|
46 |
+
|
47 |
+
client = Client(
|
48 |
+
"one",
|
49 |
+
app_version="latest",
|
50 |
+
device_model="Akeno",
|
51 |
+
system_version="Linux",
|
52 |
+
api_id=API_ID,
|
53 |
+
api_hash=API_HASH,
|
54 |
+
session_string=SESSION,
|
55 |
+
plugins=dict(root="Akeno.plugins"),
|
56 |
+
)
|
57 |
+
if not hasattr(client, "group_call"):
|
58 |
+
setattr(client, "group_call", GroupCallFactory(client).get_group_call())
|
59 |
+
|
60 |
+
clients.append(client)
|
Akeno/utils/__main__.py
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
# Copyright 2020-2023 (c) Randy W @xtdevs, @xtsea
|
4 |
+
#
|
5 |
+
# from : https://github.com/TeamKillerX
|
6 |
+
# Channel : @RendyProjects
|
7 |
+
# This program is free software: you can redistribute it and/or modify
|
8 |
+
# it under the terms of the GNU Affero General Public License as published by
|
9 |
+
# the Free Software Foundation, either version 3 of the License, or
|
10 |
+
# (at your option) any later version.
|
11 |
+
|
12 |
+
# This program is distributed in the hope that it will be useful,
|
13 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
+
# GNU Affero General Public License for more details.
|
16 |
+
#
|
17 |
+
# You should have received a copy of the GNU Affero General Public License
|
18 |
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
19 |
+
|
20 |
+
import asyncio
|
21 |
+
import logging
|
22 |
+
import sys
|
23 |
+
import importlib
|
24 |
+
import aiohttp
|
25 |
+
from pyrogram import idle
|
26 |
+
|
27 |
+
from Akeno import clients
|
28 |
+
from Akeno.core.logger import LOGS
|
29 |
+
from pyrogram.errors import *
|
30 |
+
from contextlib import closing, suppress
|
31 |
+
from uvloop import install
|
32 |
+
|
33 |
+
logging.basicConfig(level=logging.INFO)
|
34 |
+
logging.getLogger("pyrogram.syncer").setLevel(logging.WARNING)
|
35 |
+
logging.getLogger("pyrogram.client").setLevel(logging.WARNING)
|
36 |
+
loop = asyncio.get_event_loop()
|
37 |
+
|
38 |
+
async def main():
|
39 |
+
try:
|
40 |
+
for cli in clients:
|
41 |
+
try:
|
42 |
+
await cli.start()
|
43 |
+
ex = await cli.get_me()
|
44 |
+
LOGS.info(f"Started {ex.first_name}")
|
45 |
+
await cli.send_message("me", "Starting Userbot")
|
46 |
+
except Exception as e:
|
47 |
+
LOGS.error(f"Error starting userbot: {e}")
|
48 |
+
await idle()
|
49 |
+
except Exception as e:
|
50 |
+
LOGS.error(f"Error in main: {e}")
|
51 |
+
finally:
|
52 |
+
await asyncio.gather(
|
53 |
+
aiohttpsession.close()
|
54 |
+
)
|
55 |
+
|
56 |
+
for task in asyncio.all_tasks():
|
57 |
+
task.cancel()
|
58 |
+
|
59 |
+
LOGS.info("All tasks completed successfully!")
|
60 |
+
|
61 |
+
if __name__ == "__main__":
|
62 |
+
install()
|
63 |
+
with closing(loop):
|
64 |
+
with suppress(asyncio.exceptions.CancelledError):
|
65 |
+
loop.run_until_complete(main())
|
66 |
+
loop.run_until_complete(asyncio.sleep(3.0))
|