Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Commands.py (Sourcery refactored) #7

Open
wants to merge 3 commits into
base: Professor-99
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 27 additions & 25 deletions DonLee_Robot_V2/Commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,24 @@

@DonLee_Robot_V2.on_message(filters.command(["start", "alive"]) & filters.private)
async def start(bot: DonLee_Robot_V2, msg: Import.Msg):
START_BUTTON = [[
Import.Button("➕ 𝖠𝖽𝖽 𝖬𝖾 𝖳𝗈 𝖸𝗈𝗎𝗋 𝖢𝗁𝖺𝗍𝗌 ➕", url=f"http://t.me/{Config.BOT_USERNAME}?startgroup=true")
],[
Import.Button("⚠️ 𝖧𝖾𝗅𝗉", callback_data="help"),
Import.Button("𝖠𝖻𝗈𝗎𝗍 🤠", callback_data="about")
]]
START_BUTTON = [[
InlineKeyboardButton('⚚ ΛᎠᎠ MΞ ϮԾ YԾUᏒ GᏒԾUᎮ ⚚', url=f'http://t.me/{temp.U_NAME}?startgroup=true')
],[
InlineKeyboardButton('💠 GᏒԾUᎮ 💠', url='https://t.me/moviespot001100'),
InlineKeyboardButton('💠 CHΛИИΞL 💠', url='https://t.me/moviespot00100')
],[
InlineKeyboardButton('♻️ HΞLᎮ ♻️', callback_data='help'),
InlineKeyboardButton('♻️ ΛBOUT ♻️', callback_data='about')
],[
InlineKeyboardButton('💠 SΞΛᏒCH HΞᏒΞ 💠', switch_inline_query_current_chat='')
]]
if not await db.is_user_exist(msg.from_user.id):
await db.add_user(msg.from_user.id)
try:
file_uid = msg.command[1]
except IndexError:
file_uid = False

Comment on lines 31 to +33
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function start refactored with the following changes:

if file_uid:
try:
user = await bot.get_chat_member(Config.FORCE_CHANNEL, msg.chat.id)
Expand All @@ -37,21 +42,21 @@ async def start(bot: DonLee_Robot_V2, msg: Import.Msg):
await msg.reply_text(
text=Config.FORCE_SUB_TEXT.format(msg.from_user.mention),
reply_markup=Import.Markup([
[ Import.Button(text="🔔 𝖩𝗈𝗂𝗇", url=f"https://t.me/{Config.FORCE_CHANNEL}"),
[ Import.Button(text="🔔 𝖩𝗈𝗂𝗇", url=f"https://t.me/moviespot00100"),
Import.Button(text="𝖱𝖾𝖿𝗋𝖾𝗌𝗁 🔃", url=f"https://t.me/{Config.BOT_USERNAME}?start={file_uid}")]
])
)
return

file_id, file_name, file_caption, file_type = await db.get_file(file_uid)
if (file_id or file_type) == None:

if ((file_id or file_type)) is None:
return

if Config.CAPTION_BOLD_OR_MONO == "bold":
caption = ("<b>" + file_name + "</b>")
else:
caption = ("<code>" + file_name + "</code>")
caption = f'<code>{file_name}</code>'
try:
await msg.reply_cached_media(
file_id,
Expand All @@ -67,7 +72,7 @@ async def start(bot: DonLee_Robot_V2, msg: Import.Msg):
return

button = [[
Import.Button('➕ Add Me To Your Groups ➕', url='http://t.me/donlee_robot?startgroup=true')
Import.Button('➕ Add Me To Your Groups ➕', url='http://t.me/Rexer0BOT_BOT?startgroup=true')
]]
await msg.reply_photo(
photo=random.choice(Config.PHOTO),
Expand Down Expand Up @@ -100,6 +105,9 @@ async def help(bot: DonLee_Robot_V2, msg: Import.Msg):
Import.Button("🏠𝖧𝗈𝗆𝖾", callback_data="home"),
Import.Button("𝖲𝗍𝖺𝗍𝗎𝗌", callback_data="status"),
Import.Button("𝖠𝖻𝗈𝗎𝗍🤠", callback_data="about")
],[
InlineKeyboardButton('💠 GᏒԾUᎮ 💠', url='https://t.me/moviespot001100'),
InlineKeyboardButton('💠 CHΛИИΞL 💠', url='https://t.me/moviespot00100')
]]
await bot.send_photo(
chat_id=msg.chat.id,
Expand All @@ -115,12 +123,12 @@ async def help(bot: DonLee_Robot_V2, msg: Import.Msg):
@DonLee_Robot_V2.on_message(filters.command(["about"]) & filters.private, group=1)
async def about(bot: DonLee_Robot_V2, msg: Import.Msg):
button = [[
Import.Button("👨‍💻𝖣𝖾𝗉𝗅𝗈𝗒", url='https://www.youtube.com/watch?v=NrbMc93aCzA'),
Import.Button("𝖲𝗈𝗎𝗋𝖼𝖾📦", callback_data="source")
],[
Import.Button("⚠️𝖧𝖾𝗅𝗉", callback_data="help"),
Import.Button("🏠𝖧𝗈𝗆𝖾", callback_data="home"),
Import.Button("𝖢𝗅𝗈𝗌𝖾🗑️", callback_data="close")
Import.Button("𝖲𝗍𝖺𝗍𝗎𝗌", callback_data="status"),
Import.Button("𝖠𝖻𝗈𝗎𝗍🤠", callback_data="about")
],[
InlineKeyboardButton('💠 GᏒԾUᎮ 💠', url='https://t.me/moviespot001100'),
InlineKeyboardButton('💠 CHΛИИΞL 💠', url='https://t.me/moviespot00100')
]]
await bot.send_photo(
chat_id=msg.chat.id,
Expand All @@ -135,14 +143,8 @@ async def about(bot: DonLee_Robot_V2, msg: Import.Msg):
@DonLee_Robot_V2.on_message(filters.command(["sub", "subscribe"]) & filters.private, group=1)
async def sub(bot: DonLee_Robot_V2, msg: Import.Msg):
button = [[
Import.Button("🖥️𝖵𝗂𝖽𝖾𝗈", url="https://www.youtube.com/watch?v=NrbMc93aCzA"),
Import.Button("𝖲𝗎𝗉𝗉𝗈𝗋𝗍🤝", url="https://www.youtube.com/watch?v=NrbMc93aCzA")
],[
Import.Button("📢𝖴𝗉𝖽𝖺𝗍𝖾𝗌", url="https://www.youtube.com/watch?v=NrbMc93aCzA"),
Import.Button("𝖸𝗈𝗎𝖳𝗎𝖻𝖾💞", url="https://www.youtube.com/watch?v=NrbMc93aCzA")
],[
Import.Button("📦𝖦𝗂𝗍𝗁𝗎𝖻", url="http://github.com/PR0FESS0R_99"),
Import.Button("𝖨𝗇𝗌𝗍𝖺😁", url="https://www.instagram.com/mrk_yt_")
Import.Button("💠 GᏒԾUᎮ 💠", url="https://t.me/moviespot001100"),
Import.Button("💠 CHΛИИΞL 💠", url="https://t.me/moviespot00100")
],[
Import.Button("𝖢𝗅𝗈𝗌𝖾🗑️", callback_data="close")
]]
Expand Down
2 changes: 1 addition & 1 deletion start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if [ -z $UPSTREAM_REPO ]
then
echo "Cloning main Repository"
git clone https://github.com/PR0FESS0R-99/DonLee-Robot-V2.git /DonLee-Robot-V2
git clone https://github.com/Zinan100/DonLee-Robot-V2/tree/patch-2 /DonLee-Robot-V2
else
echo "Cloning Custom Repo from $UPSTREAM_REPO "
git clone $UPSTREAM_REPO /DonLee-Robot-V2
Expand Down