-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathmain.py
More file actions
53 lines (45 loc) · 2.1 KB
/
main.py
File metadata and controls
53 lines (45 loc) · 2.1 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
# Authored By Certified Coders — v1.2 (2025-11-14)
import logging
import time
from pyrogram import Client, idle
from pyrogram.errors import ApiIdInvalid, ApiIdPublishedFlood, AccessTokenInvalid
import config
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
)
logging.getLogger("pyrogram").setLevel(logging.ERROR)
logging.getLogger("pymongo").setLevel(logging.ERROR)
def main():
print("🔧 ꜱᴛᴀʀᴛɪɴɢ ᴊᴀʀᴠɪꜱ ꜱᴇꜱꜱɪᴏɴ ɢᴇɴ...")
if not all([config.API_ID, config.API_HASH, config.BOT_TOKEN]):
logging.critical("❌ ᴍɪꜱꜱɪɴɢ ᴀᴘɪ_ɪᴅ/ᴀᴘɪ_ʜᴀꜱʜ/ʙᴏᴛ_ᴛᴏᴋᴇɴ ɪɴ ᴄᴏɴꜰɪɢ.")
return
try:
with Client(
name="String-Bot",
api_id=config.API_ID,
api_hash=config.API_HASH,
bot_token=config.BOT_TOKEN,
in_memory=True,
plugins=dict(root="StringGen"),
) as app:
try:
uname = app.get_me().username
print(f"✅ ʙᴏᴛ @{uname} ɪꜱ ɴᴏᴡ ʀᴇᴀᴅʏ ᴛᴏ ɢᴇɴᴇʀᴀᴛᴇ ꜱᴇꜱꜱɪᴏɴꜱ.")
except Exception as e:
logging.error(f"❗ ꜰᴀɪʟᴇᴅ ᴛᴏ ɢᴇᴛ ʙᴏᴛ ɪɴꜰᴏ: {e}")
return
idle()
except ApiIdInvalid:
logging.critical("❌ ɪɴᴠᴀʟɪᴅ ᴀᴘɪ_ɪᴅ ᴏʀ ᴀᴘɪ_ʜᴀꜱʜ. ᴘʟᴇᴀꜱᴇ ᴄʜᴇᴄᴋ ʏᴏᴜʀ ᴄᴏɴꜰɪɢ.")
except ApiIdPublishedFlood:
logging.critical("🚫 ᴀᴘɪ_ɪᴅ/ʜᴀꜱʜ ᴄᴏᴍʙɪɴᴀᴛɪᴏɴ ɪꜱ ꜰʟᴏᴏᴅ-ʙᴀɴɴᴇᴅ.")
except AccessTokenInvalid:
logging.critical("🔐 ɪɴᴠᴀʟɪᴅ ʙᴏᴛ_ᴛᴏᴋᴇɴ. ᴘʟᴇᴀꜱᴇ ᴜᴘᴅᴀᴛᴇ ɪᴛ.")
except Exception as e:
logging.exception(f"❗ ᴜɴᴇxᴘᴇᴄᴛᴇᴅ ᴇʀʀᴏʀ ᴅᴜʀɪɴɢ ꜱᴛᴀʀᴛᴜᴘ: {e}")
finally:
print("🛑 ꜱᴇꜱꜱɪᴏɴ ɢᴇɴᴇʀᴀᴛɪᴏɴ ꜱᴛᴏᴘᴘᴇᴅ.")
if __name__ == "__main__":
main()