merge pull request #156 from levina-lab/alpha

some changes
This commit is contained in:
levina 2022-02-20 21:02:21 +07:00 committed by GitHub
commit 769fb65ed5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 12 deletions

View File

@ -14,6 +14,7 @@ from driver.decorators import check_blacklist
from driver.queues import QUEUE, get_queue from driver.queues import QUEUE, get_queue
from driver.filters import command, other_filters from driver.filters import command, other_filters
keyboard = InlineKeyboardMarkup( keyboard = InlineKeyboardMarkup(
[[InlineKeyboardButton("🗑 Close", callback_data="set_close")]] [[InlineKeyboardButton("🗑 Close", callback_data="set_close")]]
) )
@ -28,11 +29,11 @@ async def playlist(client, m: Message):
if len(chat_queue) == 1: if len(chat_queue) == 1:
await m.reply( await m.reply(
f"💡 **Currently Streaming**`:`\n\n" f"💡 **Currently Streaming**`:`\n\n"
f"*️⃣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}`", f" [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}`",
reply_markup=keyboard, disable_web_page_preview=True) reply_markup=keyboard, disable_web_page_preview=True)
else: else:
QUE = f"💡 **Currently Streaming**`:`\n\n" \ QUE = f"💡 **Currently Streaming**`:`\n\n" \
f"*️⃣ [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}` \n\n" \ f" [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}` \n\n" \
f"**📖 Queue song list**`:`\n" f"**📖 Queue song list**`:`\n"
l = len(chat_queue) l = len(chat_queue)
for x in range(1, l): for x in range(1, l):

View File

@ -12,7 +12,7 @@ from driver.decorators import bot_creator
from driver.database.dbchat import get_served_chats from driver.database.dbchat import get_served_chats
from driver.database.dbpunish import add_gban_user, is_gbanned_user, remove_gban_user from driver.database.dbpunish import add_gban_user, is_gbanned_user, remove_gban_user
from config import SUDO_USERS, BOT_USERNAME as bn from config import OWNER_ID, SUDO_USERS, BOT_USERNAME as bn
@Client.on_message(command(["gban", f"gban@{bn}"]) & other_filters) @Client.on_message(command(["gban", f"gban@{bn}"]) & other_filters)
@ -30,13 +30,13 @@ async def global_banned(c: Client, message: Message):
from_user = message.from_user from_user = message.from_user
BOT_ID = me_bot.id BOT_ID = me_bot.id
if user.id == from_user.id: if user.id == from_user.id:
return await message.reply_text( await message.reply_text("You can't gban yourself !")
"You can't gban yourself !"
)
elif user.id == BOT_ID: elif user.id == BOT_ID:
await message.reply_text("I can't gban myself !") await message.reply_text("I can't gban myself !")
elif user.id in SUDO_USERS: elif user.id in SUDO_USERS:
await message.reply_text("You can't gban sudo user !") await message.reply_text("You can't gban sudo user !")
elif user.id in OWNER_ID:
await message.reply_text("You can't gban my creator !")
else: else:
await add_gban_user(user.id) await add_gban_user(user.id)
served_chats = [] served_chats = []
@ -84,6 +84,8 @@ async def global_banned(c: Client, message: Message):
await message.reply_text("I can't gban myself !") await message.reply_text("I can't gban myself !")
elif user_id in SUDO_USERS: elif user_id in SUDO_USERS:
await message.reply_text("You can't gban sudo user !") await message.reply_text("You can't gban sudo user !")
elif user_id in OWNER_ID:
await message.reply_text("You can't gban my creator !")
else: else:
is_gbanned = await is_gbanned_user(user_id) is_gbanned = await is_gbanned_user(user_id)
if is_gbanned: if is_gbanned:
@ -148,10 +150,12 @@ async def ungban_global(c: Client, message: Message):
await message.reply_text("I can't ungban myself because i can't be gbanned !") await message.reply_text("I can't ungban myself because i can't be gbanned !")
elif user.id in SUDO_USERS: elif user.id in SUDO_USERS:
await message.reply_text("Sudo users can't be gbanned/ungbanned !") await message.reply_text("Sudo users can't be gbanned/ungbanned !")
elif user.id in OWNER_ID:
await message.reply_text("Bot creator can't be gbanned/ungbanned !")
else: else:
is_gbanned = await is_gbanned_user(user.id) is_gbanned = await is_gbanned_user(user.id)
if not is_gbanned: if not is_gbanned:
await message.reply_text("This user not ungbanned !") await message.reply_text("This user is not gbanned !")
else: else:
await c.unban_chat_member(chat_id, user.id) await c.unban_chat_member(chat_id, user.id)
await remove_gban_user(user.id) await remove_gban_user(user.id)
@ -164,15 +168,15 @@ async def ungban_global(c: Client, message: Message):
if user_id == from_user_id: if user_id == from_user_id:
await message.reply_text("You can't ungban yourself because you can't be gbanned !") await message.reply_text("You can't ungban yourself because you can't be gbanned !")
elif user_id == BOT_ID: elif user_id == BOT_ID:
await message.reply_text( await message.reply_text("I can't ungban myself because i can't be gbanned !")
"I can't ungban myself because i can't be gbanned !"
)
elif user_id in SUDO_USERS: elif user_id in SUDO_USERS:
await message.reply_text("Sudo users can't be gbanned/ungbanned !") await message.reply_text("Sudo users can't be gbanned/ungbanned !")
elif user_id in OWNER_ID:
await message.reply_text("Bot creator can't be gbanned/ungbanned !")
else: else:
is_gbanned = await is_gbanned_user(user_id) is_gbanned = await is_gbanned_user(user_id)
if not is_gbanned: if not is_gbanned:
await message.reply_text("This user not gbanned !") await message.reply_text("This user is not gbanned !")
else: else:
await c.unban_chat_member(chat_id, user_id) await c.unban_chat_member(chat_id, user_id)
await remove_gban_user(user_id) await remove_gban_user(user_id)

View File

@ -36,7 +36,7 @@ async def run_speedtest(_, message: Message):
img = Image.open(path) img = Image.open(path)
c = img.crop((17, 11, 727, 389)) c = img.crop((17, 11, 727, 389))
c.save(path) c.save(path)
except: except BaseException:
pass pass
output = f"""💡 **SpeedTest Results** output = f"""💡 **SpeedTest Results**