forked from AnimeLord-Bots/FileStore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
113 lines (100 loc) · 4.71 KB
/
Copy pathbot.py
File metadata and controls
113 lines (100 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#
# Copyright (C) 2025 by AnimeLord-Bots@Github, < https://github.com/AnimeLord-Bots >.
#
# This file is part of < https://github.com/AnimeLord-Bots/FileStore > project,
# and is released under the MIT License.
# Please see < https://github.com/AnimeLord-Bots/FileStore/blob/master/LICENSE >
#
# All rights reserved.
from aiohttp import web
from plugins import web_server
import asyncio
import pyromod.listen
from pyrogram import Client
from pyrogram.enums import ParseMode
import sys
from datetime import datetime
#ᴀɴɪᴍᴇ ʟᴏʀᴅ
from config import *
from database.database import db # Updated import
name = """『A N I M E _ L O R D』"""
class Bot(Client):
def __init__(self):
super().__init__(
name="Bot",
api_hash=API_HASH,
api_id=APP_ID,
plugins={
"root": "plugins"
},
workers=TG_BOT_WORKERS,
bot_token=TG_BOT_TOKEN
)
self.LOGGER = LOGGER
async def start(self):
await super().start()
usr_bot_me = await self.get_me()
self.uptime = datetime.now()
# Load settings from database
global PROTECT_CONTENT, HIDE_CAPTION, DISABLE_CHANNEL_BUTTON, BUTTON_NAME, BUTTON_LINK
settings = await db.get_settings()
PROTECT_CONTENT = settings.get('PROTECT_CONTENT', False)
HIDE_CAPTION = settings.get('HIDE_CAPTION', False)
DISABLE_CHANNEL_BUTTON = settings.get('DISABLE_CHANNEL_BUTTON', True)
BUTTON_NAME = settings.get('BUTTON_NAME', None)
BUTTON_LINK = settings.get('BUTTON_LINK', None)
try:
db_channel = await self.get_chat(CHANNEL_ID)
self.db_channel = db_channel
test = await self.send_message(chat_id=db_channel.id, text="Test Message")
await test.delete()
except Exception as e:
self.LOGGER(__name__).warning(e)
self.LOGGER(__name__).warning(f"ᴍᴀᴋᴇ sᴜʀᴇ ʙᴏᴛ ɪs ᴀᴅᴍɪɴ ɪɴ ᴅʙ ᴄʜᴀɴɴᴇʟ, ᴀɴᴅ ᴅᴏᴜʙʟᴇ ᴄʜᴇᴄᴋ ᴛʜᴇ ᴄʜᴀɴɴᴇʟ_ɪᴅ ᴠᴀʟᴜᴇ, ᴄᴜʀʀᴇɴᴛ ᴠᴀʟᴜᴇ {CHANNEL_ID}")
self.LOGGER(__name__).info("\nʙᴏᴛ sᴛᴏᴘᴘᴇᴅ. ᴊᴏɪɴ https://t.me/+3lpawaYvxBU4YTY1 ғᴏʀ sᴜᴘᴘᴏʀᴛ")
sys.exit()
self.set_parse_mode(ParseMode.HTML)
self.LOGGER(__name__).info(f"ʙᴏᴛ ɪs ᴀʟɪᴠᴇ..!\n\nᴄʀᴇᴀᴛᴇᴅ ʙʏ \n 『ᴀɴɪᴍᴇ-ʟᴏʀᴅ-ʙᴏᴛ』")
self.LOGGER(__name__).info(f"ʙᴏᴛ ᴅᴇᴘʟᴏʏᴇᴅ ʙʏ @ᴡʜᴏ-ᴀᴍ-ɪ")
self.set_parse_mode(ParseMode.HTML)
self.username = usr_bot_me.username
self.LOGGER(__name__).info(f"ʙᴏᴛ ɪs ᴀʟɪᴠᴇ..! ᴍᴀᴅᴇ ʙʏ @ᴀɴɪᴍᴇ ʟᴏʀᴅ")
# sᴛᴀʀᴛ ᴡᴇʙ sᴇʀᴠᴇʀ
app = web.AppRunner(await web_server())
await app.setup()
await web.TCPSite(app, "0.0.0.0", PORT).start()
try:
await self.send_message(OWNER_ID, text=f"<b><blockquote>ʙᴏᴛ ʀᴇsᴛᴀʀᴛᴇᴅ ʙʏ @ᴀɴɪᴍᴇ_ʟᴏʀᴅ_ʙᴏᴛ\n\n<code>{name}</code></blockquote></b>")
except Exception as e:
self.LOGGER(__name__).warning(f"ғᴀɪʟᴇᴅ ᴛᴏ sᴇɴᴅ sᴛᴀʀᴛᴜᴘ ᴍᴇssᴀɢᴇ ᴛᴏ OWNER_ID: {str(e)}")
async def stop(self, *args):
await super().stop()
self.LOGGER(__name__).info("ʙᴏᴛ sᴛᴏᴘᴘᴇᴅ.")
def run(self):
"""Run the bot."""
loop = asyncio.get_event_loop()
loop.run_until_complete(self.start())
self.LOGGER(__name__).info(f"ʙᴏᴛ ɪs ɴᴏᴡ ᴀʟɪᴠᴇ. ᴛʜᴀɴᴋs ᴛᴏ @ᴡʜᴏ-ᴀᴍ-ɪ")
self.LOGGER(__name__).info(f"""
▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄
|------------------『A N I M E L O R D』----------------------|
▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀▄▀
◈◈◈◈◈◈ ɪ_s_ᴀ_ʟ_ɪ_ᴠ_ᴇ ◈◈◈◈◈◈
▼ ᴀᴄᴄᴇssɪɴɢ ▼
███████] 99%
""")
try:
loop.run_forever()
except KeyboardInterrupt:
self.LOGGER(__name__).info("ғᴜᴄᴋɪɴ ᴅᴏᴡɴ...")
finally:
loop.run_until_complete(self.stop())
#
# Copyright (C) 2025 by AnimeLord-Bots@Github, < https://github.com/AnimeLord-Bots >.
#
# This file is part of < https://github.com/AnimeLord-Bots/FileStore > project,
# and is released under the MIT License.
# Please see < https://github.com/AnimeLord-Bots/FileStore/blob/master/LICENSE >
#
# All rights reserved.
#