async def do_magic(event): try: match = event.text.split(" ", maxsplit=1)[1].lower() except IndexError: return await event.answer([], switch_pm="Enter Query to Search", switch_pm_param="start") if FDROID_.get(match): return await event.answer(FDROID_[match], switch_pm=f"• Results for {match}", switch_pm_param="start") link = "https://search.f-droid.org/?q=" + match.replace(" ", "+") content = await async_searcher(link, re_content=True) BSC = bs(content, "html.parser", from_encoding="utf-8") ress = [] for dat in BSC.find_all("a", "package-header")[:10]: image = dat.find("img", "package-icon")["src"] if image.endswith("/"): image = "https://telegra.ph/file/a8dd4a92c5a53a89d0eff.jpg" title = dat.find("h4", "package-name").text.strip() desc = dat.find("span", "package-summary").text.strip() text = f"• **Name :** `{title}`\n\n" text += f"• **Description :** `{desc}`\n" text += f"• **License :** `{dat.find('span', 'package-license').text.strip()}`" imga = wb(image, 0, "image/jpeg", []) ress.append(await event.builder.article( title=title, type="photo", description=desc, text=text, content=imga, thumb=imga, include_media=True, buttons=[ Button.inline("• Download •", "fd" + dat["href"].split("packages/")[-1]), Button.switch_inline("• Share •", query=event.text), ], )) msg = f"Showing {len(ress)} Results!" if ress else "No Results Found" FDROID_.update({match: ress}) await event.answer(ress, switch_pm=msg, switch_pm_param="start")
async def updater(): off_repo = UPSTREAM_REPO_URL try: repo = Repo() except NoSuchPathError as error: await ultroid_bot.asst.send_message( Var.LOG_CHANNEL, f"{txt}\n`directory {error} is not found`" ) repo.__del__() return except GitCommandError as error: await ultroid_bot.asst.send_message( Var.LOG_CHANNEL, f"{txt}\n`Early failure! {error}`" ) repo.__del__() return except InvalidGitRepositoryError: repo = Repo.init() origin = repo.create_remote("upstream", off_repo) origin.fetch() repo.create_head("main", origin.refs.main) repo.heads.main.set_tracking_branch(origin.refs.main) repo.heads.main.checkout(True) ac_br = repo.active_branch.name try: repo.create_remote("upstream", off_repo) except BaseException: pass ups_rem = repo.remote("upstream") ups_rem.fetch(ac_br) changelog, tl_chnglog = await gen_chlog(repo, f"HEAD..upstream/{ac_br}") if changelog: msg = await ultroid_bot.asst.send_file( Var.LOG_CHANNEL, "resources/extras/cf1.png", caption="**0.0.6 Update Available**", force_document=True, buttons=Button.inline("Changelogs", data="changes"), ) else: msg = None return msg
async def callback_get_activate_or_deactivate_page(event: Union[events.CallbackQuery.Event, events.NewMessage.Event, Message], activate: bool, *_, lang: Optional[str] = None, page: Optional[int] = None, chat_id: Optional[int] = None, **__): # callback data: get_(activate|deactivate)_page|{page} chat_id = chat_id or event.chat_id callback_tail = get_callback_tail(event, chat_id) event_is_msg = not isinstance(event, events.CallbackQuery.Event) if page is None: page = int(parse_callback_data_with_page(event.data)[1]) if not event_is_msg else 1 have_subs = await inner.utils.have_subs(chat_id) if not have_subs: no_subscription_msg = i18n[lang]['no_subscription'] await (event.respond(no_subscription_msg) if event_is_msg else event.edit(no_subscription_msg)) return sub_buttons = await inner.utils.get_sub_choosing_buttons( chat_id, page_number=page, callback='activate_sub' if activate else 'deactivate_sub', get_page_callback='get_activate_page' if activate else 'get_deactivate_page', lang=lang, rows=11, state=0 if activate else 1, tail=callback_tail ) msg = i18n[lang]['choose_sub_to_be_activated' if sub_buttons else 'all_subs_are_activated'] if activate \ else i18n[lang]['choose_sub_to_be_deactivated' if sub_buttons else 'all_subs_are_deactivated'] activate_or_deactivate_all_subs_str = 'activate_all_subs' if activate else 'deactivate_all_subs' buttons = ( ( (Button.inline(i18n[lang][activate_or_deactivate_all_subs_str], data=activate_or_deactivate_all_subs_str + callback_tail),), ) + sub_buttons ) if sub_buttons else None await (event.respond(msg, buttons=buttons) if event_is_msg else event.edit(msg, buttons=buttons))
async def _normal_msg_handler(self, event: events.NewMessage.Event): text: str = event.raw_text.strip() self._logger.info( f'User {(await event.message.get_sender()).id} (in {event.chat_id}) sends "{text}"' ) if not text or text.startswith('/start'): return elif text.startswith('/random'): # TODO: support random msg in a given chat # TODO: show message brief try: msg = self.backend.rand_msg() chat_name = await self.backend.translate_chat_id(msg.chat_id) respond = f'随机消息: <b>{chat_name} [{msg.post_time}]</b>\n' respond += f'{msg.url}\n' except IndexError: respond = '错误:索引为空' await event.respond(respond, parse_mode='html') elif text.startswith('/chats'): # TODO: support paging buttons = [] kw = remove_first_word(text) for chat_id in self.backend.monitored_chats: chat_name = await self.backend.translate_chat_id(chat_id) if kw in chat_name: buttons.append([ Button.inline(f'{chat_name} ({chat_id})', f'select_chat={chat_id}') ]) await event.respond('选择一个聊天', buttons=buttons) elif text.startswith('/search'): await self._search(event) elif text.startswith('/'): await event.respond(f'错误:未知命令 {text.split()[0]}') else: await self._search(event)
async def enter_code(cls, user: BotUser, event=None): reply = user.reply if event: if event.data == b'enter_code': msg = await event.get_message() await event.edit(msg.text) else: reply = event.edit num_keyboard = [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9'], ['x', '0', '<']] markup = build_buttons( num_keyboard, builder=lambda i: Button.inline( i, cls.enter_num.__qualname__ + '&' + i)) text = ' '.join([ 'Введите код:\n ', *('*' * len(user.code)), *('_' * (5 - len(user.code))) ]) return await reply(text, buttons=markup)
async def myinstall(event): try: SENDER = event.sender_id furl_startswith = "https://raw.githubusercontent.com/chiupam/JD_Diy/master/jbot/" btns = [ Button.inline("升级机器人", data="upbot.py"), Button.inline("检查账号过期", data="checkcookie.py"), Button.inline("下载文件", data="download.py"), Button.inline("添加仓库", data="addrepo.py"), Button.inline("添加环境变量", data="addexport.py"), Button.inline("修改环境变量", data="editexport.py"), Button.inline("帮我取消对话", data='cancel') ] async with jdbot.conversation(SENDER, timeout=60) as conv: msg = await conv.send_message("请问你需要拓展什么功能?", buttons=split_list(btns, row)) convdata = await conv.wait_event(press_event(SENDER)) fname = bytes.decode(convdata.data) if fname == 'cancel': await jdbot.edit_message(msg, '对话已取消,感谢你的使用') conv.cancel() return conv.cancel() msg = await jdbot.edit_message(msg, "开始下载文件") furl = f"{furl_startswith}{fname}" if '下载代理' in mybot.keys() and str(mybot['下载代理']).lower() != 'false': furl = f'{str(mybot["下载代理"])}/{furl}' try: resp = requests.get(furl).text info = f"下载{fname}成功,正在自动重启" botresp = True except Exception as e: info = f"下载{fname}失败,请自行拉取文件进/jbot/diy目录,或尝试使用 /set 指令更换下载代理" botresp = False await jdbot.edit_message(msg, info) if botresp: path = f"{_JdbotDir}/diy/{fname}" backfile(path) with open(path, 'w+', encoding='utf-8') as f: f.write(resp) except exceptions.TimeoutError: msg = await jdbot.edit_message(msg, '选择已超时,对话已停止,感谢你的使用') except Exception as e: await jdbot.send_message(chat_id, 'something wrong,I\'m sorry\n' + str(e)) logger.error('something wrong,I\'m sorry\n' + str(e))
async def on_plug_in_callback_query_handler(event): plugin_name = event.data_match.group(1).decode("UTF-8") help_string = "" # By @RoseLoverX for i in CMD_LIST[plugin_name]: plugin = plugin_name.replace("_", " ") emoji = plugin_name.split("_")[0] output = str(CMD_HELP[plugin][1]) help_string = f"Here is the help for **{emoji}**:\n" + output if help_string is None: pass # stuck on click else: reply_pop_up_alert = help_string try: await event.edit(reply_pop_up_alert, buttons=[[Button.inline("Back", data="go_back")]]) except BaseException: pass
async def heroku(event): if event.sender_id == bot.me.id or event.sender_id == ID: pro = [[Button.inline("••• Bᴏᴛ Nɪᴄᴋɴᴀᴍᴇ •••", data="nick")]] pro += [[Button.inline("••• Aʟɪᴠᴇ Pʜᴏᴛᴏ •••", data="alive_photo")]] pro += [[Button.inline("••• Fʙᴀɴ Gʀᴏᴜᴘ Iᴅ •••", data="fban_id")]] pro += [[Button.inline("••• Aʟɪᴠᴇ Nᴀᴍᴇ •••", data="alive_name")]] pro += [[Button.inline("••• Sᴛʀɪɴɢ Sᴇssɪᴏɴ •••", data="session")]] pro += [[Button.inline("••• Aᴅᴅ Sᴜᴅᴏ •••", data="addsudo")]] await event.edit("**Hᴇʟʟᴏ Mᴀsᴛᴇʀ, Wʜᴀᴛ Dᴏ Yᴏᴜ Wᴀɴɴᴀ Sᴇᴛ Tᴏᴅᴀʏ ?**", buttons=pro) else: await event.answer( "**Hey kid, go away and don't use my bot deploy your own bot** 😕 !!\n\nFᴏʀ Aɴʏ Hᴇʟᴘ Asᴋ Iɴ @DaisySupport_Official !", alert=True, )
def prepare_zip_file(th, torrent_name, files, event, log): downloaded_pieces_count = 0 torrent_files = [] num_pieces = 0 for fi in files: num_pieces += fi.num_pieces # for i, fi in enumerate(files): # if i != 0: # downloaded_pieces_count += files[i-1].num_pieces # cur_status_msg_text = status_msg_text.format(cur_file_progress=status_msg_current_file_text.format(cur_file_name=fi.name[0:25] + ("..." if len(fi.name)>25 else ""))) # callback = lambda cur_piece, _num_pieces=fi.num_pieces, _downloaded_pieces_count=downloaded_pieces_count, __num_pieces=num_pieces, _status_msg=status_msg, _cur_status_msg_text=cur_status_msg_text: progress_callback(cur_piece, _num_pieces, _downloaded_pieces_count, __num_pieces, _status_msg, _cur_status_msg_text) torrent_files.append(tc.TorrentContentFile(th, fi, log)) zip_progress_text = prepare_status_message(files, torrent_name, th.total_size()) callback = lambda percent: \ event.edit(zip_progress_text.format(percent), buttons=[Button.inline('❌CANCEL❌', str(event.sender_id))]) zfile = tc.ZipTorrentContentFile(th, torrent_files, torrent_name, callback, log, should_split=True) return zfile
async def search(event: NewMessage.Event): if event.text.startswith("/"): search_query = "" else: search_query = event.text await event.respond( translate.CHOOSE, buttons=[ [ Button.switch_inline( translate.SEARCH_TRACK, query=search_query, same_peer=True ), Button.switch_inline( translate.SEARCH_ALBUM, query=".a " + search_query, same_peer=True, ), ], [Button.inline("❌")], ], )
async def apikeys(event): await event.edit( "**Silahkan Pilih VAR yang ingin anda Setting**", buttons=[ [ Button.inline("ʙɪᴛʟʏ ᴛᴏᴋᴇɴ", data="btly"), Button.inline("ᴅᴇᴇᴢᴇʀ ᴀʀʟ ᴛᴏᴋᴇɴ", data="dzrl"), ], [ Button.inline("ᴅᴇᴇᴘ ᴀᴘɪ", data="dapi"), Button.inline("ᴏᴄʀ ᴀᴘɪ", data="ocrapi"), ], [ Button.inline("ᴏᴘᴇɴ ᴡᴇᴀᴛʜᴇʀ", data="opnwth"), Button.inline("ʀᴇᴍᴏᴠᴇ.ʙɢ ᴀᴘɪ", data="rmbgapi"), ], [Button.inline("« ʙᴀᴄᴋ", data="apiset")], ], )
async def apiset(event): await event.edit( "**Silahkan Pilih VAR yang ingin anda Setting**", buttons=[ [Button.inline("ᴍᴜʟᴛɪ ᴄʟɪᴇɴᴛ", data="multiclient")], [ Button.inline("ᴀʟɪᴠᴇ", data="alivemenu"), Button.inline("ᴀᴘɪ ᴋᴇʏs", data="apikeys"), ], [ Button.inline("ʜᴀɴᴅʟᴇʀ", data="hndlrmenu"), Button.inline("ɪɴʟɪɴᴇ", data="inlinemenu"), ], [Button.inline("« ʙᴀᴄᴋ", data="settings")], ], )
async def heroku(event): if event.sender_id == bot.me.id or event.sender_id == ID: pro = [[Button.inline("••• Bᴏᴛ Nɪᴄᴋɴᴀᴍᴇ •••", data="nick")]] pro += [[Button.inline("••• Aʟɪᴠᴇ Pʜᴏᴛᴏ •••", data="alive_photo")]] pro += [[Button.inline("••• Fʙᴀɴ Gʀᴏᴜᴘ Iᴅ •••", data="fban_id")]] pro += [[Button.inline("••• Aʟɪᴠᴇ Nᴀᴍᴇ •••", data="alive_name")]] pro += [[Button.inline("••• Sᴛʀɪɴɢ Sᴇssɪᴏɴ •••", data="session")]] pro += [[Button.inline("••• Aᴅᴅ Sᴜᴅᴏ •••", data="addsudo")]] await xbot.send_message( event.chat_id, "**Hᴇʟʟᴏ Mᴀsᴛᴇʀ, Wʜᴀᴛ Dᴏ Yᴏᴜ Wᴀɴɴᴀ Sᴇᴛ Tᴏᴅᴀʏ ?**", buttons=pro) else: await event.reply( "**Hey kid go away and don't use my bot deploy your own bot** 😕 !!\n\nFᴏʀ Aɴʏ Hᴇʟᴘ Asᴋ Iɴ @UltraXChat !" )
async def get(event): """ get Samsung firmware """ model = event.pattern_match.group(1).upper() region = event.pattern_match.group(2).upper() if event.message.sender_id not in TG_BOT_ADMINS: if not await is_device(model) or not await is_region(region): await event.reply("**Either model or region is incorrect!**") return path = f"{model}/{region}/" if await STORAGE.check(path): message = f"**Available firmware for {model} ({region}):**\n\n" for item in await STORAGE.listdir(path): message += f"[{item.parts[-1]}]({await STORAGE.get_url(item)})\n" await event.reply(message, link_preview=False) else: await event.reply( f"**There is no available firmware for {SAM_FIRM.get_device_name(model)} [{model}] ({region}) yet\n" f"However, you can submit a request using the button below**", buttons=[ Button.inline("Request Firmware", data=f"request_{model}_{region}") ])
async def age_verification_false(event: CallbackQuery): u_id = event.query.user_id if u_id != Config.OWNER_ID and u_id not in Config.SUDO_USERS: return await event.answer( "Given That It's A Stupid-Ass Decision, I've Elected To Ignore It.", alert=True, ) await event.answer("No I'm Not", alert=False) buttons = [ Button.inline( text="Unsure / Change of Decision ❔", data="chg_of_decision_", ) ] try: await event.edit( text="GO AWAY KID !", file="https://telegra.ph/file/1140f16a883d35224e6a1.jpg", buttons=buttons, ) except MessageNotModifiedError: pass
async def search(event: Union[NewMessage.Event, Message]): if event.text.startswith('/'): search_query = '' else: search_query = event.text await event.respond( translate.CHOOSE, buttons=[[ Button.switch_inline(translate.SEARCH_TRACK, query=search_query, same_peer=True) ], [ Button.switch_inline(translate.SEARCH_ALBUM, query=".a " + search_query, same_peer=True) ], [ Button.switch_inline(translate.SEARCH_PLAYLIST, query=".p " + search_query, same_peer=True) ], [Button.inline('❌')]])
async def age_verification_true(event: CallbackQuery): u_id = event.query.user_id if u_id != Config.OWNER_ID and u_id not in Config.SUDO_USERS: return await event.answer( "Given That It's A Stupid-Ass Decision, I've Elected To Ignore It.", alert=True, ) await event.answer("Yes I'm 18+", alert=False) buttons = [ Button.inline( text="Unsure / Change of Decision ❔", data="chg_of_decision_", ) ] try: await event.edit( text="To access this plugin type `.setdv ALLOW_NSFW True`", file="https://telegra.ph/file/85f3071c31279bcc280ef.jpg", buttons=buttons, ) except MessageNotModifiedError: pass
async def legend(): pro = await xbot.get_me() legend = await bot.get_me() if EXTRA_PLUGS != False: print("LoAdInG XtRa PlUgInS.. ") await xtra_load() path = "ExtraPlugins/*.py" files = glob.glob(path) for name in files: with open(name) as f: path1 = Path(f.name) shortname = path1.stem load_extra(shortname.replace(".py", "")) print("X-TrA pLuGiNs LoAdEd") LEGENDX = f""" **Sᴏᴍᴇᴛʜɪɴɢ Hᴀᴘᴘᴇɴᴇᴅ ! Lᴇᴛs Cʜᴇᴄᴋ** 🤔 `☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎` **Dɪɴɢ Dᴏɴɢ...** `.\./.\` **Tɪɴɢ Tᴏɴɢ...** `./.\./` **DAISYX Hᴀs Bᴇᴇɴ Dᴇᴘʟᴏʏᴇᴅ !!** **Pɪɴɢ Pᴏɴɢ...** **➥ Mᴀsᴛᴇʀ** `➪` **@{legend.username}** **➥ Assɪsᴛᴀɴᴛ** `➪` **@{pro.username}** **➥ Sᴜᴘᴘᴏʀᴛ** `➪` **@DaisySupport_Official** **➥ Cʜᴀɴɴᴇʟ** `➪` **@DaisyXUpdates** **Cʜᴇᴄᴋ ᴍᴏɪ Pɪɴɢ ᴛɪᴍᴇ ʙʏ** `.ping` **[Fᴏʀ UsᴇʀBᴏᴛ] or** `/ping` **[Fᴏʀ Assɪsᴛᴀɴᴛ]** """ if ONLINE_ALERT is True: try: PROBOYX = [[Button.inline("Hᴇʀᴏᴋᴜ Vᴀʀs", data="ass_back")]] await xbot.send_message(bot.me.id, LEGENDX, buttons=PROBOYX) except: pass else: print("YOUR BOT DEPLOYED SUCCESSFULLY")
async def menuclient(event): await event.edit( "**Silahkan Pilih VAR yang ingin anda Setting**", buttons=[ [ Button.inline("sᴛʀɪɴɢ_sᴇssɪᴏɴ", data="strone"), ], [ Button.inline("sᴛʀɪɴɢ 2", data="strtwo"), Button.inline("sᴛʀɪɴɢ 3", data="strtri"), ], [ Button.inline("sᴛʀɪɴɢ 4", data="strfor"), Button.inline("sᴛʀɪɴɢ 5", data="strfiv"), ], [Button.inline("« ʙᴀᴄᴋ", data="apiset")], ], )
async def alivemenu(event): await event.edit( "**Silahkan Pilih VAR yang ingin anda Setting**", buttons=[ [ Button.inline("ᴀʟɪᴠᴇ ʟᴏɢᴏ", data="alvlogo"), ], [ Button.inline("ᴀʟɪᴠᴇ ᴇᴍᴏᴊɪ", data="alvmoji"), Button.inline("ᴀʟɪᴠᴇ ᴛᴇᴋs", data="alvteks"), ], [ Button.inline("ᴄʜᴀɴɴᴇʟ", data="alvch"), Button.inline("ɢʀᴏᴜᴘ", data="alvgc"), ], [Button.inline("« ʙᴀᴄᴋ", data="apiset")], ], )
async def natija_export_excel(event): data = event.data.decode('UTF-8').split("=") number = int(data[1]) try: results = db.ForExportRatingInfoAll(number) filename = "Test-{}-natijalari.xlsx".format(number) workbook = excel.Workbook('file/{}'.format(filename)) worksheet = workbook.add_worksheet() i = 0 for result in results: i += 1 first_name = result['first_name'].replace("'", "`") last_name = result['last_name'].replace("'", "`") total_score = result['total_score'] worksheet.write_number('A{}'.format(i), i) worksheet.write_string( 'B{}'.format(i), "{} {}".format(first_name, last_name.replace("None", ""))) worksheet.write_string('F{}'.format(i), "{} ball".format(total_score)) workbook.close() async with bot.action(event.sender.id, 'document') as action: await event.answer("Yuborilmoqda...") await bot.send_file( event.sender.id, file="file/{}".format(filename), buttons=[Button.inline(message['home'], data="back")], parse_mode="HTML", progress_callback=action.progress) os.remove("file/{}".format(filename)) except Exception as e: print(e) raise events.StopPropagation
async def f(event): chat_id = event.chat_id chat_db = sql.fs_settings(chat_id) user_id = event.sender_id if not chat_db: return if await is_admin(event, event.sender_id): return if chat_db: try: channel = chat_db.channel rip = await check_him(channel, event.sender_id) if rip is False: rk = f"{event.sender_id}" fname = event.sender.first_name grp = f"t.me/{channel}" k = await tbot.get_entity(channel) username = k.username buttons = [ [Button.url("Join Channel", grp)], [Button.inline("Unmute Me", data="fs_{}".format(rk))], ] text = "Hello {} You need to join [channel](https://t.me/{}) here to send messages in groupAfter joining channel click UNMUTE ME Button to unmute yourself.\n\nJoin @{}".format( fname, channel, username) await tbot( EditBannedRequest(event.chat_id, event.sender_id, MUTE_RIGHTS)) await tbot.send_message(event.chat_id, text, buttons=buttons, link_preview=False) except: if not await rights(event): await tbot.send_message( event.chat_id, "❗**I am not an admin here.**\nMake me admin with ban user permission" )
async def warn_user(event): user, args = await get_user(event) if await is_admin(event, user.id): return await event.reply("Oya lets start warning admins!") user_id = user.id if user_id == BOT_ID or user_id == OWNER_ID: return await event.reply("Yeah like I Warn myself!?") chat_id = event.chat_id if args: reason = f"\n**Reason:** {args}" else: reason = "" limit, soft_warn = sql.get_warn_setting(event.chat_id) num_warns, reasons = sql.warn_user(user_id, event.chat_id, reason) if num_warns >= limit: sql.reset_warns(user_id, event.chat_id) strength = sql.get_warn_strength(event.chat_id) if strength == "ban": await warn_ban(user_id, event) elif strength == "kick": await warn_kick(user_id, event) elif strength == "mute": await warn_kick(user_id, event) elif strength == "tban": await warn_tban(user_id, event) elif strength == "tmute": await warn_tmute(user_id, event) else: try: pro = await tbot.get_entity(int(user_id)) fname = pro.first_name except: fname = "User" text = f"User [{fname}](tg://user?id={user_id}) has {num_warns}/{limit} warnings;\nbe careful!{reason}" buttons = Button.inline("Remove warn (admin only)", data=f"rm_warn-{user_id}") await tbot.send_message(event.chat_id, text, buttons=buttons)
async def cmd_set_interval(event: Union[events.NewMessage.Event, Message], *_, lang: Optional[str] = None, chat_id: Optional[int] = None, **__): chat_id = chat_id or event.chat_id callback_tail = get_callback_tail(event, chat_id) sub_or_user, interval = await parse_command_get_sub_or_user_and_param( event.raw_text, chat_id, allow_setting_user_default=True) interval = int(interval) if interval and interval.isdigit( ) and int(interval) >= 1 else None minimal_interval = db.EffectiveOptions.minimal_interval if not sub_or_user: await event.respond(i18n[lang]['permission_denied_no_direct_use'] % '/set') return if not interval: await event.respond(i18n[lang]['cmd_set_interval_usage_prompt_html'], parse_mode='html') return if interval < minimal_interval and chat_id != env.MANAGER: await event.respond(i18n[lang]['set_interval_failure_too_small_html'] % minimal_interval, parse_mode='html') return await inner.customization.set_interval(sub_or_user, interval) await event.respond( (((i18n[lang]['set_interval_success_html'] % (interval, )) + '\n\n' + await inner.customization.get_sub_info(sub_or_user, lang=lang)) if isinstance(sub_or_user, db.Sub) else i18n[lang]['set_default_interval_success_html'] % (interval, )), buttons=(Button.inline(i18n[lang]['other_settings_button'], data=((f'set={sub_or_user.id}' if isinstance( sub_or_user, db.Sub) else 'set_default') + callback_tail)), ), parse_mode='html', link_preview=False)
async def legend(): try: pro = await xbot.get_me() legend = await bot.get_me() PROBOYX = [[Button.inline("Hᴇʀᴏᴋᴜ Vᴀʀs", data='ass_back')]] LEGENDX = f""" **Sᴏᴍᴇᴛʜɪɴɢ Hᴀᴘᴘᴇɴᴇᴅ ! Lᴇᴛs Cʜᴇᴄᴋ** 🤔 `☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎ ☟︎︎︎` **Dɪɴɢ Dᴏɴɢ...** `.\./.\` **Tɪɴɢ Tᴏɴɢ...** `./.\./` **UʟᴛʀᴀX Hᴀs Bᴇᴇɴ Dᴇᴘʟᴏʏᴇᴅ !!** **Pɪɴɢ Pᴏɴɢ...** **➥ Mᴀsᴛᴇʀ** `➪` **@{legend.username}** **➥ Assɪsᴛᴀɴᴛ** `➪` **@{pro.username}** **➥ Sᴜᴘᴘᴏʀᴛ** `➪` **@UltraXchaT** **➥ Cʜᴀɴɴᴇʟ** `➪` **@UltraX_SupporT** **Cʜᴇᴄᴋ ᴍᴏɪ Pɪɴɢ ᴛɪᴍᴇ ʙʏ** `.ping` **[Fᴏʀ UsᴇʀBᴏᴛ] or** `/ping` **[Fᴏʀ Assɪsᴛᴀɴᴛ]** """ await xbot.send_message(bot.me.id, LEGENDX, buttons=PROBOYX) except: pass
async def search(event): tata = event.pattern_match.group(1) data = tata.decode() input = data.split("_", 1)[1] animeid = input await event.answer("Fetching Anime Details") result = anime.get_anime_details(animeid) episodes = result["episodes"] nfo = f"{animeid}?{episodes}" buttons = Button.inline("Download", data="episode_{}".format(nfo)) text = """ {} (Released: {}) Type: {} Status: {} Generies: {} Episodes: {} Summary: {} """ await event.edit(text.format(result["title"], result["year"], result["type"], result["status"], result["genre"], result["episodes"], result["plot_summary"]), buttons=buttons)
async def rm_deletedacc(show): if not show.is_group: await event.reply("`I don't think this is a group.`") return chat = await show.get_chat() admin = chat.admin_rights if not admin: await show.reply("I'm not admin! - REEEEEE") return if not await user_is_admin(user_id=show.sender_id, message=show): await show.reply( "Who dis non-admin telling me what to do? You want a kick?") return if not await can_ban_users(message=show): await show.reply("Seems like I don't have permission to ban users.") return del_u = 0 del_status = "No deleted accounts found, Group is clean." x = await show.reply("Searching for deleted accounts...") async for user in show.client.iter_participants(show.chat_id): if user.deleted: del_u += 1 await sleep(1) if del_u > 0: await show.client.delete_messages(show.chat_id, x.id) del_status = f"Found **{del_u}** deleted/zombies account(s) in this group,\ \nclean them by clicking the button below." await show.client.send_message( show.chat_id, del_status, buttons=[Button.inline("Clean Zombies", b"rmdel")], reply_to=show.id, ) else: await show.client.edit_message(show.chat_id, x.id, del_status)
async def botsettings(event): await event.delete() if event.query.user_id == OWNER_ID: await tgbot.send_message( event.chat_id, message= f"**Halo [{OWNER}](tg://user?id={OWNER_ID})**\n**Apa ada yang bisa saya bantu?**", buttons=[ (Button.inline("sᴇᴛᴛɪɴɢs ᴠᴀʀ", data="apiset"), ), ( Button.inline("ᴘᴍʙᴏᴛ", data="pmbot"), Button.inline("ᴜsᴇʀs", data="users"), ), ( Button.inline("ᴘɪɴɢ", data="pingbot"), Button.inline("ᴜᴘᴛɪᴍᴇ", data="uptimebot"), ), (Button.inline("ᴄʟᴏsᴇ", data="pmclose"), ), ], )
async def _(e): match = e.pattern_match.group(1) chat_id, msg_id = match.split(":") filename = _webupload_cache[int(chat_id)][int(msg_id)] if "/" in filename: filename = filename.split("/")[-1] __cache = f"{chat_id}:{msg_id}" buttons = [ [ Button.inline("anonfiles", data=f"flanonfiles//{__cache}"), Button.inline("transfer", data=f"fltransfer//{__cache}"), ], [ Button.inline("bayfiles", data=f"flbayfiles//{__cache}"), Button.inline("x0.at", data=f"flx0.at//{__cache}"), ], [ Button.inline("file.io", data=f"flfile.io//{__cache}"), Button.inline("siasky", data=f"flsiasky//{__cache}"), ], ] try: lnk = [ await e.builder.article( title=f"Upload {filename}", text=f"**File:**\n{filename}", buttons=buttons, ) ] except BaseException as er: LOGS.exception(er) lnk = [ await e.builder.article( title="fl2lnk", text="File not found", ) ] await e.answer(lnk, switch_pm="File to Link.", switch_pm_param="start")
async def _(event): try: string = event.text.split(" ", maxsplit=1)[1] except IndexError: fuk = event.builder.article( title="Search Something", thumb=wb(ytt, 0, "image/jpeg", []), text="**YᴏᴜTᴜʙᴇ Sᴇᴀʀᴄʜ**\n\nYou didn't search anything", buttons=Button.switch_inline( "Sᴇᴀʀᴄʜ Aɢᴀɪɴ", query="yt ", same_peer=True, ), ) await event.answer([fuk]) return results = [] search = VideosSearch(string, limit=10) nub = search.result() nibba = nub["result"] for v in nibba: ids = v["id"] link = _yt_base_url + ids title = v["title"] duration = v["duration"] views = v["viewCount"]["short"] publisher = v["channel"]["name"] published_on = v["publishedTime"] description = ( v["descriptionSnippet"][0]["text"] if v.get("descriptionSnippet") and len(v["descriptionSnippet"][0]["text"]) < 500 else "None") thumb = f"https://i.ytimg.com/vi/{ids}/hqdefault.jpg" text = f"<strong>Title:- <a href={link}>{title}</a></strong>\n" text += f"<strong>⏳ Duration:-</strong> <code>{duration}</code>\n" text += f"<strong>👀 Views:- </strong> <code>{views}</code>\n" text += f"<strong>🎙️ Publisher:- </strong> <code>{publisher}</code>\n" text += f"<strong>🗓️ Published on:- </strong> <code>{published_on}</code>\n" text += f"<strong>📝 Description:- </strong> <code>{description}</code>" desc = f"{title}\n{duration}" file = wb(thumb, 0, "image/jpeg", []) buttons = [ [ Button.inline("Audio", data=f"ytdl:audio:{ids}"), Button.inline("Video", data=f"ytdl:video:{ids}"), ], [ Button.switch_inline( "Sᴇᴀʀᴄʜ Aɢᴀɪɴ", query="yt ", same_peer=True, ), Button.switch_inline( "Sʜᴀʀᴇ", query=f"yt {string}", same_peer=False, ), ], ] BACK_BUTTON.update( {ids: { "text": text, "buttons": buttons, "parse_mode": "html" }}) results.append( await event.builder.article( type="photo", title=title, description=desc, thumb=file, content=file, text=text, include_media=True, parse_mode="html", buttons=buttons, ), ) await event.answer(results[:50])