Exemple #1
0
SAFEMODE_HANDLER = CommandHandler("safemode",
                                  safemode,
                                  pass_args=True,
                                  filters=Filters.group)
DEL_JOINED = CommandHandler("rmjoin",
                            del_joined,
                            pass_args=True,
                            filters=Filters.group)
WELCOME_HELP = CommandHandler("welcomehelp", welcome_help)
BUTTON_VERIFY_HANDLER = CallbackQueryHandler(user_button,
                                             pattern=r"userverify_")
SETCAS_HANDLER = CommandHandler("setcas", setcas, filters=Filters.group)
GETCAS_HANDLER = CommandHandler("getcas",
                                get_current_setting,
                                filters=Filters.group)
GETVER_HANDLER = DisableAbleCommandHandler("casver", get_version)
CASCHECK_HANDLER = CommandHandler("cascheck", caschecker, pass_args=True)
CASQUERY_HANDLER = CommandHandler("casquery",
                                  casquery,
                                  pass_args=True,
                                  filters=CustomFilters.sudo_filter)
SETBAN_HANDLER = CommandHandler("setban", setban, filters=Filters.group)
GBANCHAT_HANDLER = CommandHandler("blchat",
                                  gbanChat,
                                  pass_args=True,
                                  filters=CustomFilters.sudo_filter)
UNGBANCHAT_HANDLER = CommandHandler("unblchat",
                                    ungbanChat,
                                    pass_args=True,
                                    filters=CustomFilters.sudo_filter)
DEFENSE_HANDLER = CommandHandler("setdefense", setDefense, pass_args=True)
Exemple #2
0
@run_async
def pingall(update: Update, context: CallbackContext):
    to_ping = ["Kaizoku", "Kayo", "Telegram", "Jikan"]
    pinged_list = ping_func(to_ping)
    pinged_list.insert(2, '')
    uptime = get_readable_time((time.time() - StartTime))

    reply_msg = "⏱Ping results are:\n"
    reply_msg += "\n".join(pinged_list)
    reply_msg += '\n<b>Service uptime:</b> <code>{}</code>'.format(uptime)

    update.effective_message.reply_text(
        reply_msg, parse_mode=ParseMode.HTML, disable_web_page_preview=True)


__help__ = """
 • `/ping`*:* get ping time of bot to telegram server
 • `/pingall`*:* get all listed ping time
"""

PING_HANDLER = DisableAbleCommandHandler("ping", ping)
PINGALL_HANDLER = DisableAbleCommandHandler("pingall", pingall)

dispatcher.add_handler(PING_HANDLER)
dispatcher.add_handler(PINGALL_HANDLER)

__mod_name__ = "Ping"
__command_list__ = ["ping", "pingall"]
__handlers__ = [PING_HANDLER, PINGALL_HANDLER]
Exemple #3
0
def delsticker(update: Update, context: CallbackContext):
    msg = update.effective_message
    if not msg.reply_to_message.sticker:
        update.effective_message.reply_text("This only works on sticker baka.")
        return
    try: 
        context.bot.delete_sticker_from_set(msg.reply_to_message.sticker.file_id)
    except: 
        update.effective_message.reply_text("This only works on stickers that I have kanged.")
    else: 
        update.effective_message.reply_text("I have deleted that sticker for you, now say thanks.")


__help__ = """
• `/stickerid`*:* reply to a sticker to me to tell you its file ID.
• `/getsticker`*:* reply to a sticker to me to upload its raw PNG file.
• `/kang` or `/steal`*:* reply to a sticker to add it to your pack.
• `/delsticker`*:* delete sticker from the pack.
"""

__mod_name__ = "Stickers"
STICKERID_HANDLER = DisableAbleCommandHandler("stickerid", stickerid)
GETSTICKER_HANDLER = DisableAbleCommandHandler("getsticker", getsticker)
KANG_HANDLER = DisableAbleCommandHandler(["kang","steal", "addsticker"], kang, admin_ok=True)
DELSTICKER_HANDLER = DisableAbleCommandHandler("delsticker", delsticker)

dispatcher.add_handler(STICKERID_HANDLER)
dispatcher.add_handler(GETSTICKER_HANDLER)
dispatcher.add_handler(KANG_HANDLER)
dispatcher.add_handler(DELSTICKER_HANDLER)
Exemple #4
0
*NOTE:* In groups, only admins can add/remove RSS links to the group's subscription

"""
job = updater.job_queue

job_rss_set = job.run_once(rss_set, 5)
job_rss_update = job.run_repeating(rss_update, interval=60, first=60)
job_rss_set.enabled = True
job_rss_update.enabled = True

SHOW_URL_HANDLER = CommandHandler("rss", show_url)
ADD_URL_HANDLER = CommandHandler("addrss", add_url)
REMOVE_URL_HANDLER = CommandHandler("removerss", remove_url)
LIST_URLS_HANDLER = CommandHandler("listrss", list_urls)
ID_HANDLER = DisableAbleCommandHandler("id", get_id)
TTS_HANDLER = DisableAbleCommandHandler("tts", tts, pass_args=True)
GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid)
INFO_HANDLER = DisableAbleCommandHandler(["info"], info)
UD_HANDLER = DisableAbleCommandHandler(["ud"], ud)
LYRICS_HANDLER = DisableAbleCommandHandler("lyrics", lyrics, pass_args=True)
TIME_HANDLER = DisableAbleCommandHandler("time", gettime)
TRANSLATE_HANDLER = DisableAbleCommandHandler(["tr", "tl"], totranslate)
PASTE_HANDLER = DisableAbleCommandHandler("paste", paste)

ECHO_HANDLER = DisableAbleCommandHandler("echo", echo, filters=Filters.group)
WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify)
MD_HELP_HANDLER = CommandHandler(
    "markdownhelp", markdown_help, filters=Filters.private)
PAT_HANDLER = DisableAbleCommandHandler("pat", pat)
WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki)
Exemple #5
0
            "administrator", "creator"))


__help__ = """
 • `/adminlist`or `/admins`*:* list of admins in the chat

*Admins only:*
 • `/pin`*:* silently pins the message replied to - add `'loud'` or `'notify'` to give notifs to users.
 • `/unpin`*:* unpins the currently pinned message
 • `/invitelink`*:* gets invitelink
 • `/promote`*:* promotes the user replied to
 • `/demote`*:* demotes the user replied to
 • `/settitle`*:* sets a custom title for an admin that the bot promoted
"""

ADMINLIST_HANDLER = DisableAbleCommandHandler(["adminlist", "admins"],
                                              adminlist)

PIN_HANDLER = CommandHandler("pin", pin, filters=Filters.group)
UNPIN_HANDLER = CommandHandler("unpin", unpin, filters=Filters.group)

INVITE_HANDLER = DisableAbleCommandHandler("invitelink",
                                           invite,
                                           filters=Filters.group)

PROMOTE_HANDLER = DisableAbleCommandHandler("promote", promote)
DEMOTE_HANDLER = DisableAbleCommandHandler("demote", demote)

SET_TITLE_HANDLER = CommandHandler("settitle", set_title)

dispatcher.add_handler(ADMINLIST_HANDLER)
dispatcher.add_handler(PIN_HANDLER)
Exemple #6
0
__help__ = """
Get information about anime, manga or characters from [AniList](anilist.co).

*Available commands:*

 • `/anime <anime>`*:* returns information about the anime.
 • `/character <character>`*:* returns information about the character.
 • `/manga <manga>`*:* returns information about the manga.
 • `/user <user>`*:* returns information about a MyAnimeList user.
 • `/upcoming`*:* returns a list of new anime in the upcoming seasons.
 • `/airing <anime>`*:* returns anime airing info.

 """

ANIME_HANDLER = DisableAbleCommandHandler("anime", anime)
AIRING_HANDLER = DisableAbleCommandHandler("airing", airing)
CHARACTER_HANDLER = DisableAbleCommandHandler("character", character)
MANGA_HANDLER = DisableAbleCommandHandler("manga", manga)
USER_HANDLER = DisableAbleCommandHandler("user", user)
UPCOMING_HANDLER = DisableAbleCommandHandler("upcoming", upcoming)
BUTTON_HANDLER = CallbackQueryHandler(button, pattern='anime_.*')

dispatcher.add_handler(BUTTON_HANDLER)
dispatcher.add_handler(ANIME_HANDLER)
dispatcher.add_handler(CHARACTER_HANDLER)
dispatcher.add_handler(MANGA_HANDLER)
dispatcher.add_handler(AIRING_HANDLER)
dispatcher.add_handler(USER_HANDLER)
dispatcher.add_handler(UPCOMING_HANDLER)
Exemple #7
0
Blacklists are used to stop certain triggers from being said in a group. Any time the trigger is mentioned, \
the message will immediately be deleted. A good combo is sometimes to pair this up with warn filters!

*NOTE:* blacklists do not affect group admins.

 • `/blacklist`*:* View the current blacklisted words.

*Admins only:*
 • `/addblacklist <triggers>`*:* Add a trigger to the blacklist. Each line is considered one trigger, so using different \
lines will allow you to add multiple triggers.
 • `/unblacklist <triggers>`*:* Remove triggers from the blacklist. Same newline logic applies here, so you can remove \
multiple triggers at once.
 • `/rmblacklist <triggers>`*:* Same as above.
"""

BLACKLIST_HANDLER = DisableAbleCommandHandler("blacklist", blacklist)
ADD_BLACKLIST_HANDLER = CommandHandler("addblacklist", add_blacklist)
UNBLACKLIST_HANDLER = CommandHandler(["unblacklist", "rmblacklist"],
                                     unblacklist)
BLACKLIST_DEL_HANDLER = MessageHandler(
    (Filters.text | Filters.command | Filters.sticker | Filters.photo)
    & Filters.group,
    del_blacklist,
    allow_edit=True)
dispatcher.add_handler(BLACKLIST_HANDLER)
dispatcher.add_handler(ADD_BLACKLIST_HANDLER)
dispatcher.add_handler(UNBLACKLIST_HANDLER)
dispatcher.add_handler(BLACKLIST_DEL_HANDLER, group=BLACKLIST_GROUP)

__mod_name__ = "Blacklist Word"
__handlers__ = [
Exemple #8
0
from Megumi import dispatcher
from Megumi.modules.disable import DisableAbleCommandHandler
from telegram import ParseMode, Update
from telegram.ext import CallbackContext, run_async


@run_async
def ud(update: Update, context: CallbackContext):
    message = update.effective_message
    text = message.text[len('/ud '):]
    results = requests.get(
        f'https://api.urbandictionary.com/v0/define?term={text}').json()
    try:
        reply_text = f'ℹ️ *{text}*\n\n👉🏻 {results["list"][0]["definition"]}\n\n📌 _{results["list"][0]["example"]}_'
    except:
        reply_text = "No results found."
    message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN)


__help__ = """
 • `/ud <word>`*:* Type the word or expression you want to search use.
"""

UD_HANDLER = DisableAbleCommandHandler(["ud"], ud)

dispatcher.add_handler(UD_HANDLER)

__mod_name__ = "Urban dictionary"
__command_list__ = ["ud"]
__handlers__ = [UD_HANDLER]
Exemple #9
0
        term = query.replace(" ", "%20")
        json_rep = r.get(
            f"https://wall.alphacoders.com/api2.0/get.php?auth={WALL_API}&method=search&term={term}"
        ).json()
        if not json_rep.get("success"):
            msg.reply_text(f"An error occurred! Report this {SUPPORT_CHAT}")
        else:
            wallpapers = json_rep.get("wallpapers")
            if not wallpapers:
                msg.reply_text("No results found! Refine your search.")
                return
            else:
                index = randint(0, len(wallpapers) - 1)  # Choose random index
                wallpaper = wallpapers[index]
                wallpaper = wallpaper.get("url_image")
                wallpaper = wallpaper.replace("\\", "")
                bot.send_photo(chat_id,
                               photo=wallpaper,
                               caption='Preview',
                               reply_to_message_id=msg_id,
                               timeout=60)
                bot.send_document(chat_id,
                                  document=wallpaper,
                                  filename='wallpaper',
                                  reply_to_message_id=msg_id,
                                  timeout=60)


WALLPAPER_HANDLER = DisableAbleCommandHandler("wall", wall)
dispatcher.add_handler(WALLPAPER_HANDLER)
Exemple #10
0
EDIT_SLEEP = 2
#edit how many times in 'police'
EDIT_TIMES = 3

POLICE_SIREN = [
    "🔴🔴🔴⬜️⬜️⬜️🔵🔵🔵\n🔴🔴🔴⬜️⬜️⬜️🔵🔵🔵\n🔴🔴🔴⬜️⬜️⬜️🔵🔵🔵",
    "🔵🔵🔵⬜️⬜️⬜️🔴🔴🔴\n🔵🔵🔵⬜️⬜️⬜️🔴🔴🔴\n🔵🔵🔵⬜️⬜️⬜️🔴🔴🔴"
]


@user_admin
@run_async
def police(update: Update, context: CallbackContext):
    msg = update.effective_message.reply_text('Police is coming!')
    for x in range(EDIT_TIMES):
        msg.edit_text(POLICE_SIREN[x % 2])
        time.sleep(EDIT_SLEEP)
    msg.edit_text('Police is here!')


__help__ = """
• `/police`*:* Sends a police emoji animation. 
"""

POLICE_HANDLER = DisableAbleCommandHandler("police", police)
dispatcher.add_handler(POLICE_HANDLER)

__mod_name__ = "Animation"
__command_list__ = ["police"]
__handlers__ = [POLICE_HANDLER]
Exemple #11
0
    "ヽ(>∀<☆)ノ", "\( ̄▽ ̄)/", "(o˘◡˘o)", "(╯✧▽✧)╯", "( ‾́ ◡ ‾́ )", "(๑˘︶˘๑)",
    "(´・ᴗ・ ` )", "( ͡° ʖ̯ ͡°)", "( ఠ ͟ʖ ఠ)", "( ಥ ʖ̯ ಥ)", "(≖ ͜ʖ≖)", "ヘ( ̄ω ̄ヘ)",
    "(ノ≧∀≦)ノ", "└( ̄- ̄└))", "┌(^^)┘", "(^_^♪)", "(〜 ̄△ ̄)〜", "(「• ω •)「",
    "( ˘ ɜ˘) ♬♪♫", "( o˘◡˘o) ┌iii┐", "♨o(>_<)o♨", "( ・・)つ―{}@{}@{}-",
    "(*´з`)口゚。゚口(・∀・ )", "( *^^)o∀*∀o(^^* )", "-●●●-c(・・ )", "(ノ≧∀≦)ノ ‥…━━━★",
    "╰( ͡° ͜ʖ ͡° )つ──☆*:・゚", "(∩ᄑ_ᄑ)⊃━☆゚*・。*・:≡( ε:)"
]


@run_async
def react(update: Update, context: CallbackContext):
    message = update.effective_message
    react = random.choice(reactions)
    if message.reply_to_message:
        message.reply_to_message.reply_text(react)
    else:
        message.reply_text(react)


__help__ = """
 • `/react`*:* Reacts with a random reaction
"""

REACT_HANDLER = DisableAbleCommandHandler("react", react)

dispatcher.add_handler(REACT_HANDLER)

__mod_name__ = "React"
__command_list__ = ["react"]
__handlers__ = [REACT_HANDLER]
Exemple #12
0
    if args:
        string = '  '.join(args).lower()

    if not string:
        message.reply_text("Usage is `/weebify <text>`",
                           parse_mode=ParseMode.MARKDOWN)
        return

    for normiecharacter in string:
        if normiecharacter in normiefont:
            weebycharacter = weebyfont[normiefont.index(normiecharacter)]
            string = string.replace(normiecharacter, weebycharacter)

    if message.reply_to_message:
        message.reply_to_message.reply_text(string)
    else:
        message.reply_text(string)


__help__ = """
 • `/weebify <text>`*:* returns a weebified text
 """

WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify)

dispatcher.add_handler(WEEBIFY_HANDLER)

__mod_name__ = "Weebify"
__command_list__ = ["weebify"]
__handlers__ = [WEEBIFY_HANDLER]
Exemple #13
0
        speed.download()
        speed.upload()
        replymsg = 'SpeedTest Results:'

        if query.data == 'speedtest_image':
            speedtest_image = speed.results.share()
            update.effective_message.reply_photo(photo=speedtest_image,
                                                 caption=replymsg)
            msg.delete()

        elif query.data == 'speedtest_text':
            result = speed.results.dict()
            replymsg += f"\nDownload: `{convert(result['download'])}Mb/s`\nUpload: `{convert(result['upload'])}Mb/s`\nPing: `{result['ping']}`"
            update.effective_message.edit_text(replymsg,
                                               parse_mode=ParseMode.MARKDOWN)
    else:
        query.answer(
            "You are required to join Heroes Association to use this command.")


SPEED_TEST_HANDLER = DisableAbleCommandHandler("speedtest", speedtestxyz)
SPEED_TEST_CALLBACKHANDLER = CallbackQueryHandler(speedtestxyz_callback,
                                                  pattern='speedtest_.*')

dispatcher.add_handler(SPEED_TEST_HANDLER)
dispatcher.add_handler(SPEED_TEST_CALLBACKHANDLER)

__mod_name__ = "SpeedTest"
__command_list__ = ["speedtest"]
__handlers__ = [SPEED_TEST_HANDLER, SPEED_TEST_CALLBACKHANDLER]
Exemple #14
0
    elif bio:
        return f"<b>What others say:</b>\n{bio}\n"
    elif me:
        return f"<b>About user:</b>\n{me}"
    else:
        return ""


__help__ = """
 • `/setbio <text>`*:* while replying, will save another user's bio
 • `/bio`*:* will get your or another user's bio. This cannot be set by yourself.
 • `/setme <text>`*:* will set your info
 • `/me`*:* will get your or another user's info
"""

SET_BIO_HANDLER = DisableAbleCommandHandler("setbio", set_about_bio)
GET_BIO_HANDLER = DisableAbleCommandHandler("bio", about_bio)

SET_ABOUT_HANDLER = DisableAbleCommandHandler("setme", set_about_me)
GET_ABOUT_HANDLER = DisableAbleCommandHandler("me", about_me)

dispatcher.add_handler(SET_BIO_HANDLER)
dispatcher.add_handler(GET_BIO_HANDLER)
dispatcher.add_handler(SET_ABOUT_HANDLER)
dispatcher.add_handler(GET_ABOUT_HANDLER)

__mod_name__ = "Bios and Abouts"
__command_list__ = ["setbio", "bio", "setme", "me"]
__handlers__ = [
    SET_BIO_HANDLER, GET_BIO_HANDLER, SET_ABOUT_HANDLER, GET_ABOUT_HANDLER
]
Exemple #15
0
        user = sql.check_afk_status(user_id)
        if user.reason:
            text += "\nReason: <code>{}</code>".format(html.escape(
                user.reason))
    else:
        text = text.format("No")
    return text


__help__ = """
 • `/afk <reason>`*:* mark yourself as AFK(away from keyboard).
 • `brb <reason>`*:* same as the afk command - but not a command.
When marked as AFK, any mentions will be replied to with a message to say you're not available!
"""

AFK_HANDLER = DisableAbleCommandHandler("afk", afk)
AFK_REGEX_HANDLER = MessageHandler(Filters.regex(r"(?i)brb"),
                                   afk,
                                   friendly="afk")
NO_AFK_HANDLER = MessageHandler(Filters.all & Filters.group, no_longer_afk)
AFK_REPLY_HANDLER = MessageHandler(
    Filters.all & Filters.group &
    (~Filters.regex(r"^#[^\s]+") & ~Filters.regex(r"^!")
     & ~Filters.regex(r"^\/")), reply_afk)

dispatcher.add_handler(AFK_HANDLER, AFK_GROUP)
dispatcher.add_handler(AFK_REGEX_HANDLER, AFK_GROUP)
dispatcher.add_handler(NO_AFK_HANDLER, AFK_GROUP)
dispatcher.add_handler(AFK_REPLY_HANDLER, AFK_REPLY_GROUP)

__mod_name__ = "AFK"
Exemple #16
0
 • `/ud <word>`*:* Type the word or expression you want to search use.
 • `/info`*:* get information about a user.
 • `/wiki <query>`*:* wiki your query.
 • `/markdownhelp`*:* quick summary of how markdown works in telegram - can only be called in private chats.
 • `/tr` or `/tl` (language code) as reply to a long message.
*Example:* `/tr en`*:* translates something to english. 
   `/tr hi-en`*:* translates hindi to english.
• `/cash`*:* currency converter

 *Example syntax:*
 `/cash 1 USD INR`  _OR_   `/cash 1 usd inr`

 *Output:* `1.0 USD = 75.505 INR`

"""
ID_HANDLER = DisableAbleCommandHandler("id", get_id)
GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid)
INFO_HANDLER = DisableAbleCommandHandler(["info"], info)
UD_HANDLER = DisableAbleCommandHandler(["ud"], ud)
ECHO_HANDLER = DisableAbleCommandHandler("echo", echo, filters=Filters.group)
WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify)
MD_HELP_HANDLER = CommandHandler("markdownhelp",
                                 markdown_help,
                                 filters=Filters.private)
PAT_HANDLER = DisableAbleCommandHandler("pat", pat)
TRANSLATE_HANDLER = DisableAbleCommandHandler(["tr", "tl"], totranslate)
WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki)
CONVERTER_HANDLER = CommandHandler('cash', convert)
SNIPE_HANDLER = CommandHandler("snipe",
                               snipe,
                               pass_args=True,
Exemple #17
0
__help__ = """
 • `/runs`*:* reply a random string from an array of replies.
 • `/slap`*:* slap a user, or get slapped if not a reply.
 • `/shrug`*:* get shrug XD.
 • `/table`*:* get flip/unflip :v.
 • `/decide`*:* Randomly answers yes/no/maybe
 • `/toss`*:* Tosses A coin
 • `/bluetext`*:* check urself :V
 • `/insults`*:* reply a random insult from an array of replies.
 • `/roll`*:* Roll a dice.
 • `/shout <keyword>`*:* write anything you want to give loud shout.
 • `/rlg`*:* Join ears,nose,mouth and create an emo ;-;
"""

RUNS_HANDLER = DisableAbleCommandHandler("runs", runs)
INSULTS_HANDLER = DisableAbleCommandHandler("insults", insults)
SLAP_HANDLER = DisableAbleCommandHandler("slap", slap)
SHOUT_HANDLER = DisableAbleCommandHandler("shout", shout)
ROLL_HANDLER = DisableAbleCommandHandler("roll", roll)
TOSS_HANDLER = DisableAbleCommandHandler("toss", toss)
SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug)
BLUETEXT_HANDLER = DisableAbleCommandHandler("bluetext", bluetext)
RLG_HANDLER = DisableAbleCommandHandler("rlg", rlg)
DECIDE_HANDLER = DisableAbleCommandHandler("decide", decide)
TABLE_HANDLER = DisableAbleCommandHandler("table", table)

dispatcher.add_handler(RUNS_HANDLER)
dispatcher.add_handler(INSULTS_HANDLER)
dispatcher.add_handler(SLAP_HANDLER)
dispatcher.add_handler(ROLL_HANDLER)
Exemple #18
0
 • `/pat`*:* give a headpat :)
 • `/weebify <text>`*:* returns a weebified text.
 • `/ud <word>`*:* Type the word or expression you want to search use.
 • `/info`*:* get information about a user.
 • `/paste`*:* Do a paste at `neko.bin`
 • `/wiki <query>`*:* wiki your query.
 • `/markdownhelp`*:* quick summary of how markdown works in telegram - can only be called in private chats.
 • `/cash`*:* currency converter

 *Example syntax:*
 `/cash 1 USD INR`  _OR_   `/cash 1 usd inr`

 *Output:* `1.0 USD = 75.505 INR`

"""
ID_HANDLER = DisableAbleCommandHandler("id", get_id)
GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid)
INFO_HANDLER = DisableAbleCommandHandler(["info"], info)
UD_HANDLER = DisableAbleCommandHandler(["ud"], ud)
PASTE_HANDLER = DisableAbleCommandHandler("paste", paste)
ECHO_HANDLER = DisableAbleCommandHandler("echo", echo, filters=Filters.group)
WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify)
MD_HELP_HANDLER = CommandHandler("markdownhelp",
                                 markdown_help,
                                 filters=Filters.private)
PAT_HANDLER = DisableAbleCommandHandler("pat", pat)
WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki)
CONVERTER_HANDLER = CommandHandler('cash', convert)
SNIPE_HANDLER = CommandHandler("snipe",
                               snipe,
                               pass_args=True,
Exemple #19
0
 • `/locks`*:* The current list of locks in this chat.
 
Locks can be used to restrict a group's users.
eg:
Locking urls will auto-delete all messages with urls, locking stickers will restrict all \
non-admin users from sending stickers, etc.
Locking bots will stop non-admins from adding bots to the chat.

Note:
 • Unlocking permission *info* will allow members (non-admins) to change the group information, such as the description or the group name
 • Unlocking permission *pin* will allow members (non-admins) to pinned a message in a group
"""

__mod_name__ = "Locks"

LOCKTYPES_HANDLER = DisableAbleCommandHandler("locktypes", locktypes)
LOCK_HANDLER = CommandHandler("lock", lock,
                              pass_args=True)  # , filters=Filters.group)
UNLOCK_HANDLER = CommandHandler("unlock", unlock,
                                pass_args=True)  # , filters=Filters.group)
LOCKED_HANDLER = CommandHandler("locks",
                                list_locks)  # , filters=Filters.group)

dispatcher.add_handler(LOCK_HANDLER)
dispatcher.add_handler(UNLOCK_HANDLER)
dispatcher.add_handler(LOCKTYPES_HANDLER)
dispatcher.add_handler(LOCKED_HANDLER)

dispatcher.add_handler(
    MessageHandler(Filters.all & Filters.group, del_lockables), PERM_GROUP)
Exemple #20
0
def scam(imgspage, lim):
    """Parse/Scrape the HTML code for the info we want."""

    single = opener.open(imgspage).read()
    decoded = single.decode('utf-8')
    if int(lim) > 10:
        lim = 10

    imglinks = []
    counter = 0

    pattern = r'^,\[\"(.*[.png|.jpg|.jpeg])\",[0-9]+,[0-9]+\]$'
    oboi = re.findall(pattern, decoded, re.I | re.M)

    for imglink in oboi:
        counter += 1
        imglinks.append(imglink)
        if counter >= int(lim):
            break

    return imglinks


REVERSE_HANDLER = DisableAbleCommandHandler("reverse",
                                            reverse,
                                            pass_args=True,
                                            admin_ok=True)

dispatcher.add_handler(REVERSE_HANDLER)
Exemple #21
0
 • `/resetwarn <userhandle>`*:* reset the warns for a user. Can also be used as a reply.
 • `/addwarn <keyword> <reply message>`*:* set a warning filter on a certain keyword. If you want your keyword to \
be a sentence, encompass it with quotes, as such: `/addwarn "very angry" This is an angry user`. 
 • `/nowarn <keyword>`*:* stop a warning filter
 • `/warnlimit <num>`*:* set the warning limit
 • `/strongwarn <on/yes/off/no>`*:* If set to on, exceeding the warn limit will result in a ban. Else, will just kick.
"""

__mod_name__ = "Warnings"

WARN_HANDLER = CommandHandler("warn", warn_user, filters=Filters.group)
RESET_WARN_HANDLER = CommandHandler(["resetwarn", "resetwarns"],
                                    reset_warns,
                                    filters=Filters.group)
CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"rm_warn")
MYWARNS_HANDLER = DisableAbleCommandHandler(
    "warns", warns, filters=Filters.group)
ADD_WARN_HANDLER = CommandHandler(
    "addwarn", add_warn_filter, filters=Filters.group)
RM_WARN_HANDLER = CommandHandler(["nowarn", "stopwarn"],
                                 remove_warn_filter,
                                 filters=Filters.group)
LIST_WARN_HANDLER = DisableAbleCommandHandler(["warnlist", "warnfilters"],
                                              list_warn_filters,
                                              filters=Filters.group,
                                              admin_ok=True)
WARN_FILTER_HANDLER = MessageHandler(CustomFilters.has_text & Filters.group,
                                     reply_filter)
WARN_LIMIT_HANDLER = CommandHandler(
    "warnlimit", set_warn_limit, filters=Filters.group)
WARN_STRENGTH_HANDLER = CommandHandler(
    "strongwarn", set_warn_strength, filters=Filters.group)
Exemple #22
0
        start_time = time.time()
        site_to_ping = sites_list[each_ping]
        r = requests.get(site_to_ping)
        end_time = time.time()
        ping_time = str(round((end_time - start_time), 2)) + "s"

    return ping_result


@run_async
def ping(update: Update, context: CallbackContext):
    telegram_ping = ping_func(["Telegram"])[0].split(": ", 1)[1]
    uptime = get_readable_time((time.time() - StartTime))

    reply_msg = ("PONG!!\n"
                 "<b>Time Taken:</b> <code>{}</code>\n"
                 "<b>Service uptime:</b> <code>{}</code>".format(
                     telegram_ping, uptime))

    update.effective_message.reply_text(reply_msg, parse_mode=ParseMode.HTML)


PING_HANDLER = DisableAbleCommandHandler("ping", ping)

dispatcher.add_handler(PING_HANDLER)

__mod_name__ = "Ping"
__command_list__ = ["ping"]
__handlers__ = [PING_HANDLER]
Exemple #23
0
    else:
        result = generate_time(query_timezone, ["zoneName", "countryName"])

    if not result:
        send_message.edit_text(
            f'Timezone info not available for <b>{query}</b>\n'
            '<b>All Timezones:</b> <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">List here</a>',
            parse_mode=ParseMode.HTML,
            disable_web_page_preview=True)
        return

    send_message.edit_text(result,
                           parse_mode=ParseMode.HTML,
                           disable_web_page_preview=True)


__help__ = """
 • `/time <query>`*:* Gives information about a timezone.

*Available queries:* Country Code/Country Name/Timezone Name
• 🕐 [Timezones list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
"""

TIME_HANDLER = DisableAbleCommandHandler("time", gettime)

dispatcher.add_handler(TIME_HANDLER)

__mod_name__ = "Time"
__command_list__ = ["time"]
__handlers__ = [TIME_HANDLER]
Exemple #24
0
 • `/notes` or `/saved`*:* list all saved notes in this chat

If you would like to retrieve the contents of a note without any formatting, use `/get <notename> noformat`. This can \
be useful when updating a current note.

*Admins only:*
 • `/save <notename> <notedata>`*:* saves notedata as a note with name notename
A button can be added to a note by using standard markdown link syntax - the link should just be prepended with a \
`buttonurl:` section, as such: `[somelink](buttonurl:example.com)`. Check `/markdownhelp` for more info.
 • `/save <notename>`*:* save the replied message as a note with name notename
 • `/clear <notename>`*:* clear note with this name
 *Note:* Note names are case-insensitive, and they are automatically converted to lowercase before getting saved.
"""

__mod_name__ = "Notes"

GET_HANDLER = CommandHandler("get", cmd_get)
HASH_GET_HANDLER = MessageHandler(Filters.regex(r"^#[^\s]+"), hash_get)
SAVE_HANDLER = CommandHandler("save", save)
DELETE_HANDLER = CommandHandler("clear", clear)

LIST_HANDLER = DisableAbleCommandHandler(["notes", "saved"],
                                         list_notes,
                                         admin_ok=True)

dispatcher.add_handler(GET_HANDLER)
dispatcher.add_handler(SAVE_HANDLER)
dispatcher.add_handler(LIST_HANDLER)
dispatcher.add_handler(DELETE_HANDLER)
dispatcher.add_handler(HASH_GET_HANDLER)
Exemple #25
0
Blacklist sticker is used to stop certain stickers. Whenever a sticker is sent, the message will be deleted immediately.
*NOTE:* Blacklist stickers do not affect the group admin.
 • `/blsticker`*:* See current blacklisted sticker.
*Only admin:*
 • `/addblsticker <sticker link>`*:* Add the sticker trigger to the black list. Can be added via reply sticker.
 • `/unblsticker <sticker link>`*:* Remove triggers from blacklist. The same newline logic applies here, so you can delete multiple triggers at once.
 • `/rmblsticker <sticker link>`*:* Same as above.
 • `/blstickermode <ban/tban/mute/tmute>`*:* sets up a default action on what to do if users use blacklisted stickers. (`tmute seems broken right now`)
Note:
 • `<sticker link>` can be `https://t.me/addstickers/<sticker>` or just `<sticker>` or reply to the sticker message.
"""

__mod_name__ = "S Blacklist"

BLACKLIST_STICKER_HANDLER = DisableAbleCommandHandler("blsticker",
                                                      blackliststicker,
                                                      admin_ok=True)
ADDBLACKLIST_STICKER_HANDLER = DisableAbleCommandHandler(
    "addblsticker", add_blackliststicker)
UNBLACKLIST_STICKER_HANDLER = CommandHandler(["unblsticker", "rmblsticker"],
                                             unblackliststicker)
BLACKLISTMODE_HANDLER = CommandHandler("blstickermode", blacklist_mode)
BLACKLIST_STICKER_DEL_HANDLER = MessageHandler(Filters.sticker & Filters.group,
                                               del_blackliststicker)

dispatcher.add_handler(BLACKLIST_STICKER_HANDLER)
dispatcher.add_handler(ADDBLACKLIST_STICKER_HANDLER)
dispatcher.add_handler(UNBLACKLIST_STICKER_HANDLER)
dispatcher.add_handler(BLACKLISTMODE_HANDLER)
dispatcher.add_handler(BLACKLIST_STICKER_DEL_HANDLER)
Exemple #26
0
__help__ = """
 • `/kickme`*:* punchs the user who issued the command

*Admins only:*
 • `/ban <userhandle>`*:* bans a user. (via handle, or reply)
 • `/tban <userhandle> x(m/h/d)`*:* bans a user for `x` time. (via handle, or reply). `m` = `minutes`, `h` = `hours`, `d` = `days`.
 • `/unban <userhandle>`*:* unbans a user. (via handle, or reply)
 • `/kick <userhandle>`*:* Kicks a user out of the group, (via handle, or reply)
"""

BAN_HANDLER = CommandHandler("ban", ban)
TEMPBAN_HANDLER = CommandHandler(["tban"], temp_ban)
KICK_HANDLER = CommandHandler("kick", kick)
UNBAN_HANDLER = CommandHandler("unban", unban)
ROAR_HANDLER = CommandHandler("roar", selfunban)
KICKME_HANDLER = DisableAbleCommandHandler(
    "kickme", kickme, filters=Filters.group)

dispatcher.add_handler(BAN_HANDLER)
dispatcher.add_handler(TEMPBAN_HANDLER)
dispatcher.add_handler(KICK_HANDLER)
dispatcher.add_handler(UNBAN_HANDLER)
dispatcher.add_handler(ROAR_HANDLER)
dispatcher.add_handler(KICKME_HANDLER)

__mod_name__ = "Bans"
__handlers__ = [
    BAN_HANDLER, TEMPBAN_HANDLER, KICK_HANDLER, UNBAN_HANDLER, ROAR_HANDLER,
    KICKME_HANDLER
]
Exemple #27
0
                        source_lang, dest_lang, tekstr.text),
                    parse_mode=ParseMode.MARKDOWN)

    except IndexError:
        update.effective_message.reply_text(
            "Reply to messages or write messages from other languages ​​for translating into the intended language\n\n"
            "Example: `/tr en-ml` to translate from English to Malayalam\n"
            "Or use: `/tr ml` for automatic detection and translating it into Malayalam.\n"
            "See [List of Language Codes](t.me/OnePunchSupport/12823) for a list of language codes.",
            parse_mode="markdown",
            disable_web_page_preview=True)
    except ValueError:
        update.effective_message.reply_text(
            "The intended language is not found!")
    else:
        return


__help__ = """
• `/tr` or `/tl` (language code) as reply to a long message.
*Example:* `/tr en`*:* translates something to english. 
         `/tr hi-en`*:* translates hindi to english.
"""

TRANSLATE_HANDLER = DisableAbleCommandHandler(["tr", "tl"], totranslate)

dispatcher.add_handler(TRANSLATE_HANDLER)

__mod_name__ = "Translator"
__command_list__ = ["tr", "tl"]
__handlers__ = [TRANSLATE_HANDLER]
Exemple #28
0
 • `/filters`*:* list all active filters in this chat.
*Admins only:*
 • `/filter <keyword> <reply message>`*:* adds a filter to this chat. The bot will now reply that message whenever 'keyword'\
 is mentioned. If you reply to a sticker with a keyword, the bot will reply with that sticker. \
If you want your keyword to be a sentence, use quotes. 
*Example:* `/filter "hey there" How you doin?`
 • `/stop <filter keyword>`*:* stop that filter.
 • `/stopall`*:* remove all chat filters at once, this cannot be undone. `(chat creator only)`
*Note*: Filters also support markdown formatters like: `{first}`, `{last}` etc.. and buttons.
Check `/markdownhelp` to know more!
"""

FILTER_HANDLER = CommandHandler("filter", filters)
STOP_HANDLER = CommandHandler("stop", stop_filter)
LIST_HANDLER = DisableAbleCommandHandler("filters",
                                         list_handlers,
                                         admin_ok=True)
REMOVEALLFILTER_HANDLER = CommandHandler("stopall",
                                         stopall,
                                         filters=Filters.group)
STOPALL_CALLBACK_HANDLER = CallbackQueryHandler(stopall_button, pattern=r"f_")
CUST_FILTER_HANDLER = MessageHandler(CustomFilters.has_text, reply_filter)

dispatcher.add_handler(FILTER_HANDLER)
dispatcher.add_handler(STOP_HANDLER)
dispatcher.add_handler(LIST_HANDLER)
dispatcher.add_handler(REMOVEALLFILTER_HANDLER)
dispatcher.add_handler(CUST_FILTER_HANDLER, HANDLER_GROUP)
dispatcher.add_handler(STOPALL_CALLBACK_HANDLER)

__mod_name__ = "Filters"
Exemple #29
0
                % packname,
                parse_mode=ParseMode.MARKDOWN,
            )
        return

    if success:
        msg.reply_text(
            "Sticker pack successfully created. Get it [here](t.me/addstickers/%s)"
            % packname,
            parse_mode=ParseMode.MARKDOWN,
        )
    else:
        msg.reply_text(
            "Failed to create sticker pack. Possibly due to blek mejik.")


__help__ = """
• `/stickerid`*:* reply to a sticker to me to tell you its file ID.
• `/getsticker`*:* reply to a sticker to me to upload its raw PNG file.
• `/kang`*:* reply to a sticker to add it to your pack.
"""

__mod_name__ = "Stickers"
STICKERID_HANDLER = DisableAbleCommandHandler("stickerid", stickerid)
GETSTICKER_HANDLER = DisableAbleCommandHandler("getsticker", getsticker)
KANG_HANDLER = DisableAbleCommandHandler("kang", kang, admin_ok=True)

dispatcher.add_handler(STICKERID_HANDLER)
dispatcher.add_handler(GETSTICKER_HANDLER)
dispatcher.add_handler(KANG_HANDLER)
Exemple #30
0
 • `/punchme`*:* punchs the user who issued the command

*Admins only:*
 • `/ban <userhandle>`*:* bans a user. (via handle, or reply)
 • `/tban <userhandle> x(m/h/d)`*:* bans a user for `x` time. (via handle, or reply). `m` = `minutes`, `h` = `hours`, `d` = `days`.
 • `/unban <userhandle>`*:* unbans a user. (via handle, or reply)
 • `/punch <userhandle>`*:* Punches a user out of the group, (via handle, or reply)
"""

BAN_HANDLER = CommandHandler("ban", ban)
TEMPBAN_HANDLER = CommandHandler(["tban"], temp_ban)
PUNCH_HANDLER = CommandHandler("punch", punch)
UNBAN_HANDLER = CommandHandler("unban", unban)
ROAR_HANDLER = CommandHandler("roar", selfunban)
PUNCHME_HANDLER = DisableAbleCommandHandler("punchme",
                                            punchme,
                                            filters=Filters.group)

dispatcher.add_handler(BAN_HANDLER)
dispatcher.add_handler(TEMPBAN_HANDLER)
dispatcher.add_handler(PUNCH_HANDLER)
dispatcher.add_handler(UNBAN_HANDLER)
dispatcher.add_handler(ROAR_HANDLER)
dispatcher.add_handler(PUNCHME_HANDLER)

__mod_name__ = "Bans"
__handlers__ = [
    BAN_HANDLER, TEMPBAN_HANDLER, PUNCH_HANDLER, UNBAN_HANDLER, ROAR_HANDLER,
    PUNCHME_HANDLER
]