Update nya ini dulu, yang lain nyusul

This commit is contained in:
yasirarism 2023-08-19 22:47:28 +07:00 committed by GitHub
parent 479bdd5b57
commit 79d02d7e8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 23 deletions

View file

@ -417,7 +417,7 @@ async def cmd_eval(self: Client, ctx: Message, strings) -> Optional[str]:
"send": send, "send": send,
"stdout": out_buf, "stdout": out_buf,
"traceback": traceback, "traceback": traceback,
"http": http, "http": fetch,
"replied": ctx.reply_to_message, "replied": ctx.reply_to_message,
"requests": requests, "requests": requests,
"help": _help, "help": _help,

View file

@ -6,7 +6,7 @@ from logging import getLogger
from PIL import Image, ImageChops, ImageDraw, ImageFont from PIL import Image, ImageChops, ImageDraw, ImageFont
from pyrogram import enums, filters from pyrogram import enums, filters
from pyrogram.errors import ChatAdminRequired, MessageTooLong, RPCError from pyrogram.errors import ChatAdminRequired, MessageTooLong, RPCError, ChatWriteForbidden
from pyrogram.types import ChatMemberUpdated, InlineKeyboardButton, InlineKeyboardMarkup from pyrogram.types import ChatMemberUpdated, InlineKeyboardButton, InlineKeyboardMarkup
from database.users_chats_db import db from database.users_chats_db import db
@ -201,6 +201,8 @@ async def greet_group(bot, message, strings):
LOGGER.error(f"ERROR in Combot API Detection. {err}") LOGGER.error(f"ERROR in Combot API Detection. {err}")
if userspammer != "": if userspammer != "":
await bot.send_message(message.chat.id, userspammer) await bot.send_message(message.chat.id, userspammer)
except ChatWriteForbidden:
await message.chat.leave()
except Exception as e: except Exception as e:
LOGGER.info(e) LOGGER.info(e)
try: try:

View file

@ -92,9 +92,12 @@ async def imdblangset(_, query: CallbackQuery):
InlineButton("🗑 Remove UserSetting", f"setimdb#rm#{query.from_user.id}") InlineButton("🗑 Remove UserSetting", f"setimdb#rm#{query.from_user.id}")
) )
buttons.row(InlineButton("❌ Close", f"close#{query.from_user.id}")) buttons.row(InlineButton("❌ Close", f"close#{query.from_user.id}"))
await query.message.edit_caption( try:
"<i>Please select available language below..</i>", reply_markup=buttons await query.message.edit_caption(
) "<i>Please select available language below..</i>", reply_markup=buttons
)
except (MessageIdInvalid, MessageNotModified):
pass
@app.on_cb("setimdb") @app.on_cb("setimdb")
@ -106,22 +109,24 @@ async def imdbsetlang(_, query: CallbackQuery):
_, langset = await is_imdbset(query.from_user.id) _, langset = await is_imdbset(query.from_user.id)
if langset == lang: if langset == lang:
return await query.answer(f"⚠️ Your Setting Already in ({langset})!", True) return await query.answer(f"⚠️ Your Setting Already in ({langset})!", True)
if lang == "eng": try:
await add_imdbset(query.from_user.id, lang) if lang == "eng":
await query.message.edit_caption( await add_imdbset(query.from_user.id, lang)
"Language interface for IMDB has been changed to English." await query.message.edit_caption(
) "Language interface for IMDB has been changed to English."
elif lang == "ind": )
await add_imdbset(query.from_user.id, lang) elif lang == "ind":
await query.message.edit_caption( await add_imdbset(query.from_user.id, lang)
"Bahasa tampilan IMDB sudah diubah ke Indonesia." await query.message.edit_caption(
) "Bahasa tampilan IMDB sudah diubah ke Indonesia."
else: )
await remove_imdbset(query.from_user.id) else:
await query.message.edit_caption( await remove_imdbset(query.from_user.id)
"UserSetting for IMDB has been deleted from database." await query.message.edit_caption(
) "UserSetting for IMDB has been deleted from database."
)
except (MessageIdInvalid, MessageNotModified):
pass
async def imdb_search_id(kueri, message): async def imdb_search_id(kueri, message):
BTN = [] BTN = []
@ -173,6 +178,8 @@ async def imdb_search_id(kueri, message):
) )
buttons.add(*BTN) buttons.add(*BTN)
await k.edit_caption(msg, reply_markup=buttons) await k.edit_caption(msg, reply_markup=buttons)
except (MessageIdInvalid, MessageNotModified):
pass
except Exception as err: except Exception as err:
await k.edit_caption( await k.edit_caption(
f"Ooppss, gagal mendapatkan daftar judul di IMDb. Mungkin terkena rate limit atau down.\n\n<b>ERROR:</b> <code>{err}</code>" f"Ooppss, gagal mendapatkan daftar judul di IMDb. Mungkin terkena rate limit atau down.\n\n<b>ERROR:</b> <code>{err}</code>"
@ -229,6 +236,8 @@ async def imdb_search_en(kueri, message):
) )
buttons.add(*BTN) buttons.add(*BTN)
await k.edit_caption(msg, reply_markup=buttons) await k.edit_caption(msg, reply_markup=buttons)
except (MessageIdInvalid, MessageNotModified):
pass
except Exception as err: except Exception as err:
await k.edit_caption( await k.edit_caption(
f"Failed when requesting movies title. Maybe got rate limit or down.\n\n<b>ERROR:</b> <code>{err}</code>" f"Failed when requesting movies title. Maybe got rate limit or down.\n\n<b>ERROR:</b> <code>{err}</code>"
@ -248,7 +257,10 @@ async def imdbcari(_, query: CallbackQuery):
del LIST_CARI[msg] del LIST_CARI[msg]
except KeyError: except KeyError:
return await query.message.edit_caption("⚠️ Callback Query Sudah Expired!") return await query.message.edit_caption("⚠️ Callback Query Sudah Expired!")
await query.message.edit_caption("<i>🔎 Sedang mencari di Database IMDB..</i>") try:
await query.message.edit_caption("<i>🔎 Sedang mencari di Database IMDB..</i>")
except (MessageIdInvalid, MessageNotModified):
pass
msg = "" msg = ""
buttons = InlineKeyboard(row_width=4) buttons = InlineKeyboard(row_width=4)
try: try:
@ -287,6 +299,8 @@ async def imdbcari(_, query: CallbackQuery):
) )
buttons.add(*BTN) buttons.add(*BTN)
await query.message.edit_caption(msg, reply_markup=buttons) await query.message.edit_caption(msg, reply_markup=buttons)
except (MessageIdInvalid, MessageNotModified):
pass
except Exception as err: except Exception as err:
await query.message.edit_caption( await query.message.edit_caption(
f"Ooppss, gagal mendapatkan daftar judul di IMDb. Mungkin terkena rate limit atau down.\n\n<b>ERROR:</b> <code>{err}</code>" f"Ooppss, gagal mendapatkan daftar judul di IMDb. Mungkin terkena rate limit atau down.\n\n<b>ERROR:</b> <code>{err}</code>"
@ -338,6 +352,8 @@ async def imdbcari(_, query: CallbackQuery):
) )
buttons.add(*BTN) buttons.add(*BTN)
await query.message.edit_caption(msg, reply_markup=buttons) await query.message.edit_caption(msg, reply_markup=buttons)
except (MessageIdInvalid, MessageNotModified):
pass
except Exception as err: except Exception as err:
await query.message.edit_caption( await query.message.edit_caption(
f"Failed when requesting movies title. Maybe got rate limit or down.\n\n<b>ERROR:</b> <code>{err}</code>" f"Failed when requesting movies title. Maybe got rate limit or down.\n\n<b>ERROR:</b> <code>{err}</code>"

View file

@ -203,7 +203,8 @@ async def ytdl_gendl_callback(self: Client, cq: CallbackQuery, strings):
try: try:
return await cq.answer(strings("vip-btn"), True) return await cq.answer(strings("vip-btn"), True)
except QueryIdInvalid: except QueryIdInvalid:
return return await cq.delete()
await cq.edit_message_caption("Downloading..")
async with iYTDL( async with iYTDL(
log_group_id=LOG_CHANNEL, log_group_id=LOG_CHANNEL,
cache_path="cache", cache_path="cache",