Skip to content

Commit 39ab318

Browse files
authored
Added database channel info in client
1 parent e7f1209 commit 39ab318

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

bot.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pyrogram import Client
33
import sys
44

5-
from config import API_HASH, APP_ID, LOGGER, TG_BOT_TOKEN, TG_BOT_WORKERS, FORCE_SUB_CHANNEL
5+
from config import API_HASH, APP_ID, LOGGER, TG_BOT_TOKEN, TG_BOT_WORKERS, FORCE_SUB_CHANNEL, CHANNEL_ID
66

77
class Bot(Client):
88
def __init__(self):
@@ -27,10 +27,18 @@ async def start(self):
2727
link = await self.export_chat_invite_link(FORCE_SUB_CHANNEL)
2828
self.invitelink = link
2929
except:
30-
self.LOGGER(__name__).warning("I can't Export Invite link from Force Sub Channel!")
31-
self.LOGGER(__name__).warning("Please Double check the FORCE_SUB_CHANNEL value and Make sure I am Admin in channel with Invite Users via Link Permission")
30+
self.LOGGER(__name__).warning("Bot can't Export Invite link from Force Sub Channel!")
31+
self.LOGGER(__name__).warning("Please Double check the FORCE_SUB_CHANNEL value and Make sure Bot is Admin in channel with Invite Users via Link Permission")
3232
self.LOGGER(__name__).info("\nBot Stopped. Join https://t.me/CodeXBotzSupport for support")
3333
sys.exit()
34+
try:
35+
db_channel = await self.get_chat(CHANNEL_ID)
36+
self.db_channel = db_channel
37+
except Exception as e:
38+
self.LOGGER(__name__).warning(e)
39+
self.LOGGER(__name__).warning("Make Sure bot is Admin in DB Channel, and Double check the CHANNEL_ID Value")
40+
self.LOGGER(__name__).info("\nBot Stopped. Join https://t.me/CodeXBotzSupport for support")
41+
sys.exit()
3442

3543
self.set_parse_mode("html")
3644
self.LOGGER(__name__).info(f"Bot Running..!\n\nCreated by 𝘾𝙤𝙙𝙚 𝕏 𝘽𝙤𝙩𝙯\nhttps://t.me/CodeXBotz")

0 commit comments

Comments
 (0)