Skip to content

Commit

Permalink
Update bot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sahildesai07 authored Aug 31, 2024
1 parent 4c0ad31 commit 254f072
Showing 1 changed file with 11 additions and 63 deletions.
74 changes: 11 additions & 63 deletions bot.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
# https://t.me/Ultroid_Official/524


from aiohttp import web
from plugins import web_server

import pyromod.listen
from pyrogram import Client
from pyrogram.enums import ParseMode
import sys
from datetime import datetime
from config import API_HASH, APP_ID, LOGGER, TG_BOT_TOKEN, TG_BOT_WORKERS, FORCE_SUB_CHANNEL, FORCE_SUB_CHANNEL2, FORCE_SUB_CHANNEL3, FORCE_SUB_CHANNEL4, CHANNEL_ID, PORT

from config import API_HASH, APP_ID, LOGGER, TG_BOT_TOKEN, TG_BOT_WORKERS, FORCE_SUB_CHANNEL, CHANNEL_ID, PORT
import pyrogram.utils

pyrogram.utils.MIN_CHAT_ID = -999999999999
pyrogram.utils.MIN_CHANNEL_ID = -100999999999999

name ="""By @ultroid_official From Telegram"""


class Bot(Client):
def __init__(self):
super().__init__(
Expand Down Expand Up @@ -47,68 +44,26 @@ async def start(self):
self.LOGGER(__name__).warning(a)
self.LOGGER(__name__).warning("Bot can't Export Invite link from Force Sub Channel!")
self.LOGGER(__name__).warning(f"Please Double check the FORCE_SUB_CHANNEL value and Make sure Bot is Admin in channel with Invite Users via Link Permission, Current Force Sub Channel Value: {FORCE_SUB_CHANNEL}")
self.LOGGER(__name__).info("\nBot Stopped. https://t.me/ultroid_official for support")
sys.exit()
if FORCE_SUB_CHANNEL2:
try:
link = (await self.get_chat(FORCE_SUB_CHANNEL2)).invite_link
if not link:
await self.export_chat_invite_link(FORCE_SUB_CHANNEL2)
link = (await self.get_chat(FORCE_SUB_CHANNEL2)).invite_link
self.invitelink2 = link
except Exception as a:
self.LOGGER(__name__).warning(a)
self.LOGGER(__name__).warning("Bot can't Export Invite link from Force Sub Channel!")
self.LOGGER(__name__).warning(f"Please Double check the FORCE_SUB_CHANNEL2 value and Make sure Bot is Admin in channel with Invite Users via Link Permission, Current Force Sub Channel Value: {FORCE_SUB_CHANNEL2}")
self.LOGGER(__name__).info("\nBot Stopped. https://t.me/ultroid_official for support")
self.LOGGER(__name__).info("\nBot Stopped. Join https://t.me/ultroid_official for support")
sys.exit()

if FORCE_SUB_CHANNEL3:
try:
link = (await self.get_chat(FORCE_SUB_CHANNEL3)).invite_link
if not link:
await self.export_chat_invite_link(FORCE_SUB_CHANNEL3)
link = (await self.get_chat(FORCE_SUB_CHANNEL3)).invite_link
self.invitelink3 = link
except Exception as a:
self.LOGGER(__name__).warning(a)
self.LOGGER(__name__).warning("Bot can't Export Invite link from Force Sub Channel!")
self.LOGGER(__name__).warning(f"Please Double check the FORCE_SUB_CHANNEL3 value and Make sure Bot is Admin in channel with Invite Users via Link Permission, Current Force Sub Channel Value: {FORCE_SUB_CHANNEL3}")
self.LOGGER(__name__).info("\nBot Stopped. https://t.me/ultroid_official for support")
sys.exit()

if FORCE_SUB_CHANNEL4:
try:
link = (await self.get_chat(FORCE_SUB_CHANNEL4)).invite_link
if not link:
await self.export_chat_invite_link(FORCE_SUB_CHANNEL4)
link = (await self.get_chat(FORCE_SUB_CHANNEL4)).invite_link
self.invitelink4 = link
except Exception as a:
self.LOGGER(__name__).warning(a)
self.LOGGER(__name__).warning("Bot can't Export Invite link from Force Sub Channel!")
self.LOGGER(__name__).warning(f"Please Double check the FORCE_SUB_CHANNEL4 value and Make sure Bot is Admin in channel with Invite Users via Link Permission, Current Force Sub Channel Value: {FORCE_SUB_CHANNEL4}")
self.LOGGER(__name__).info("\nBot Stopped. https://t.me/ultroid_official for support")
sys.exit()

try:
db_channel = await self.get_chat(CHANNEL_ID)
self.db_channel = db_channel
test = await self.send_message(chat_id = db_channel.id, text = "Test Message")
test = await self.send_message(chat_id=db_channel.id, text="Test Message")
await test.delete()
except Exception as e:
self.LOGGER(__name__).warning(e)
self.LOGGER(__name__).warning(f"Make Sure bot is Admin in DB Channel, and Double check the CHANNEL_ID Value, Current Value {CHANNEL_ID}")
self.LOGGER(__name__).warning(f"Error occurred: {e}")
self.LOGGER(__name__).warning(f"CHANNEL_ID: {CHANNEL_ID}, DB Channel ID: {db_channel.id if 'db_channel' in locals() else 'N/A'}")
self.LOGGER(__name__).warning(f"Make sure bot is Admin in DB Channel, and Double-check the CHANNEL_ID value.")
self.LOGGER(__name__).info("\nBot Stopped. Join https://t.me/ultroid_official for support")
sys.exit()

self.set_parse_mode(ParseMode.HTML)
self.LOGGER(__name__).info(f"Bot Running..!\n\nCreated by \nhttps://t.me/ultroid_official")
self.LOGGER(__name__).info(f""" \n\n
bot running...!
self.LOGGER(__name__).info(f""" \n\n
(っ◔◡◔)っ ♥ ULTROIDOFFICIAL ♥
░╚════╝░░╚════╝░╚═════╝░╚══════╝
""")
""")
self.username = usr_bot_me.username
#web-response
app = web.AppRunner(await web_server())
Expand All @@ -118,11 +73,4 @@ async def start(self):

async def stop(self, *args):
await super().stop()
self.LOGGER(__name__).info("Bot stopped , https://t.me/ultroid_official.")






# https://t.me/Ultroid_Official/524
self.LOGGER(__name__).info("Bot stopped.")

0 comments on commit 254f072

Please sign in to comment.