forked from ShivangKakkar/RenameTelegramBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rename.py
34 lines (29 loc) · 905 Bytes
/
rename.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
import logging
from pyrogram import Client, idle
import Config
from pyrogram.errors import ApiIdInvalid, ApiIdPublishedFlood, AccessTokenInvalid
from pyromod import listen
logging.basicConfig(
level=logging.WARNING, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
logging.getLogger("pyrogram").setLevel(logging.WARNING)
app = Client(
"Rename-Bot",
api_id=Config.API_ID,
api_hash=Config.API_HASH,
bot_token=Config.BOT_TOKEN,
plugins=dict(root="RenameBot"),
)
# Run Bot
if __name__ == "__main__":
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 Successfully!")
idle()
app.stop()
print("Bot stopped. Alvida!")