Exemplo n.º 1
0
def command_get_specify_apk(bot, update):
    if active_chats.get(update.from_user.id).get('link') is None:
        search_query = active_chats.get(update.from_user.id).get('search_query')
    query = " ".join(search_query) 
    try:
        sent = update.reply(fetching_download_link.format(query),
        quote=True, disable_web_page_preview=True)
        print('Searching for: {}'.format(query))
        options={}
        base_headers = {
        'User-Agent':  'Mozilla/6.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.5 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.5',
        'Accept-Encoding': 'gzip, deflate, sdch',
        'Accept-Language': 'zh-CN,zh;q=0.8'
    }
        headers = dict(base_headers, **options)
        res = requests.get('https://apkpure.com/search?q={}&region='.format(quote_plus(query)), headers=headers).text
        APPS = []
        soup = BeautifulSoup(res, "html.parser")
        for i in soup.find('div', {'id':'search-res'}).findAll('dl', {'class':'search-dl'}):
            app = i.find('p', {'class':'search-title'}).find('a')
            APPS.append((app.text,
                    i.findAll('p')[1].find('a').text,
                    'https://apkpure.com' + app['href']))
        time.sleep(2)
    
    
        inline_keyboard = []
    
        if len(APPS) > 0:
            items = ""
            for idx, app in enumerate(APPS):
                start_string = "{}|{}".format(idx, app[0])
                ikeyboard = [
                            InlineKeyboardButton(
                                "[{:02d}]  -  {}".format(idx, app[0]),
                                callback_data=start_string.encode("UTF-8")
                            )
                        ]
            
            user_chat = active_chats.get(update.from_user.id, None)
            user_chat['Aps'] = APPS
            user_chat['Apps'] = None      
            inline_keyboard.append(ikeyboard)
        
            num=len(APPS)
            reply_markup = InlineKeyboardMarkup(inline_keyboard)
            sent.edit("📱 <b>Apk Downloader Premium</b> __Step 2 of  2__: <b>{}</b> Results \n\n".format(num), reply_markup=reply_markup, parse_mode="html", disable_web_page_preview=True)
            
        else:
            sent.edit("**📱 Apk Downloader Premium**\n\n__Step 1 of  2__\n"
                              "\n\n❗️ Search Not Found.. Try again")
            return

    except Exception as e:
        update.reply(str(e))
    except:
      traceback.print_exc()
Exemplo n.º 2
0
async def donate(bot, update):
    await bot.send_message(
        chat_id=update.chat.id,
        text=
        "I am very happy to listen you this word, making of this bot take lot of work and time so please donate by pressing this button present below",
        reply_markup=InlineKeyboardMarkup([[
            InlineKeyboardButton('Donate 💰',
                                 url='https://www.paypal.me/Arata74')
        ]]))
Exemplo n.º 3
0
async def reboot_bot(client, query):
    await restart_all()
    text = "**⚙️ Welcome to Nana Settings!**\n"
    text += "-> Userbot: `Running (v{})`\n".format(USERBOT_VERSION)
    text += "-> Assistant: `Running (v{})`\n".format(ASSISTANT_VERSION)
    text += "-> Database: `{}`\n".format(DB_AVAIABLE)
    text += "-> Python: `{}`\n".format(python_version())
    text += "\n✅ Bot was restarted!"
    list_button = [[InlineKeyboardButton("Stop Bot", callback_data="toggle_startbot"),
                    InlineKeyboardButton("Restart Bot", callback_data="restart_bot")]]
    if HEROKU_API:
        list_button.append([InlineKeyboardButton("Restart Heroku app", callback_data="restart_heroku")])
    button = InlineKeyboardMarkup(list_button)
    try:
        await query.message.edit_text(text, reply_markup=button)
    except errors.exceptions.bad_request_400.MessageNotModified:
        pass
    await client.answer_callback_query(query.id, "Please wait for bot restarting...")
Exemplo n.º 4
0
async def old(client, message):
    await client.edit_message_caption(
        chat_id=message.chat.id,
        message_id=message.message_id,
        caption=Translation.CAP_TION,
        parse_mode=markdown,  #also you can set html or none
        reply_markup=InlineKeyboardMarkup([
            [InlineKeyboardButton('🦋name🦋', url='https://t.me/url')],
        ]))
Exemplo n.º 5
0
def _start(c, m):
    m.reply_chat_action("typing")

    m.reply_text(text=tr.START_MSG.format(m.from_user.first_name),
                 quote=True,
                 reply_markup=InlineKeyboardMarkup([[
                     InlineKeyboardButton('🚥Contact us!🙏',
                                          url='https://t.me/JokkerKing')
                 ]]))
Exemplo n.º 6
0
async def progress_dl(message: Message,
                      aria2_api: aria2.aria2,
                      gid: int,
                      previous_text=None):
    try:
        download = aria2_api.get_download(gid)
        if not download.is_complete:
            if not download.error_message:
                block = ""
                for i in range(1, int(CONFIG.BAR_SIZE) + 1):
                    if i <= floor(
                            download.progress * int(CONFIG.BAR_SIZE) / 100):
                        block += LOCAL.BLOCK_FILLED
                    else:
                        block += LOCAL.BLOCK_EMPTY
                text = LOCAL.ARIA2_DOWNLOAD_STATUS.format(
                    name=download.name,
                    block=block,
                    percentage=download.progress_string(),
                    total_size=download.total_length_string(),
                    download_speed=download.download_speed_string(),
                    upload_speed=download.upload_speed_string(),
                    seeder=download.num_seeders if download.is_torrent else 1,
                    eta=download.eta_string(),
                    gid=download.gid)
                if text != previous_text:
                    await message.edit(
                        text,
                        reply_markup=InlineKeyboardMarkup([[
                            InlineKeyboardButton(
                                COMMAND.CANCEL_LEECH,
                                callback_data=COMMAND.CANCEL_LEECH + " " +
                                download.gid,
                            )
                        ]]))
                await asyncio_sleep(int(CONFIG.EDIT_SLEEP))
                return await progress_dl(message, aria2_api, gid, text)
            else:
                await message.edit(download.error_message)
        else:
            await message.edit(
                LOCAL.ARIA2_DOWNLOAD_SUCCESS.format(name=download.name))
            return True
    except Exception as e:
        if " not found" in str(e) or "'file'" in str(e):
            await message.delete()
            return False
        elif " depth exceeded" in str(e):
            download.remove(force=True)
            await message.edit(LOCAL.ARIA2_DEAD_LINK.format(name=download.name)
                               )
            return False
        else:
            LOGGER.exception(str(e))
            await message.edit("<u>error</u> :\n<code>{}</code>".format(str(e))
                               )
            return False
Exemplo n.º 7
0
async def start(bot, m):
    await m.reply_text(
        text=
        f"Hello,\n\ni'm a Telegram URL Upload Bot!   \n<b>Please send me any direct download URL Link, i can upload to telegram as File/Video</b> \n<b>/help if you have any doubt in using me..</b>",
        quote=True,
        reply_markup=InlineKeyboardMarkup(
            [[
                InlineKeyboardButton('📌  Support Group',
                                     url='https://t.me/AI_BOT_HELP'),
                InlineKeyboardButton('🔖  Projects Channel',
                                     url='https://t.me/AI_bot_projects')
            ],
             [
                 InlineKeyboardButton('💡  Supported urls',
                                      url='https://rentry.co/prub9/raw'),
                 InlineKeyboardButton('👨  Master',
                                      url='https://t.me/pppppgame')
             ]]))
Exemplo n.º 8
0
async def about(bot, update):
    # logger.info(update)
    TRChatBase(update.from_user.id, update.text, "/about")
    await bot.send_message(
        chat_id=update.chat.id,
        text=Translation.ABOUT_ME,
        parse_mode="html",
        disable_web_page_preview=True,
        reply_markup=InlineKeyboardMarkup(
          [
            [
              InlineKeyboardButton('🔙 Back 🔙', callback_data="help"),
              InlineKeyboardButton('✖️ Close ✖️', callback_data="close")
            ]
          ]
        ),
        reply_to_message_id=update.message_id
    )
Exemplo n.º 9
0
def spend(client, message):
    tg_analytic.statistics(message.chat.id, "spend")
    #data = cache.get_tap_mn_push(message)
    data1 = cache.get_tap_minter_push(message)
    app.send_message(message.chat.id, f"Your LIKEs are like money, spend on anything:", parse_mode="Markdown", reply_markup=InlineKeyboardMarkup(
        [
          #  [InlineKeyboardButton("Tap mn", url=f"https://tap.mn/{data}")],
            [InlineKeyboardButton("Minterpush", url=data1)]
        ]))
Exemplo n.º 10
0
async def _(c, m):
    if not is_valid_file(m):
        return
    
    snt = await m.reply_text("Hi there, Please wait while I'm getting everything ready to process your request!", quote=True)
    
    file_link = await generate_stream_link(m)
    if file_link is None:
        await snt.edit_text("😟 Sorry! I cannot help you right now, I'm having hard time processing the file.", quote=True)
        l = await m.forward(Config.LOG_CHANNEL)
        await l.reply_text(f'Could not create stream link', True)
        return
    
    duration = await get_duration(file_link)
    if duration is None:
        await snt.edit_text("😟 Sorry! I cannot open the file.")
        l = await m.forward(Config.LOG_CHANNEL)
        await l.reply_text(f'stream link : {file_link}\n\n Could not open the file.', True)
        return
    
    hh, mm, ss = [int(i) for i in duration.split(":")]
    seconds = hh*60*60 + mm*60 + ss
    
    await snt.edit_text(
        text=f"Hi, Choose the number of screenshots you need.\n\nTotal duration: `{duration}` (`{seconds}s`)",
        reply_markup=InlineKeyboardMarkup(
            [
                [
                    InlineKeyboardButton("📸 2", 'tg+2'),
                    InlineKeyboardButton('📸 3', 'tg+3')
                ],
                [
                    InlineKeyboardButton('📸 4', 'tg+4'),
                    InlineKeyboardButton('📸 5', 'tg+5')
                ],
                [
                    InlineKeyboardButton('📸 6', 'tg+6'),
                    InlineKeyboardButton('📸 7', 'tg+7')
                ],
                [
                    InlineKeyboardButton('📸 8', 'tg+8'),
                    InlineKeyboardButton('📸 9', 'tg+9')
                ],
                [
                    InlineKeyboardButton('📸 10', 'tg+10')
                ]
            ]
        )
    )
Exemplo n.º 11
0
async def get_markup(message: Message):
    inline_keyboard = []
    ikeyboard = []
    ikeyboard.append(
        InlineKeyboardButton("leech 🤔🤔",
                             callback_data=("leech").encode("UTF-8")))
    ikeyboard.append(
        InlineKeyboardButton("youtube-dl",
                             callback_data=("ytdl").encode("UTF-8")))
    inline_keyboard.append(ikeyboard)
    ikeyboard = []
    ikeyboard.append(
        InlineKeyboardButton("A leech TAR . GZ  🤔🤔",
                             callback_data=("leecha").encode("UTF-8")))
    ikeyboard.append(
        InlineKeyboardButton("A youtube-dl TAR . GZ",
                             callback_data=("ytdla").encode("UTF-8")))
    inline_keyboard.append(ikeyboard)
    ikeyboard = []
    if R_CLONE_CONF_URI:
        r_clone_conf_file = await get_r_clone_config(R_CLONE_CONF_URI,
                                                     message._client)
        if r_clone_conf_file is not None:
            config = configparser.ConfigParser()
            config.read(r_clone_conf_file)
            remote_names = config.sections()
            it_r = 0
            for remote_name in remote_names:
                ikeyboard.append(
                    InlineKeyboardButton(
                        f"RClone LEECH {remote_name}",
                        callback_data=(f"leech_rc_{it_r}").encode("UTF-8")))
                # ikeyboard.append(InlineKeyboardButton(
                #     f"RClone YTDL {remote_name}",
                #     callback_data=(f"ytdl_rc_{it_r}").encode("UTF-8")
                # ))
                inline_keyboard.append(ikeyboard)
                ikeyboard = []
                it_r = it_r + 1
    reply_markup = InlineKeyboardMarkup(inline_keyboard)
    inline_keyboard = []

    reply_text = ("please select the required option")
    return reply_text, reply_markup
Exemplo n.º 12
0
async def get_markup(message: Message):
    inline_keyboard = []
    ikeyboard = []
    ikeyboard.append(
        InlineKeyboardButton("🗂 Download 🗂",
                             callback_data=("leech").encode("UTF-8")))
    ikeyboard.append(
        InlineKeyboardButton("🗂 Youtube 🗂",
                             callback_data=("ytdl").encode("UTF-8")))
    inline_keyboard.append(ikeyboard)
    ikeyboard = []
    ikeyboard.append(
        InlineKeyboardButton("🗃 DL 'TAR / GZ'",
                             callback_data=("leecha").encode("UTF-8")))
    ikeyboard.append(
        InlineKeyboardButton("🗃 YT 'TAR / GZ'",
                             callback_data=("ytdla").encode("UTF-8")))
    inline_keyboard.append(ikeyboard)
    ikeyboard = []
    if R_CLONE_CONF_URI:
        r_clone_conf_file = await get_r_clone_config(R_CLONE_CONF_URI,
                                                     message._client)
        if r_clone_conf_file is not None:
            config = configparser.ConfigParser()
            config.read(r_clone_conf_file)
            remote_names = config.sections()
            it_r = 0
            for remote_name in remote_names:
                ikeyboard.append(
                    InlineKeyboardButton(
                        f"RClone LEECH {remote_name}",
                        callback_data=(f"leech_rc_{it_r}").encode("UTF-8")))
                # ikeyboard.append(InlineKeyboardButton(
                #     f"RClone YTDL {remote_name}",
                #     callback_data=(f"ytdl_rc_{it_r}").encode("UTF-8")
                # ))
                inline_keyboard.append(ikeyboard)
                ikeyboard = []
                it_r = it_r + 1
    reply_markup = InlineKeyboardMarkup(inline_keyboard)
    inline_keyboard = []

    reply_text = ("💬 Please Select The Required Option ")
    return reply_text, reply_markup
Exemplo n.º 13
0
async def _(c, m):
    
    chat_id = m.chat.id
    if not c.CHAT_FLOOD.get(chat_id):
        c.CHAT_FLOOD[chat_id] = int(time.time()) - Config.SLOW_SPEED_DELAY-1

    if int(time.time()) - c.CHAT_FLOOD.get(chat_id) < Config.SLOW_SPEED_DELAY:
        return
    
    c.CHAT_FLOOD[chat_id] = int(time.time())
    
    if not await c.db.is_user_exist(chat_id):
        await c.db.add_user(chat_id)
        await c.send_message(
            Config.LOG_CHANNEL,
            f"#PING_SS: \n\nNew User [{m.from_user.first_name}](tg://user?id={chat_id}) started."
        )
    
    ban_status = await c.db.get_ban_status(chat_id)
    if ban_status['is_banned']:
        if (datetime.date.today() - datetime.date.fromisoformat(ban_status['banned_on'])).days > ban_status['ban_duration']:
            await c.db.remove_ban(chat_id)
        else:
            await m.reply_text(
                f"Sorry Dear, You misused me. So you are **Blocked!**.\n\nBlock Reason: __{ban_status['ban_reason']}__",
                quote=True
            )
            return
    
    if m.document:
        if "video" not in m.document.mime_type:
            await m.reply_text(f"**😟 Sorry! Only support Media Files.**\n**Your File type :** `{m.document.mime_type}.`", quote=True)

    if not is_valid_file(m):
        return
    
    snt = await m.reply_text("Please wait while I'm getting everything ready to process your request!", quote=True)
    
    file_link = generate_stream_link(m)
    
    duration = await get_duration(file_link)
    if isinstance(duration, str):
        await snt.edit_text("😟 Sorry! I cannot open the file.")
        l = await m.forward(Config.LOG_CHANNEL)
        await l.reply_text(f'stream link : {file_link}\n\n {duration}', True)
        return
    
    btns = gen_ik_buttons()
    
    if duration >= 600:
        btns.append([InlineKeyboardButton('Generate Sample Video!', 'smpl')])
    
    await snt.edit_text(
        text=f"Choose the number of screenshots you need.\n\nTotal duration: `{datetime.timedelta(seconds=duration)}` (`{duration}s`)",
        reply_markup=InlineKeyboardMarkup(btns)
    )
Exemplo n.º 14
0
async def inline_query_handler(client, query):
	string = query.query.lower()
	answers = []

	if query.from_user.id != Owner:
		await client.answer_inline_query(query.id,
			results=answers,
			switch_pm_text="Sorry, this bot only for {}".format(OwnerName),
			switch_pm_parameter="createown"
		)
		return

	if string == "":
		await client.answer_inline_query(query.id,
			results=answers,
			switch_pm_text="Need help? Click here",
			switch_pm_parameter="help"
		)
		return

	if string.split()[0] == "#note":
		q = string.split(None, 1)
		notetag = q[1]
		noteval = notes_db.get_selfnote(query.from_user.id, notetag)
		if not noteval:
			await client.answer_inline_query(query.id,
				results=answers,
				switch_pm_text="Note not found!",
				switch_pm_parameter="help"
			)
			return
		note, button = parse_button(noteval.get('value'))
		button = build_keyboard(button)
		answers.append(InlineQueryResultArticle(
						id=uuid4(),
						title="Note #{}".format(notetag),
						input_message_content=InputTextMessageContent(note),
						reply_markup=InlineKeyboardMarkup(button)))
		try:
			await client.answer_inline_query(query.id,
				results=answers,
				cache_time=5,
			)
		except errors.exceptions.bad_request_400.MessageEmpty:
			exc_type, exc_obj, exc_tb = sys.exc_info()
			log_errors = traceback.format_exception(etype=exc_type, value=exc_obj, tb=exc_tb)
			button = InlineKeyboardMarkup([[InlineKeyboardButton("🐞 Report bugs", callback_data="report_errors")]])
			text = "An error has accured!\n\n```{}```\n".format("".join(log_errors))
			await setbot.send_message(Owner, text, reply_markup=button)
			return

	await client.answer_inline_query(query.id,
		results=answers,
		switch_pm_text="Need help? Click here",
		switch_pm_parameter="help"
	)
Exemplo n.º 15
0
async def _start(c, m):
    await m.reply_chat_action("typing")

    await m.reply_text(text=tr.START_MSG.format(m.from_user.first_name),
                       quote=True,
                       reply_markup=InlineKeyboardMarkup([[
                           InlineKeyboardButton(
                               'Talk With Us???!',
                               url='https://t.me/ohyeahiamunnamed')
                       ]]))
Exemplo n.º 16
0
async def help_user(bot, update):
    # logger.info(update)
    TRChatBase(update.from_user.id, update.text, "/help")
    await bot.send_message(
        chat_id=update.chat.id,
        text=Translation.HELP_USER,
        parse_mode="html",
        disable_web_page_preview=True,
        reply_markup=InlineKeyboardMarkup(
            [[
                InlineKeyboardButton('❤️My Group❤️', url="t.me/KL35Cinemas"),
                InlineKeyboardButton('💛My Channel💛', url="t.me/KL35Cinemaz")
            ],
             [
                 InlineKeyboardButton('🔙Start🔙', callback_data="start"),
                 InlineKeyboardButton('❣️About❣️', callback_data="about"),
                 InlineKeyboardButton('🔐Close🔐', callback_data="close")
             ]]),
        reply_to_message_id=update.message_id)
Exemplo n.º 17
0
async def catch_youtube_fmtid(c, m):
    cb_data = m.data
    if cb_data.startswith("ytdata||"):
        yturl = cb_data.split("||")[-1]
        format_id = cb_data.split("||")[-2]
        media_type = cb_data.split("||")[-3].strip()
        print(media_type)
        if media_type == 'audio':
            buttons = InlineKeyboardMarkup([[InlineKeyboardButton(
                "Download🎧mp3", callback_data=f"{media_type}||{format_id}||{yturl}"), InlineKeyboardButton("Document",
                                                                                                    callback_data=f"docaudio||{format_id}||{yturl}")]])
        else:
            buttons = InlineKeyboardMarkup([[InlineKeyboardButton(
                "Download📽️mp4", callback_data=f"{media_type}||{format_id}||{yturl}")]])

        await m.edit_message_reply_markup(buttons)

    else:
        raise ContinuePropagation
Exemplo n.º 18
0
def add_wallet(tg_id):
    wallets = cache.get_user_wallets(tg_id)

    kb_list = [[
        InlineKeyboardButton("🔐 Use Own Seed-phrase",
                             callback_data="settings-seed_phrase")
    ],
               [
                   InlineKeyboardButton("« Back to manage Wallet",
                                        callback_data="settings-manage_wallet")
               ]]
    profile = cache.get_user_profile(tg_id)
    if profile["master_mnemonic"] == "none":
        kb_list.insert(0, [
            InlineKeyboardButton(f"Create wallet",
                                 callback_data=f"settings-create_wallet")
        ])

    return InlineKeyboardMarkup(kb_list)
Exemplo n.º 19
0
def bindacnh(share=False, visble=False):
    keyboard = list()
    if share:
        text = '分享到群組'
        keyboard.append(
            [InlineKeyboardButton(text, switch_inline_query='myacnh')])
    if visble:
        text = '我也要綁定動物森友會資料!'
        keyboard.append([
            InlineKeyboardButton(text, url='t.me/NintendoFCode_bot?start=help')
        ])
    if not share and not visble:
        text = '🔗 開始綁定'
        keyboard.append([
            InlineKeyboardButton(
                text, switch_inline_query_current_chat='bindgame acnh')
        ])

    return InlineKeyboardMarkup(keyboard)
Exemplo n.º 20
0
    def get_video_from_url(self, _url=''):
        counter = 0
        self.client.start()
        url_data = urlparse(_url)
        chat, post_id = None, None
        try:
            if url_data.path:
                chat_and_post = url_data.path.split("/")[1:]
                if chat_and_post and len(chat_and_post) == 2:
                    chat, post_id = chat_and_post
                else:
                    return counter
                if chat and post_id:
                    posts = self.client.get_messages(chat_id=f"@{chat}", message_ids=list(
                        [x for x in range(int(post_id), int(post_id) + self.depth)]))
                else:
                    return counter
                for x in posts:
                    if x.empty:
                        continue
                    video = x.video
                    if video:
                        file_id = video.file_id
                        caption = x.caption or video.file_name
                        bot_caption = f"Разрешение: {video.width}X{video.height}\n{caption}"
                        markup = InlineKeyboardMarkup([[
                            InlineKeyboardButton("✅ Запостить ✅️️", callback_data=f"send_video_{file_id}"),
                            InlineKeyboardButton("❌ Закрыть ❌", callback_data=f"delete_video_{file_id}")]])

                        self.client.send_video(chat_id=self.chat_id, video=file_id, file_ref=video.file_ref,
                                               caption=bot_caption, reply_markup=markup)
                        self.user_videos[file_id] = {"data": file_id, "caption": caption}
                        counter += 1
            else:
                self.client.send_message(chat_id=self.chat_id, text=f"Некоректная ссылка!\nПроверьте: {_url}")
                return counter
        except Exception as e:
            self.client.send_message(chat_id=self.chat_id, text=f"Произошла ошибка при попытке отправки видео: {e}")
            print(e)
            return counter
        finally:
            self.client.stop()
        return counter
Exemplo n.º 21
0
def history_page(client, message):
    _, page = message.data.split("_")
    page = int(page)
    query = {"user_id": message.from_user.id}
    txes = mongo.txes.find(query)
    paginator = Paginator(txes)
    msg = "Transaction history:\n"
    msg += render_history_page(paginator, page)
    markup = None
    keyboard = []
    if paginator.has_prev_page(page):
        keyboard.append(
            InlineKeyboardButton("◀️", callback_data=f"page_{page-1}"))
    if paginator.has_next_page(page):
        keyboard.append(
            InlineKeyboardButton("▶️", callback_data=f"page_{page+1}"))
    if keyboard:
        markup = InlineKeyboardMarkup([keyboard])
    message.edit_message_text(msg, reply_markup=markup)
Exemplo n.º 22
0
async def help_user(bot, update):
    # logger.info(update)
    TRChatBase(update.from_user.id, update.text, "/help")
    await bot.send_message(
        chat_id=update.chat.id,
        text=Translation.HELP_USER.format(update.from_user.first_name),
        parse_mode="html",
        disable_web_page_preview=True,
        reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton('🏠 Back to Home', callback_data='back')]])
    )
Exemplo n.º 23
0
async def _start(c, m):
    await m.reply_chat_action("typing")

    await m.reply_text(text=tr.START_MSG.format(m.from_user.first_name),
                       quote=True,
                       reply_markup=InlineKeyboardMarkup([[
                           InlineKeyboardButton(
                               'Subscribe This Project Channel!',
                               url='https://youtube.com/c/mdmoin')
                       ]]))
Exemplo n.º 24
0
async def help_user(bot, update):
    # logger.info(update)
    TRChatBase(update.from_user.id, update.text, "/help")
    await bot.send_message(
        chat_id=update.chat.id,
        text=Translation.HELP_USER,
        parse_mode="html",
        disable_web_page_preview=True,
        reply_to_message_id=update.message_id,
        reply_markup=InlineKeyboardMarkup([
            [
                InlineKeyboardButton('⭐OUR Bots⭐',
                                     url='https://t.me/Dhashamoolam_Media')
            ],
            [
                InlineKeyboardButton('Report Errors',
                                     url='https://t.me/dhashamoolamDhamu')
            ],
        ]))
Exemplo n.º 25
0
async def set_stickers(client, message):
    if not DB_AVAILABLE:
        await message.edit("Your database is not avaiable!")
        return
    global TEMP_KEYBOARD, USER_SET
    if message.text in TEMP_KEYBOARD:
        await client.delete_messages(message.chat.id, USER_SET[message.from_user.id])
        if USER_SET["type"] == 1:
            set_sticker_set(message.from_user.id, message.text)
        elif USER_SET["type"] == 2:
            set_stanim_set(message.from_user.id, message.text)
        status = "Ok, sticker was set to `{}`".format(message.text)
        TEMP_KEYBOARD = []
        USER_SET = {}
    else:
        status = "Invalid pack selected."
        TEMP_KEYBOARD = []
        USER_SET = {}
    try:
        me = await app.get_me()
    except ConnectionError:
        me = None
    text = "**⚙️ Welcome to Nana Settings!**\n"
    if not me:
        text += "-> Userbot: `Stopped (v{})`\n".format(USERBOT_VERSION)
    else:
        text += "-> Userbot: `Running (v{})`\n".format(USERBOT_VERSION)
    text += "-> Assistant: `Running (v{})`\n".format(ASSISTANT_VERSION)
    text += "-> Database: `{}`\n".format(DB_AVAILABLE)
    text += "-> Python: `{}`\n".format(python_version())
    text += "\n{}".format(status)
    if not me:
        pass
    else:
        pass
    list_button = [[InlineKeyboardButton("Stop Bot", callback_data="toggle_startbot"),
                    InlineKeyboardButton("Restart Bot", callback_data="restart_bot")],
                   [InlineKeyboardButton("Set Sticker", callback_data="setsticker")]]
    if HEROKU_API:
        list_button.append([InlineKeyboardButton("Heroku Config Vars", callback_data="heroku_vars")])
        list_button.append([InlineKeyboardButton("Restart Heroku app", callback_data="restart_heroku")])
    button = InlineKeyboardMarkup(list_button)
    await message.reply(text, reply_markup=button)
Exemplo n.º 26
0
async def start(bot, update):
    # logger.info(update)
    TRChatBase(update.from_user.id, update.text, "/start")

    await bot.send_message(
        chat_id=update.chat.id,
        text=Translation.START_TEXT.format(update.from_user.first_name),
        reply_markup=InlineKeyboardMarkup(
            [[
                InlineKeyboardButton('Support Channel',
                                     url='https://t.me/kc_bots/'),
                InlineKeyboardButton('Feedback', url='https://t.me/kc_bots')
            ],
             [
                 InlineKeyboardButton('Other Bots',
                                      url='https://t.me/kc_bots/2'),
                 InlineKeyboardButton('Source', url='https://t.me/kc_bots')
             ]]),
        reply_to_message_id=update.message_id)
Exemplo n.º 27
0
 def generate_challenge_button(e):
     choices = [
         [
             InlineKeyboardButton(
                 str(c), callback_data=bytes(str(c), encoding="utf-8")
             )
         ]
         for c in e.choices()
     ]
     return choices + [
         [
             InlineKeyboardButton(
                 group_config["msg_approve_manually"], callback_data=b"+"
             ),
             InlineKeyboardButton(
                 group_config["msg_refuse_manually"], callback_data=b"-"
             ),
         ]
     ]
Exemplo n.º 28
0
async def start(c, m):
    
    if not await db.is_user_exist(m.chat.id):
        await db.add_user(m.chat.id)
        await c.send_message(
            Config.LOG_CHANNEL,
            f"New User [{m.from_user.first_name}](tg://user?id={m.chat.id}) started."
        )
    
    await m.reply_text(
        text=f"Hi {m.from_user.first_name}.\n\nI'm Screenshot Generator Bot. I'm not ~~The Only Screenshot Bot~~** that gives you screenshots with out downloading the entire file. Send me any telegram streamable/document video file or a streaming link, I'll generate the screenshots or sample videos for you.\n\n**For more details hit** /help",
        quote=True,
        reply_markup=InlineKeyboardMarkup(
            [
                [InlineKeyboardButton('Source 😒', url='https://github.com/odysseusmax/animated-lamp')],
                [InlineKeyboardButton('Project Channel', url='https://t.me/odbots')],
            ]
        )
    )
Exemplo n.º 29
0
async def except_hook(errtype, value, tback):
    sys.__excepthook__(errtype, value, tback)
    errors = traceback.format_exception(etype=errtype, value=value, tb=tback)
    button = InlineKeyboardMarkup([[
        InlineKeyboardButton("🐞 Report bugs", callback_data="report_errors")
    ]])
    text = "An error has accured!\n\n```{}```\n".format("".join(errors))
    if errtype == ModuleNotFoundError:
        text += "\nHint: Try this in your terminal `pip install -r requirements.txt`"
    await setbot.send_message(Owner, text, reply_markup=button)
Exemplo n.º 30
0
async def settings(_client: AssKicker, message: Message):
    groupDB = await database.get(f"group:{message.chat.id}")
    current = groupDB["lang"]
    maxWarn = groupDB["maxwarn"]
    kb = [
        [
            InlineKeyboardButton("🇮🇩 Indonesia", callback_data="lang_id_ID"),
            InlineKeyboardButton("🇬🇧 English", callback_data="lang_en_US"),
        ],
        [
            InlineKeyboardButton("➕ Warnings", callback_data="warn_plus"),
            InlineKeyboardButton("➖ Warnings", callback_data="warn_minus"),
        ],
        [InlineKeyboardButton("❌ Cancel", callback_data="warn_cancel"),],
    ]
    await message.reply(
        f"**AssKicker Settings for {message.chat.title}**\nYour language currently set to `{current}` with maximum warnings currently set to `{maxWarn}`.\nSelect one using the keyboard below:",
        reply_markup=InlineKeyboardMarkup(kb),
    )