-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
looks good remove extra client
- Loading branch information
Showing
14 changed files
with
94 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,48 @@ | ||
import asyncio | ||
import importlib | ||
import logging | ||
import re | ||
import sys | ||
import logging | ||
import time | ||
from Abg import patch | ||
|
||
from motor.motor_asyncio import AsyncIOMotorClient as MongoCli | ||
from pyrogram import Client | ||
from pyrogram.enums import ParseMode | ||
|
||
import config | ||
from Mickey.modules import all_modules | ||
|
||
logging.basicConfig( | ||
format="[%(asctime)s - %(levelname)s] - %(name)s - %(message)s", | ||
datefmt="%d-%b-%y %H:%M:%S", | ||
handlers=[logging.FileHandler("log.txt"), logging.StreamHandler()], | ||
level=logging.INFO, | ||
) | ||
|
||
logging.getLogger("pyrogram").setLevel(logging.ERROR) | ||
LOGGER = logging.getLogger(__name__) | ||
|
||
boot = time.time() | ||
mongo = MongoCli(config.MONGO_URL) | ||
db = mongo.Anonymous | ||
|
||
|
||
OWNER = config.OWNER_ID | ||
# DEVS = config.SUDO_USERS | config.OWNER_ID | ||
|
||
|
||
class MickeyBot(Client): | ||
def __init__(self): | ||
super().__init__( | ||
name="MickeyBot", | ||
api_id=config.API_ID, | ||
api_hash=config.API_HASH, | ||
lang_code="en", | ||
bot_token=config.BOT_TOKEN, | ||
plugins=dict(root="Mickey.modules"), | ||
in_memory=True, | ||
parse_mode=ParseMode.DEFAULT, | ||
) | ||
|
||
async def start(self): | ||
await super().start() | ||
get_me = await self.get_me() | ||
self.id = get_me.id | ||
self.name = get_me.mention | ||
self.username = get_me.username | ||
self.id = self.me.id | ||
self.name = self.me.first_name + " " + (self.me.last_name or "") | ||
self.username = self.me.username | ||
self.mention = self.me.mention | ||
|
||
async def stop(self): | ||
await super().stop() | ||
|
||
|
||
dev = Client( | ||
"Dev", | ||
bot_token=config.BOT_TOKEN, | ||
api_id=config.API_ID, | ||
api_hash=config.API_HASH, | ||
# plugins=dict(root="Mickey.modules"), | ||
) | ||
|
||
dev.start() | ||
|
||
BOT_ID = config.BOT_TOKEN.split(":")[0] | ||
x = dev.get_me() | ||
BOT_NAME = x.first_name + (x.last_name or "") | ||
BOT_USERNAME = x.username | ||
BOT_MENTION = x.mention | ||
BOT_DC_ID = x.dc_id | ||
MickeyBot = MickeyBot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,26 @@ | ||
import asyncio | ||
import importlib | ||
|
||
from pyrogram import idle | ||
|
||
from Mickey import LOGGER, MickeyBot | ||
from Mickey.modules import ALL_MODULES | ||
|
||
|
||
async def anony_boot(): | ||
try: | ||
await MickeyBot.start() | ||
except Exception as ex: | ||
LOGGER.error(ex) | ||
quit(1) | ||
|
||
for all_module in ALL_MODULES: | ||
importlib.import_module("Mickey.modules." + all_module) | ||
|
||
LOGGER.info(f"@{MickeyBot.username} Started.") | ||
await idle() | ||
|
||
|
||
if __name__ == "__main__": | ||
LOGGER.info("The MickeyBot Started.") | ||
MickeyBot().run() | ||
asyncio.get_event_loop().run_until_complete(anony_boot()) | ||
LOGGER.info("Stopping Mickey Bot...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
from config import OWNER_USERNAME, SUPPORT_GRP | ||
from Mickey import BOT_NAME, BOT_USERNAME | ||
from Mickey import MickeyBot | ||
|
||
START = f""" | ||
**๏ ʜᴇʏ, ɪ ᴀᴍ [{BOT_NAME}](t.me/{BOT_USERNAME})** | ||
**๏ ʜᴇʏ, ɪ ᴀᴍ [{MickeyBot.name}](t.me/{MickeyBot.username})** | ||
**➻ ᴀɴ ᴀɪ ʙᴀsᴇᴅ ᴄʜᴀᴛʙᴏᴛ** | ||
**──────────────** | ||
**➻ ᴜsᴀɢᴇ /chatbot [ᴏɴ/ᴏғғ]** | ||
<b>||๏ ʜɪᴛ ʜᴇʟᴘ ʙᴜᴛᴛᴏɴ ғᴏʀ ʜᴇʟᴘ.||</b> | ||
""" | ||
|
||
HELP_READ = f""" | ||
<u>**ᴄᴏᴍᴍᴀɴᴅs ғᴏʀ {BOT_NAME}**</u> | ||
<u>**ᴄᴏᴍᴍᴀɴᴅs ғᴏʀ {MickeyBot.name}**</u> | ||
<u>**ᴀʀᴇ ɢɪᴠᴇɴ ʙᴇʟᴏᴡ!**</u> | ||
**ᴀʟʟ ᴛʜᴇ ᴄᴏᴍᴍᴀɴᴅs ᴄᴀɴ ʙᴇ ᴜsᴇᴅ ᴡɪᴛʜ:/** | ||
**──────────────** | ||
<b>||©️ @{OWNER_USERNAME}||</b> | ||
""" | ||
|
||
TOOLS_DATA_READ = f""" | ||
<u>**ᴛᴏᴏʟs ғᴏʀ {BOT_NAME} ᴀʀᴇ:**</u> | ||
<u>**ᴛᴏᴏʟs ғᴏʀ {MickeyBot.name} ᴀʀᴇ:**</u> | ||
**➻ ᴜsᴇ /repo ғᴏʀ ɢᴇᴛᴛɪɴɢ sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ!** | ||
**──────────────** | ||
**➻ ᴜsᴇ /ping ғᴏʀ ᴄʜᴇᴄᴋɪɴɢ ᴛʜᴇ ᴘɪɴɢ ᴏғ {BOT_NAME}** | ||
**➻ ᴜsᴇ /ping ғᴏʀ ᴄʜᴇᴄᴋɪɴɢ ᴛʜᴇ ᴘɪɴɢ ᴏғ {MickeyBot.name}** | ||
**──────────────** | ||
**➻ ᴜsᴇ /id ᴛᴏ ɢᴇᴛ ʏᴏᴜʀ ᴜsᴇʀ ɪᴅ, ᴄʜᴀᴛ ɪᴅ ᴀɴᴅ ᴍᴇssᴀɢᴇ ɪᴅ ᴀʟʟ ɪɴ ᴀ sɪɴɢʟᴇ ᴍᴇssᴀɢᴇ.** | ||
**──────────────** | ||
<b>||©️ @{OWNER_USERNAME}||</b> | ||
""" | ||
|
||
CHATBOT_READ = f""" | ||
<u>**ᴄᴏᴍᴍᴀɴᴅs ғᴏʀ {BOT_NAME}**</u> | ||
<u>**ᴄᴏᴍᴍᴀɴᴅs ғᴏʀ {MickeyBot.name}**</u> | ||
**➻ ᴜsᴇ /chatbot ᴛᴏ ᴇɴᴀʙʟᴇ/ᴅɪsᴀʙʟᴇ ᴛʜᴇ ᴄʜᴀᴛʙᴏᴛ.** | ||
**๏ ɴᴏᴛᴇ ➻ ᴛʜᴇ ᴀʙᴏᴠᴇ ᴄᴏᴍᴍᴀɴᴅ ғᴏʀ ᴄʜᴀᴛʙᴏᴛ ᴡᴏʀᴋ ɪɴ ɢʀᴏᴜᴘ ᴏɴʟʏ!!** | ||
**───────────────** | ||
<b>||©️ @{OWNER_USERNAME}||</b> | ||
""" | ||
|
||
SOURCE_READ = f"**ʜᴇʏ, ᴛʜᴇ sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ ᴏғ [{BOT_NAME}](https://t.me/{BOT_USERNAME}) ɪs ɢɪᴠᴇɴ ʙᴇʟᴏᴡ.**\n**ᴘʟᴇᴀsᴇ ғᴏʀᴋ ᴛʜᴇ ʀᴇᴘᴏ & ɢɪᴠᴇ ᴛʜᴇ sᴛᴀʀ ✯**\n**──────────────────**\n**ʜᴇʀᴇ ɪs ᴛʜᴇ [sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ](https://github.com/Devarora-0981/Mickey)**\n**──────────────────**\n**ɪғ ʏᴏᴜ ғᴀᴄᴇ ᴀɴʏ ᴘʀᴏʙʟᴇᴍ ᴛʜᴇɴ ᴄᴏɴᴛᴀᴄᴛ ᴀᴛ [sᴜᴘᴘᴏʀᴛ ᴄʜᴀᴛ](https://t.me/{SUPPORT_GRP}).\n<b>||©️ @{OWNER_USERNAME}||</b>" | ||
SOURCE_READ = f"**ʜᴇʏ, ᴛʜᴇ sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ ᴏғ [{MickeyBot.name}](https://t.me/{MickeyBot.username}) ɪs ɢɪᴠᴇɴ ʙᴇʟᴏᴡ.**\n**ᴘʟᴇᴀsᴇ ғᴏʀᴋ ᴛʜᴇ ʀᴇᴘᴏ & ɢɪᴠᴇ ᴛʜᴇ sᴛᴀʀ ✯**\n**──────────────────**\n**ʜᴇʀᴇ ɪs ᴛʜᴇ [sᴏᴜʀᴄᴇ ᴄᴏᴅᴇ](https://github.com/Devarora-0981/Mickey)**\n**──────────────────**\n**ɪғ ʏᴏᴜ ғᴀᴄᴇ ᴀɴʏ ᴘʀᴏʙʟᴇᴍ ᴛʜᴇɴ ᴄᴏɴᴛᴀᴄᴛ ᴀᴛ [sᴜᴘᴘᴏʀᴛ ᴄʜᴀᴛ](https://t.me/{SUPPORT_GRP}).\n<b>||©️ @{OWNER_USERNAME}||</b>" | ||
|
||
ADMIN_READ = f"sᴏᴏɴ" | ||
|
||
ABOUT_READ = f""" | ||
**➻ [{BOT_NAME}](https://t.me/{BOT_USERNAME}) ɪs ᴀɴ ᴀɪ ʙᴀsᴇᴅ ᴄʜᴀᴛ-ʙᴏᴛ.** | ||
**➻ [{BOT_NAME}](https://t.me/{BOT_USERNAME}) ʀᴇᴘʟɪᴇs ᴀᴜᴛᴏᴍᴀᴛɪᴄᴀʟʟʏ ᴛᴏ ᴀ ᴜsᴇʀ.** | ||
**➻ [{MickeyBot.name}](https://t.me/{MickeyBot.username}) ɪs ᴀɴ ᴀɪ ʙᴀsᴇᴅ ᴄʜᴀᴛ-ʙᴏᴛ.** | ||
**➻ [{MickeyBot.name}](https://t.me/{MickeyBot.username}) ʀᴇᴘʟɪᴇs ᴀᴜᴛᴏᴍᴀᴛɪᴄᴀʟʟʏ ᴛᴏ ᴀ ᴜsᴇʀ.** | ||
**➻ ʜᴇʟᴘs ʏᴏᴜ ɪɴ ᴀᴄᴛɪᴠᴀᴛɪɴɢ ʏᴏᴜʀ ɢʀᴏᴜᴘs.** | ||
**➻ ᴡʀɪᴛᴛᴇɴ ɪɴ [ᴘʏᴛʜᴏɴ](https://www.python.org) ᴡɪᴛʜ [ᴍᴏɴɢᴏ-ᴅʙ](https://www.mongodb.com) ᴀs ᴀ ᴅᴀᴛᴀʙᴀsᴇ** | ||
**──────────────** | ||
**➻ ᴄʟɪᴄᴋ ᴏɴ ᴛʜᴇ ʙᴜᴛᴛᴏɴs ɢɪᴠᴇɴ ʙᴇʟᴏᴡ ғᴏʀ ɢᴇᴛᴛɪɴɢ ʙᴀsɪᴄ ʜᴇʟᴩ ᴀɴᴅ ɪɴғᴏ ᴀʙᴏᴜᴛ [{BOT_NAME}](https://t.me/{BOT_USERNAME})** | ||
**➻ ᴄʟɪᴄᴋ ᴏɴ ᴛʜᴇ ʙᴜᴛᴛᴏɴs ɢɪᴠᴇɴ ʙᴇʟᴏᴡ ғᴏʀ ɢᴇᴛᴛɪɴɢ ʙᴀsɪᴄ ʜᴇʟᴩ ᴀɴᴅ ɪɴғᴏ ᴀʙᴏᴜᴛ [{MickeyBot.name}](https://t.me/{MickeyBot.username})** | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.