Beispiel #1
0
 • `/ud <word>`*:* type the word or expression you want to search use\n
*Wikipedia:*
 • `/wiki <query>`*:* wikipedia your query\n
*Wallpapers:*
 • `/wall <query>`*:* get a wallpaper from wall.alphacoders.com\n
*Currency converter:* 
 • `/cash`*:* currency converter
Example:
 `/cash 1 USD INR`  
      _OR_
 `/cash 1 usd inr`
Output: `1.0 USD = 75.505 INR`\n
*Timezones:*
 • `/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)
"""

ECHO_HANDLER = DisableAbleCommandHandler("echo", echo, filters=Filters.chat_type.groups, run_async=True)
MD_HELP_HANDLER = CommandHandler("markdownhelp", markdown_help, run_async=True)

dispatcher.add_handler(ECHO_HANDLER)
dispatcher.add_handler(MD_HELP_HANDLER)

__mod_name__ = "Extras"
__command_list__ = ["id", "echo", "covid", "weather", "quotly"]
__handlers__ = [
    ECHO_HANDLER,
    MD_HELP_HANDLER,
]
Beispiel #2
0
        deletion(update, context, delmsg)
    except ValueError:
        delmsg = update.effective_message.reply_text("The intended language is not found!")
        deletion(update, context, delmsg)
    else:
        return


def deletion(update: Update, context: CallbackContext, delmsg):
    chat = update.effective_chat
    cleartime = get_clearcmd(chat.id, "tr")

    if cleartime:
        context.dispatcher.run_async(delete, delmsg, cleartime.time)


__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, run_async=True)

dispatcher.add_handler(TRANSLATE_HANDLER)

__mod_name__ = "Translator"
__command_list__ = ["tr", "tl"]
__handlers__ = [TRANSLATE_HANDLER]
Beispiel #3
0
    "(〜 ̄△ ̄)〜",
    "(「• ω •)「",
    "( ˘ ɜ˘) ♬♪♫",
    "( o˘◡˘o) ┌iii┐",
    "♨o(>_<)o♨",
    "( ・・)つ―{}@{}@{}-",
    "(*´з`)口゚。゚口(・∀・ )",
    "( *^^)o∀*∀o(^^* )",
    "-●●●-c(・・ )",
    "(ノ≧∀≦)ノ ‥…━━━★",
    "╰( ͡° ͜ʖ ͡° )つ──☆*:・゚",
    "(∩ᄑ_ᄑ)⊃━☆゚*・。*・:≡( ε:)",
]


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)


REACT_HANDLER = DisableAbleCommandHandler("react", react, run_async=True)

dispatcher.add_handler(REACT_HANDLER)

__command_list__ = ["react"]
__handlers__ = [REACT_HANDLER]
Beispiel #4
0
__help__ = """
Sometimes, you might trust a user not to send unwanted content.
Maybe not enough to make them admin, but you might be ok with locks, blacklists, and antiflood not applying to them.

That's what approvals are for - approve of trustworthy users to allow them to send 

*Admin commands:*
- `/approval`*:* Check a user's approval status in this chat.
- `/approve`*:* Approve of a user. Locks, blacklists, and antiflood won't apply to them anymore.
- `/unapprove`*:* Unapprove of a user. They will now be subject to locks, blacklists, and antiflood again.
- `/approved`*:* List all approved users.
- `/unapproveall`*:* Unapprove *ALL* users in a chat. This cannot be undone.
"""

APPROVE = DisableAbleCommandHandler("approve", approve, run_async=True)
DISAPPROVE = DisableAbleCommandHandler("unapprove", disapprove, run_async=True)
APPROVED = DisableAbleCommandHandler("approved", approved, run_async=True)
APPROVAL = DisableAbleCommandHandler("approval", approval, run_async=True)
UNAPPROVEALL = DisableAbleCommandHandler("unapproveall",
                                         unapproveall,
                                         run_async=True)
UNAPPROVEALL_BTN = CallbackQueryHandler(unapproveall_btn,
                                        pattern=r"unapproveall_.*",
                                        run_async=True)

dispatcher.add_handler(APPROVE)
dispatcher.add_handler(DISAPPROVE)
dispatcher.add_handler(APPROVED)
dispatcher.add_handler(APPROVAL)
dispatcher.add_handler(UNAPPROVEALL)
Beispiel #5
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 punch.
"""

__mod_name__ = "Warnings"

WARN_HANDLER = CommandHandler(["warn", "dwarn"], warn_user, filters=Filters.chat_type.groups, run_async=True)
RESET_WARN_HANDLER = CommandHandler(
    ["resetwarn", "resetwarns"], reset_warns, filters=Filters.chat_type.groups, run_async=True
)
CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"rm_warn")
MYWARNS_HANDLER = DisableAbleCommandHandler("warns", warns, filters=Filters.chat_type.groups, run_async=True)
ADD_WARN_HANDLER = CommandHandler("addwarn", add_warn_filter, filters=Filters.chat_type.groups, run_async=True)
RM_WARN_HANDLER = CommandHandler(
    ["nowarn", "stopwarn"], remove_warn_filter, filters=Filters.chat_type.groups
)
LIST_WARN_HANDLER = DisableAbleCommandHandler(
    ["warnlist", "warnfilters"], list_warn_filters, filters=Filters.chat_type.groups, admin_ok=True, run_async=True
)
WARN_FILTER_HANDLER = MessageHandler(
    CustomFilters.has_text & Filters.chat_type.groups, reply_filter, run_async=True
)
WARN_LIMIT_HANDLER = CommandHandler("warnlimit", set_warn_limit, filters=Filters.chat_type.groups, run_async=True)
WARN_STRENGTH_HANDLER = CommandHandler(
    "strongwarn", set_warn_strength, filters=Filters.chat_type.groups, run_async=True
)
Beispiel #6
0
                        filename=f.name,
                        reply_to_message_id=update.message.message_id,
                        chat_id=update.effective_chat.id,
                        parse_mode=ParseMode.HTML,
                    )

                    try:
                        for f in glob.glob("result.txt"):
                            os.remove(f)
                    except Exception:
                        pass

    else:
        msg = 'Give me something to get from Wikipedia, like:\n`/wiki Madrid`'

    delmsg = message.reply_text(
        text = msg,
        parse_mode = ParseMode.MARKDOWN,
        disable_web_page_preview = True,
    )

    cleartime = get_clearcmd(chat.id, "wiki")

    if cleartime:
        context.dispatcher.run_async(delete, delmsg, cleartime.time)



WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki, run_async=True)
dispatcher.add_handler(WIKI_HANDLER)
Beispiel #7
0
 
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,
                                              run_async=True)
LOCK_HANDLER = CommandHandler(
    "lock", lock)  # , filters=Filters.chat_type.groups, run_async=True)
UNLOCK_HANDLER = CommandHandler(
    "unlock", unlock, run_async=True)  # , filters=Filters.chat_type.groups)
LOCKED_HANDLER = CommandHandler(
    "locks", list_locks)  # , filters=Filters.chat_type.groups, run_async=True)

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.chat_type.groups, del_lockables),
Beispiel #8
0
            result = speed.results.dict()
            msg += f"\nDownload: `{convert(result['download'])}Mb/s`\nUpload: `{convert(result['upload'])}Mb/s`\nPing: `{result['ping']}`"
            delmsg = message.reply_text(
                text = msg,
                parse_mode = ParseMode.MARKDOWN,
                disable_web_page_preview = True,
            )

        cleartime = get_clearcmd(chat.id, "speedtest")

        if cleartime:
            context.dispatcher.run_async(delete, delmsg, cleartime.time)

    else:
        query.answer("You are required to be a developer user to use this command.")

IP_HANDLER = DisableAbleCommandHandler("ip", get_bot_ip, run_async=True)
PING_HANDLER = DisableAbleCommandHandler("ping", ping, run_async=True)
SHELL_HANDLER = DisableAbleCommandHandler(["sh"], shell, run_async=True)
SPEED_TEST_CALLBACKHANDLER = CallbackQueryHandler(speedtestxyz_callback, pattern="speedtest_.*", run_async=True)
SPEED_TEST_HANDLER = DisableAbleCommandHandler("speedtest", speedtestxyz, run_async=True)
STATUS_HANDLER = DisableAbleCommandHandler("status", status, run_async=True)
  
dispatcher.add_handler(IP_HANDLER)
dispatcher.add_handler(PING_HANDLER)
dispatcher.add_handler(SHELL_HANDLER)
dispatcher.add_handler(SPEED_TEST_CALLBACKHANDLER)
dispatcher.add_handler(SPEED_TEST_HANDLER)
dispatcher.add_handler(STATUS_HANDLER)

Beispiel #9
0
        with open("k.mp3", "rb") as f:
            linelist = list(f)
            linecount = len(linelist)
        if linecount == 1:
            update.message.chat.send_action(ChatAction.RECORD_AUDIO)
            lang = "en"
            tts = gTTS(delmsg, lang)
            tts.save("k.mp3")
        with open("k.mp3", "rb") as speech:
            delmsg = update.message.reply_voice(speech, quote=False)

        os.remove("k.mp3")

    else:
        delmsg = message.reply_text(
        "Reply a message or give something like:\n`/tts <message>`",
        parse_mode = ParseMode.MARKDOWN
        )

    cleartime = get_clearcmd(chat.id, "tts")

    if cleartime:
        context.dispatcher.run_async(delete, delmsg, cleartime.time)



TTS_HANDLER = DisableAbleCommandHandler("tts", tts, run_async=True)
dispatcher.add_handler(TTS_HANDLER)

__handlers__ = [TTS_HANDLER]
Beispiel #10
0
            else:
                index = randint(0, len(wallpapers) - 1)  # Choose random index
                wallpaper = wallpapers[index]
                wallpaper = wallpaper.get("url_image")
                wallpaper = wallpaper.replace("\\", "")
                delmsg_preview = bot.send_photo(
                    chat_id,
                    photo=wallpaper,
                    caption="Preview",
                    reply_to_message_id=msg_id,
                    timeout=60,
                )
                delmsg = bot.send_document(
                    chat_id,
                    document=wallpaper,
                    filename="wallpaper",
                    caption=caption,
                    reply_to_message_id=msg_id,
                    timeout=60,
                )

    cleartime = get_clearcmd(chat_id, "wall")

    if cleartime:
        context.dispatcher.run_async(delete, delmsg_preview, cleartime.time)
        context.dispatcher.run_async(delete, delmsg, cleartime.time)


WALLPAPER_HANDLER = DisableAbleCommandHandler("wall", wall, run_async=True)
dispatcher.add_handler(WALLPAPER_HANDLER)
Beispiel #11
0
                             (0, 0, 0))
        addedimg.paste(image, [0, 0])
        addedimg.paste(tracking, [x, 0])
        addedimg.paste(value, [x + tracking.size[0], 0])
        image = addedimg
        x = x + value.size[0] + tracking.size[0]

    maxsize = 1024, 896
    if image.size[0] > maxsize[0]:
        image.thumbnail(maxsize, Image.ANTIALIAS)

    # put processed image in a buffer and then upload cause async
    with BytesIO() as buffer:
        buffer.name = "image.png"
        image.save(buffer, "PNG")
        buffer.seek(0)
        delmsg = context.bot.send_sticker(chat_id=message.chat_id,
                                          sticker=buffer)

    cleartime = get_clearcmd(chat.id, "fun")

    if cleartime:
        context.dispatcher.run_async(delete, delmsg, cleartime.time)


PLET_HANDLER = DisableAbleCommandHandler("plet", plet, run_async=True)

dispatcher.add_handler(PLET_HANDLER)

__handlers__ = [PLET_HANDLER]
Beispiel #12
0
from AnnaBot import dispatcher
from AnnaBot.modules.disable import DisableAbleCommandHandler
from telegram import Update
from telegram.ext import CallbackContext, run_async


def shout(update: Update, context: CallbackContext):
    args = context.args
    text = " ".join(args)
    result = []
    result.append(" ".join([s for s in text]))
    for pos, symbol in enumerate(text[1:]):
        result.append(symbol + " " + "  " * pos + symbol)
    result = list("\n".join(result))
    result[0] = text[0]
    result = "".join(result)
    msg = "```\n" + result + "```"
    return update.effective_message.reply_text(msg, parse_mode="MARKDOWN")


SHOUT_HANDLER = DisableAbleCommandHandler("shout", shout, run_async=True)

dispatcher.add_handler(SHOUT_HANDLER)

__command_list__ = ["shout"]
__handlers__ = [SHOUT_HANDLER]
Beispiel #13
0
"""

__mod_name__ = "Notes"

GET_HANDLER = CommandHandler("get", cmd_get, run_async=True)
HASH_GET_HANDLER = MessageHandler(Filters.regex(r"^#[^\s]+"),
                                  hash_get,
                                  run_async=True)
SLASH_GET_HANDLER = MessageHandler(Filters.regex(r"^/\d+$"),
                                   slash_get,
                                   run_async=True)
SAVE_HANDLER = CommandHandler("save", save, run_async=True)
DELETE_HANDLER = CommandHandler("clear", clear, run_async=True)

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

CLEARALL = DisableAbleCommandHandler("removeallnotes",
                                     clearall,
                                     run_async=True)
CLEARALL_BTN = CallbackQueryHandler(clearall_btn,
                                    pattern=r"notes_.*",
                                    run_async=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)
dispatcher.add_handler(SLASH_GET_HANDLER)
Beispiel #14
0
                    delmsg = message.edit_text(
                        "Video is too large for processing, or any other error happened. Try again later"
                    )
            else:
                delmsg = message.edit_text(
                    "Video is too large for processing. Duration is limited to 10 minutes max"
                )
    else:
        delmsg = message.edit_text("Canceling...")
        context.dispatcher.run_async(delete, delmsg, 1)

    try:
        os.remove(f"{rip_data['title']}.{codec}")
    except Exception:
        pass

    cleartime = get_clearcmd(chat.id, "youtube")

    if cleartime:
        context.dispatcher.run_async(delete, delmsg, cleartime.time)


YOUTUBE_HANDLER = DisableAbleCommandHandler(["youtube", "yt"],
                                            youtube,
                                            run_async=True)
YOUTUBE_CALLBACKHANDLER = CallbackQueryHandler(youtube_callback,
                                               pattern="youtube*",
                                               run_async=True)
dispatcher.add_handler(YOUTUBE_HANDLER)
dispatcher.add_handler(YOUTUBE_CALLBACKHANDLER)
Beispiel #15
0
 • `/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
 • `/link`*:* same as invitelink
 • `/promote`*:* promotes the user replied to
 • `/demote`*:* demotes the user replied to
 • `/title <title here>`*:* sets a custom title for an admin that the bot promoted
 • `/admincache`*:* force refresh the admins list
 • `/zombies`*:* scan and clean zombies
"""

ADMINLIST_HANDLER = DisableAbleCommandHandler("admins",
                                              adminlist,
                                              run_async=True)

PIN_HANDLER = CommandHandler("pin",
                             pin,
                             filters=Filters.chat_type.groups,
                             run_async=True)
UNPIN_HANDLER = CommandHandler("unpin",
                               unpin,
                               filters=Filters.chat_type.groups,
                               run_async=True)

INVITE_HANDLER = DisableAbleCommandHandler(["invitelink", "link"],
                                           invite,
                                           run_async=True)
Beispiel #16
0
from AnnaBot.modules.sql.clear_cmd_sql import get_clearcmd
from telegram import ParseMode, Update
from telegram.ext import CallbackContext, run_async


def ud(update: Update, context: CallbackContext):
    message = update.effective_message
    chat = update.effective_chat
    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."
    delmsg = message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN)

    cleartime = get_clearcmd(chat.id, "ud")

    if cleartime:
        context.dispatcher.run_async(delete, delmsg, cleartime.time)


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

dispatcher.add_handler(UD_HANDLER)

__command_list__ = ["ud"]
__handlers__ = [UD_HANDLER]
Beispiel #17
0
"""

__mod_name__ = "Filters"

FILTER_HANDLER = CommandHandler("filter", filters)
STOP_HANDLER = CommandHandler("stop", stop_filter)
RMALLFILTER_HANDLER = CommandHandler("removeallfilters",
                                     rmall_filters,
                                     filters=Filters.chat_type.groups,
                                     run_async=True)
RMALLFILTER_CALLBACK = CallbackQueryHandler(rmall_callback,
                                            pattern=r"filters_.*",
                                            run_async=True)
LIST_HANDLER = DisableAbleCommandHandler("filters",
                                         list_handlers,
                                         admin_ok=True,
                                         run_async=True)
CUST_FILTER_HANDLER = MessageHandler(CustomFilters.has_text
                                     & ~Filters.update.edited_message,
                                     reply_filter,
                                     run_async=True)

dispatcher.add_handler(FILTER_HANDLER)
dispatcher.add_handler(STOP_HANDLER)
dispatcher.add_handler(LIST_HANDLER)
dispatcher.add_handler(CUST_FILTER_HANDLER, HANDLER_GROUP)
dispatcher.add_handler(RMALLFILTER_HANDLER)
dispatcher.add_handler(RMALLFILTER_CALLBACK)

__handlers__ = [
    FILTER_HANDLER,
Beispiel #18
0
        result = generate_time(query_timezone, ["countryCode"])
    else:
        result = generate_time(query_timezone, ["zoneName", "countryName"])

    if not result:
        delmsg = 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

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

    cleartime = get_clearcmd(chat.id, "time")

    if cleartime:
        context.dispatcher.run_async(delete, delmsg, cleartime.time)


TIME_HANDLER = DisableAbleCommandHandler("time", gettime, run_async=True)

dispatcher.add_handler(TIME_HANDLER)

__mod_name__ = "Time"
__command_list__ = ["time"]
__handlers__ = [TIME_HANDLER]
Beispiel #19
0
        )
    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.
• `/stickers`*:* Find stickers for given term on combot sticker catalogue
"""

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

dispatcher.add_handler(STICKERS_HANDLER)
dispatcher.add_handler(STICKERID_HANDLER)
dispatcher.add_handler(GETSTICKER_HANDLER)
dispatcher.add_handler(KANG_HANDLER)
Beispiel #20
0
    string = ""

    if message.reply_to_message:
        string = message.reply_to_message.text.lower().replace(" ", "  ")

    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)


WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify, run_async=True)

dispatcher.add_handler(WEEBIFY_HANDLER)

__command_list__ = ["weebify"]
__handlers__ = [WEEBIFY_HANDLER]
Beispiel #21
0
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.
 • `/kaizoku <anime>`*:* search an anime on animekaizoku.com
 • `/kayo <anime>`*:* search an anime on animekayo.com
 • `/airing <anime>`*:* returns anime airing info.

 """

ANIME_HANDLER = DisableAbleCommandHandler("anime", anime, run_async=True)
AIRING_HANDLER = DisableAbleCommandHandler("airing", airing, run_async=True)
CHARACTER_HANDLER = DisableAbleCommandHandler("character", character, run_async=True)
MANGA_HANDLER = DisableAbleCommandHandler("manga", manga, run_async=True)
USER_HANDLER = DisableAbleCommandHandler("user", user, run_async=True)
UPCOMING_HANDLER = DisableAbleCommandHandler("upcoming", upcoming, run_async=True)
KAIZOKU_SEARCH_HANDLER = DisableAbleCommandHandler("kaizoku", kaizoku, run_async=True)
KAYO_SEARCH_HANDLER = DisableAbleCommandHandler("kayo", kayo, run_async=True)

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(KAIZOKU_SEARCH_HANDLER)
dispatcher.add_handler(KAYO_SEARCH_HANDLER)
Beispiel #22
0
        song = Song.find_song(query)
        if song:
            if song.lyrics:
                msg = song.format()
            else:
                msg = "Couldn't find any lyrics for that song!"
        else:
            msg = "Song not found!"
        if len(msg) > 4090:
            with open("lyrics.txt", "w") as f:
                msg = f.write(f"{reply}\n\n\nOwO UwU OmO")
            with open("lyrics.txt", "rb") as f:
                msg = "Message length exceeded max limit! Sending as a text file."
    else:
        msg = "You haven't specified which song to look for!"

    delmsg = message.reply_text(
        text = msg,
        disable_web_page_preview = True,
    )

    cleartime = get_clearcmd(chat.id, "lyrics")

    if cleartime:
        context.dispatcher.run_async(delete, delmsg, cleartime.time)


LYRICS_HANDLER = DisableAbleCommandHandler("lyrics", lyrics, run_async=True)

dispatcher.add_handler(LYRICS_HANDLER)
Beispiel #23
0
*Information others add on you:* 
 • `/bio`*:* will get your or another user's bio. This cannot be set by yourself.
• `/setbio <text>`*:* while replying, will save another user's bio 
Examples:
 `/bio @username(defaults to yours if not specified).`
 `/setbio This user is a wolf` (reply to the user)

*Overall Information about you:*
 • `/info`*:* get information about a user.

*Guide to the General Data Protection Regulation (GDPR):*
 • `/gdpr`*:* deletes your information from the bot's database. Private chats only.
"""

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

STATS_HANDLER = CommandHandler("stats", stats, run_async=True)
ID_HANDLER = DisableAbleCommandHandler("id", get_id, run_async=True)
GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid, run_async=True)
INFO_HANDLER = DisableAbleCommandHandler(("info", "book"),
                                         info,
                                         run_async=True)
GDPR_HANDLER = CommandHandler("gdpr",
                              gdpr,
                              filters=Filters.chat_type.private,
                              run_async=True)

SET_ABOUT_HANDLER = DisableAbleCommandHandler("setme",
Beispiel #24
0
 • `/git <user>/<repo>`: will fetch the most recent release from that repo.
 • `/git <user>/<repo> <number>`: will fetch releases in past.
 • `/fetch <reponame> or &reponame`: same as `/git`, but you can use a saved repo shortcut
 • `/listrepo`: lists all repo shortcuts in chat
 • `/gitver`: returns the current API version
 • `/changelog <reponame>`: gets the changelog of a saved repo shortcut
 
*Admin only:*
 • `/saverepo <name> <user>/<repo> <number (optional)>`: saves a repo value as shortcut
 • `/delrepo <name>`: deletes a repo shortcut
"""

__mod_name__ = "GitHub"

RELEASE_HANDLER = DisableAbleCommandHandler("git",
                                            getRelease,
                                            admin_ok=True,
                                            run_async=True)
FETCH_HANDLER = DisableAbleCommandHandler("fetch",
                                          cmdFetch,
                                          admin_ok=True,
                                          run_async=True)
SAVEREPO_HANDLER = CommandHandler("saverepo", saveRepo, run_async=True)
DELREPO_HANDLER = CommandHandler("delrepo", delRepo, run_async=True)
LISTREPO_HANDLER = DisableAbleCommandHandler("listrepo",
                                             listRepo,
                                             admin_ok=True,
                                             run_async=True)
VERCHECKER_HANDLER = DisableAbleCommandHandler("gitver",
                                               getVer,
                                               admin_ok=True,
                                               run_async=True)
Beispiel #25
0
        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


def deletion(update: Update, context: CallbackContext, delmsg):
    chat = update.effective_chat
    cleartime = get_clearcmd(chat.id, "reverse")

    if cleartime:
        context.dispatcher.run_async(delete, delmsg, cleartime.time)


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

dispatcher.add_handler(REVERSE_HANDLER)
Beispiel #26
0
        if cleartime:
            context.dispatcher.run_async(delete, delmsg, cleartime.time)


def __gdpr__(user_id):
    sql.rm_afk(user_id)


__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, run_async=True)
AFK_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^(?i)brb(.*)$"),
                                              afk,
                                              friendly="afk")
NO_AFK_HANDLER = MessageHandler(Filters.all & Filters.chat_type.groups,
                                no_longer_afk,
                                run_async=True)
AFK_REPLY_HANDLER = MessageHandler(Filters.all & Filters.chat_type.groups,
                                   reply_afk,
                                   run_async=True)

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)
Beispiel #27
0

def __chat_settings__(chat_id, user_id):
    blacklisted = sql.num_stickers_chat_filters(chat_id)
    return "There are `{} `blacklisted stickers.".format(blacklisted)


def __stats__():
    return "• {} blacklist stickers, across {} chats.".format(
        sql.num_stickers_filters(), sql.num_stickers_filter_chats())


__mod_name__ = "Stickers Blacklist"

BLACKLIST_STICKER_HANDLER = DisableAbleCommandHandler("blsticker",
                                                      blackliststicker,
                                                      admin_ok=True,
                                                      run_async=True)
ADDBLACKLIST_STICKER_HANDLER = DisableAbleCommandHandler("addblsticker",
                                                         add_blackliststicker,
                                                         run_async=True)
UNBLACKLIST_STICKER_HANDLER = CommandHandler(["unblsticker", "rmblsticker"],
                                             unblackliststicker,
                                             run_async=True)
BLACKLISTMODE_HANDLER = CommandHandler("blstickermode",
                                       blacklist_mode,
                                       run_async=True)
BLACKLIST_STICKER_DEL_HANDLER = MessageHandler(Filters.sticker
                                               & Filters.chat_type.groups,
                                               del_blackliststicker,
                                               run_async=True)
Beispiel #28
0
 • `/blacklistmode <off/del/warn/ban/kick/mute/tban/tmute>`*:* Action to perform when someone sends blacklisted words.

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 <delete/ban/tban/mute/tmute>`*:* sets up a default action on what to do if users use blacklisted stickers
Note:
 • `<sticker link>` can be `https://t.me/addstickers/<sticker>` or just `<sticker>` or reply to the sticker message

"""
BLACKLIST_HANDLER = DisableAbleCommandHandler(
    "blacklist", blacklist, admin_ok=True, run_async=True
)
ADD_BLACKLIST_HANDLER = CommandHandler("addblacklist", add_blacklist, run_async=True)
UNBLACKLIST_HANDLER = CommandHandler("unblacklist", unblacklist, run_async=True)
BLACKLISTMODE_HANDLER = CommandHandler("blacklistmode", blacklist_mode, run_async=True)
BLACKLIST_DEL_HANDLER = MessageHandler(
    (Filters.text | Filters.command | Filters.sticker | Filters.photo) & Filters.chat_type.groups,
    del_blacklist,
    allow_edit=True,
    run_async=True,
)

dispatcher.add_handler(BLACKLIST_HANDLER)
dispatcher.add_handler(ADD_BLACKLIST_HANDLER)
dispatcher.add_handler(UNBLACKLIST_HANDLER)
dispatcher.add_handler(BLACKLISTMODE_HANDLER)