-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbot.py
More file actions
33 lines (29 loc) · 1000 Bytes
/
bot.py
File metadata and controls
33 lines (29 loc) · 1000 Bytes
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
import env
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"
)
app = Client(
"bot",
api_id=env.API_ID,
api_hash=env.API_HASH,
bot_token=env.BOT_TOKEN,
in_memory=True,
plugins=dict(root="BgtStringBot"),
)
if __name__ == "__main__":
print("🌷sᴛᴀʀᴛɪɴɢ ᴛʜᴇ ʙᴏᴛ🌷")
try:
app.start()
except (ApiIdInvalid, ApiIdPublishedFlood):
raise Exception("ʏᴏᴜᴛ API_ID/API_HASH ɪɴ ɴᴏᴛ ᴠᴀʟɪᴅ❎.")
except AccessTokenInvalid:
raise Exception("ʏᴏᴜʀ BOT_TOKEN ɪs ɴᴏᴛ ᴠᴀʟɪᴅ🙂.")
uname = app.get_me().username
print(f"@{uname} ɪs ɴᴏᴡ ʀᴜɴɴɪɴɢ💥!")
idle()
app.stop()
print("ʙᴏᴛ sᴛᴏᴘᴘᴇᴅ. ʙʏᴇ 🙂!")