-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
43 lines (38 loc) · 1.21 KB
/
main.py
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
# Copyright (C) 2024 by Badhacker98@Github, < https://github.com/Badhacker98 >.
#
# This file is part of < https://github.com/Badhacker98/StringBot > project,
# and is released under the license agreement specified in:
# < https://github.com/Badhacker98/StringBot/blob/main/LICENSE >
#
# All rights reserved.
import config
import time
import logging
from pyrogram import Client, idle
from pyromod import listen # type: ignore
from pyrogram.errors import ApiIdInvalid, ApiIdPublishedFlood, AccessTokenInvalid
logging.basicConfig(
level=logging.WARNING, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
StartTime = time.time()
app = Client(
"Anonymous",
api_id=config.API_ID,
api_hash=config.API_HASH,
bot_token=config.BOT_TOKEN,
in_memory=True,
plugins=dict(root="StringBot"),
)
if __name__ == "__main__":
print("StringBot...")
try:
app.start()
except (ApiIdInvalid, ApiIdPublishedFlood):
raise Exception("Your API_ID/API_HASH is not valid.")
except AccessTokenInvalid:
raise Exception("Your BOT_TOKEN is not valid.")
uname = app.get_me().username
print(f"@{uname} Started")
idle()
app.stop()
print("Stopping String Gen Bot. !")