• 🌙 Community Spirit

    Ramadan Mubarak! To honor this month, Crax has paused NSFW categories. Wishing you peace and growth!

Mail:Access music bot py cc bin heroku hosting (1 Viewer)

Currently reading:
 Mail:Access music bot py cc bin heroku hosting (1 Viewer)

Mail Access, Email Access Combolist
Recently searched:

xayeko9838

Member
LV
0
Joined
Jul 8, 2023
Threads
1
Likes
0
Awards
1
Credits
220©
Cash
0$


Download:
[​
Python:
import logging
from os import environ, mkdir, path, sys

from dotenv import load_dotenv
from pyrogram import Client

load_dotenv("config.env")

# Log
logging.basicConfig(
    level=logging.DEBUG,
    format="%(asctime)s - %(message)s",
    handlers=[logging.FileHandler("bot.log"), logging.StreamHandler()],
)
logging.getLogger("pyrogram").setLevel(logging.WARNING)
LOGGER = logging.getLogger(__name__)

# Mandatory Variable
try:
    API_ID = int(environ["API_ID"])
    API_HASH = environ["API_HASH"]
    BOT_TOKEN = environ["BOT_TOKEN"]
    OWNER_ID = int(environ["OWNER_ID"])
except KeyError:
    LOGGER.debug("One or More ENV variable not found.")
    sys.exit(1)
# Optional Variable
SUDO_USERS = environ.get("SUDO_USERS", str(OWNER_ID)).split()
SUDO_USERS = [int(_x) for _x in SUDO_USERS]
if OWNER_ID not in SUDO_USERS:
    SUDO_USERS.append(OWNER_ID)
AUTH_CHATS = environ.get("AUTH_CHATS", "-1001576243355").split()
AUTH_CHATS = [int(_x) for _x in AUTH_CHATS]
LOG_GROUP = environ.get("LOG_GROUP", None)
if LOG_GROUP:
    LOG_GROUP = int(LOG_GROUP)


class Mbot(Client):
    def __init__(self):
        name = self.__class__.__name__.lower()
        super().__init__(
            ":memory:",
            plugins=dict(root=f"{name}/plugins"),
            workdir="./cache/",
            api_id=API_ID,
            api_hash=API_HASH,
            bot_token=BOT_TOKEN,
            sleep_threshold=30,
        )

    async def start(self):
        global BOT_INFO
        await super().start()
        BOT_INFO = await self.get_me()
        if not path.exists("/tmp/thumbnails/"):
            mkdir("/tmp/thumbnails/")
        for chat in AUTH_CHATS:
            await self.send_photo(
                chat,
                "https://i.ibb.co/mtGCrzm/youNeedMusic.jpg",
                "**Bot Started.**",
            )
        LOGGER.info(f"Bot Started As {BOT_INFO.username}\n")

    async def stop(self, *args):
        await super().stop()
        LOGGER.info("Bot Stopped, Bye.")
REPLY]


[Paste your content here. Remove this line and one below!]
[DO NOT PASTE THE CONTENT ABOVE OR BELOW THE REPLY QUOTES]


[/REPLY]​
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Tips
Recently searched:

Users who are viewing this thread

Top Bottom