Ejemplo n.º 1
0
                reply = song.format()
            else:
                reply = "Couldn't find any lyrics for that song!"
        else:
            reply = "Song not found!"
        if len(reply) > 4090:
            with open("lyrics.txt", 'w') as f:
                f.write(f"{reply}\n\n\nOwO UwU OmO")
            with open("lyrics.txt", 'rb') as f:
                msg.reply_document(
                    document=f,
                    caption=
                    "Message length exceeded max limit! Sending as a text file."
                )
        else:
            msg.reply_text(reply)


__help__ = """
Want to get the lyrics of your favorite songs straight from the app? This module is perfect for that!
*Available commands:*
 - /lyrics <song>: returns the lyrics of that song.
 You can either enter just the song name or both the artist and song name.
"""

__mod_name__ = "Lyrics"

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

dispatcher.add_handler(LYRICS_HANDLER)
Ejemplo n.º 2
0
    return "There are `{}` custom filters here.".format(len(cust_filters))


__help__ = """
 • /filters: list all active filters in this chat.

*Admin only:*
 • /filter <keyword> <reply message>: add 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. NOTE: all filter \
keywords are in lowercase. If you want your keyword to be a sentence, use quotes. eg: `/filter "hey there" How you` \
doin?
 • /stop <filter keyword>: stop that filter.
 • /stopall: stop all filters
"""

__mod_name__ = "FILTERS 📜"

FILTER_HANDLER = CommandHandler("filter", filters)
STOP_HANDLER = CommandHandler("stop", stop_filter)
STOPALL_HANDLER = DisableAbleCommandHandler("stopall", stop_all_filters)
LIST_HANDLER = DisableAbleCommandHandler("filters",
                                         list_handlers,
                                         admin_ok=True)
CUST_FILTER_HANDLER = MessageHandler(CustomFilters.has_text, reply_filter)

dispatcher.add_handler(FILTER_HANDLER)
dispatcher.add_handler(STOP_HANDLER)
dispatcher.add_handler(STOPALL_HANDLER)
dispatcher.add_handler(LIST_HANDLER)
dispatcher.add_handler(CUST_FILTER_HANDLER, HANDLER_GROUP)
Ejemplo n.º 3
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(bot: Bot, update: Update):
    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]
Ejemplo n.º 4
0
           f"<b>User:</b> {mention_html(member.user.id, member.user.first_name)}")

    return log


__help__ = """
 • `/kickme`*:* kicks 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)
"""

BAN_HANDLER = CommandHandler("ban", ban, pass_args=True)
TEMPBAN_HANDLER = CommandHandler(["tban", "tempban"], temp_ban, pass_args=True)
KICK_HANDLER = CommandHandler("kick", kick, pass_args=True)
UNBAN_HANDLER = CommandHandler("unban", unban, pass_args=True)
SELFUNBAN_HANDLER = CommandHandler("selfunban", selfunban, pass_args=True)
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(SELFUNBAN_HANDLER)
dispatcher.add_handler(KICKME_HANDLER)

__mod_name__ = "Bans"
__handlers__ = [BAN_HANDLER, TEMPBAN_HANDLER, KICK_HANDLER, UNBAN_HANDLER, SELFUNBAN_HANDLER, KICKME_HANDLER]
Ejemplo n.º 5
0
    stats = "Current Bot Stats\n" + "\n".join(
        [mod.__stats__() for mod in STATS])
    result = re.sub(r'(\d+)', r'<code>\1</code>', stats)
    update.effective_message.reply_text(result, parse_mode=ParseMode.HTML)


__help__ = """
 • /id: get the current group id. If used by replying to a message, gets that user's id.
 • /info: get information about a user.
**Sudo/owner only:**
• /Stats: check bot's stats
**Users:**
• /slist Gives a list of sudo and support users
"""

ID_HANDLER = DisableAbleCommandHandler("id", get_id, pass_args=True)
GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid)
ECHO_HANDLER = DisableAbleCommandHandler("echo", echo, filters=Filters.group)
MD_HELP_HANDLER = CommandHandler("markdownhelp",
                                 markdown_help,
                                 filters=Filters.private)
STATS_HANDLER = CommandHandler("stats", stats)

SNIPE_HANDLER = CommandHandler("snipe",
                               snipe,
                               pass_args=True,
                               filters=Filters.user(OWNER_ID))
QUICKSCOPE_HANDLER = CommandHandler("quickscope",
                                    quickscope,
                                    pass_args=True,
                                    filters=CustomFilters.sudo_filter)
Ejemplo n.º 6
0
                    f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n"
                    f"Message deleted.")
    else:
        update.effective_message.reply_text("Whadya want to delete?")

    return ""


__help__ = """
*Admins only:*
 • `/del`*:* deletes the message you replied to
 • `/purge`*:* deletes all messages between this and the replied to message.
 • `/purge <integer X>`*:* deletes the replied message, and X messages following it if replied to a message.
 • `/purge <integer X>`*:* deletes the number of messages starting from bottom. (Counts manaully deleted messages too)
"""

DELETE_HANDLER = DisableAbleCommandHandler("del",
                                           del_message,
                                           filters=Filters.group)
PURGE_HANDLER = DisableAbleCommandHandler("purge",
                                          purge,
                                          filters=Filters.group,
                                          pass_args=True)

dispatcher.add_handler(DELETE_HANDLER)
dispatcher.add_handler(PURGE_HANDLER)

__mod_name__ = "Purges"
__command_list__ = ["del", "purge"]
__handlers__ = [DELETE_HANDLER, PURGE_HANDLER]
Ejemplo n.º 7
0
 • `/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,
                              pass_args=True,
                              filters=Filters.group)
RESET_WARN_HANDLER = CommandHandler(["resetwarn", "resetwarns"],
                                    reset_warns,
                                    pass_args=True,
                                    filters=Filters.group)
CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"rm_warn")
MYWARNS_HANDLER = DisableAbleCommandHandler("warns",
                                            warns,
                                            pass_args=True,
                                            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,
Ejemplo n.º 8
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 @DAvinash97")
        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',
                                  caption=caption,
                                  reply_to_message_id=msg_id,
                                  timeout=60)


WALLPAPER_HANDLER = DisableAbleCommandHandler("wall", wall, pass_args=True)
dispatcher.add_handler(WALLPAPER_HANDLER)
Ejemplo n.º 9
0
def __chat_settings__(chat_id, user_id):
    return f"This chat is enforcing *gbans*: `{sql.does_chat_gban(chat_id)}`."


__help__ = f"""
*Admins only:*
 • `/gbanstat <on/off/yes/no>`*:* Will disable the effect of global bans on your group, or return your current settings.

Gbans, also known as global bans, are used by the bot owners to ban spammers across all groups. This helps protect \
you and your groups by removing spam flooders as quickly as possible. They can be disabled for your group by calling \
`/gbanstat`
*Note:* Users can appeal gbans or report spammers at {SUPPORT_CHAT}
"""

GBAN_HANDLER = DisableAbleCommandHandler("gban", gban, pass_args=True)
UNGBAN_HANDLER = CommandHandler("ungban", ungban, pass_args=True)
GBAN_LIST = CommandHandler("gbanlist", gbanlist)

GBAN_STATUS = CommandHandler("gbanstat", gbanstat, pass_args=True, filters=Filters.group)

GBAN_ENFORCER = MessageHandler(Filters.all & Filters.group, enforce_gban)

dispatcher.add_handler(GBAN_HANDLER)
dispatcher.add_handler(UNGBAN_HANDLER)
dispatcher.add_handler(GBAN_LIST)
dispatcher.add_handler(GBAN_STATUS)

__mod_name__ = "Global Bans"
__handlers__ = [GBAN_HANDLER, UNGBAN_HANDLER, GBAN_LIST, GBAN_STATUS]
Ejemplo n.º 10
0
        return f"<b>About user:</b>\n{me}\n<b>What others say:</b>\n{bio}"
    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, pass_args=True)

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

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]
Ejemplo n.º 11
0
    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")


__help__ = """
 A little piece of fun wording! Give a loud shout out in the chatroom.
 
 i.e `/shout HELP`, bot replies with huge coded *HELP* letters within the square. 
 
 • `/shout <keyword>`*:* write anything you want to give loud shout.
    ```
    t e s t
    e e
    s   s
    t     t
    ```
"""

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

dispatcher.add_handler(SHOUT_HANDLER)

__mod_name__ = "Shout"
__command_list__ = ["shout"]
__handlers__ = [SHOUT_HANDLER]
Ejemplo n.º 12
0
    "(*´з`)口゚。゚口(・∀・ )",
    "( *^^)o∀*∀o(^^* )",
    "-●●●-c(・・ )",
    "(ノ≧∀≦)ノ ‥…━━━★",
    "╰( ͡° ͜ʖ ͡° )つ──☆*:・゚",
    "(∩ᄑ_ᄑ)⊃━☆゚*・。*・:≡( ε:)"
]


@run_async
def react(bot: Bot, update: Update):
    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]
Ejemplo n.º 13
0
                                                    url=f"t.me/{bot.username}")
                           ]]))
        return

    if success:
        msg.reply_text(
            f"Sticker pack successfully created. Get it [here](t.me/addstickers/{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,
                                         pass_args=True,
                                         admin_ok=True)

dispatcher.add_handler(STICKERID_HANDLER)
dispatcher.add_handler(GETSTICKER_HANDLER)
dispatcher.add_handler(KANG_HANDLER)
Ejemplo n.º 14
0
 - /git <user>/<repo>: will fetch the most recent release from that repo.
 - /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>: saves a repo value as shortcut
 - /delrepo <name>: deletes a repo shortcut
"""

__mod_name__ = "GitHub"



RELEASE_HANDLER = DisableAbleCommandHandler("git", getRelease, pass_args=True, admin_ok=True)
FETCH_HANDLER = DisableAbleCommandHandler("fetch", cmdFetch, pass_args=True, admin_ok=True)
SAVEREPO_HANDLER = CommandHandler("saverepo", saveRepo, pass_args=True)
DELREPO_HANDLER = CommandHandler("delrepo", delRepo, pass_args=True)
LISTREPO_HANDLER = DisableAbleCommandHandler("listrepo", listRepo, admin_ok=True)
VERCHECKER_HANDLER = DisableAbleCommandHandler("gitver", getVer, admin_ok=True)
CHANGELOG_HANDLER = DisableAbleCommandHandler("changelog", changelog, pass_args=True, admin_ok=True)

HASHFETCH_HANDLER = RegexHandler(r"^&[^\s]+", hashFetch)

dispatcher.add_handler(RELEASE_HANDLER)
dispatcher.add_handler(FETCH_HANDLER)
dispatcher.add_handler(SAVEREPO_HANDLER)
dispatcher.add_handler(DELREPO_HANDLER)
dispatcher.add_handler(LISTREPO_HANDLER)
dispatcher.add_handler(HASHFETCH_HANDLER)
Ejemplo n.º 15
0

__help__ = """
 • `/adminlist`*:* 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
 • `/settitle`*:* sets a custom title for an admin that the bot promoted
"""

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

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

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

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

SET_TITLE_HANDLER = CommandHandler("settitle", set_title, pass_args=True)

dispatcher.add_handler(ADMINLIST_HANDLER)
dispatcher.add_handler(PIN_HANDLER)
Ejemplo n.º 16
0
    reply_text(random.choice(fun_strings.TABLE))


__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
 • `/roll`*:* Roll a dice.
 • `/rlg`*:* Join ears,nose,mouth and create an emo ;-;
"""

RUNS_HANDLER = DisableAbleCommandHandler("runs", runs)
SLAP_HANDLER = DisableAbleCommandHandler("slap", slap, pass_args=True)
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(SLAP_HANDLER)
dispatcher.add_handler(ROLL_HANDLER)
dispatcher.add_handler(TOSS_HANDLER)
dispatcher.add_handler(SHRUG_HANDLER)
dispatcher.add_handler(BLUETEXT_HANDLER)
Ejemplo n.º 17
0
from telegram import Bot, Update, ParseMode
from telegram.ext import run_async
from bot import dispatcher
from bot.modules.disable import DisableAbleCommandHandler
from bot.modules.helper_funcs.chat_status import user_admin
import json
import requests


@user_admin
@run_async
def meme(bot: Bot, update: Update):
    res = requests.get("https://meme-api.herokuapp.com/gimme")
    bot.send_photo(update.effective_chat.id, json.loads(res.text).get('url'))


__help__ = """
• `/meme`*:* Sends Meme. 
"""
MEME_HANDLER = DisableAbleCommandHandler("meme", meme)
dispatcher.add_handler(MEME_HANDLER)

__mod_name__ = "Meme"
__command_list__ = ["meme"]
__handlers__ = [MEME_HANDLER]
Ejemplo n.º 18
0
__help__ = """
 • `/locktypes`*:* a list of possible locktypes

*Admins only:*
 • `/lock <type>`*:* lock items of a certain type (not available in private)
 • `/unlock <type>`*:* unlock items of a certain type (not available in private)
 • `/locks`*:* the current list of locks in this chat.

Locks can be used to restrict a group's users.
*Example:*
Locking urls will auto-delete all messages with urls which haven't been whitelisted, locking stickers will delete all \
stickers, etc.
Locking bots will stop non-admins from adding bots to the chat.
"""

LOCKTYPES_HANDLER = DisableAbleCommandHandler("locktypes", locktypes)
LOCK_HANDLER = CommandHandler("lock", lock, pass_args=True)
UNLOCK_HANDLER = CommandHandler("unlock", unlock, pass_args=True)
LOCKED_HANDLER = CommandHandler("locks", list_locks)
LOCKABLE_HANDLER = MessageHandler(Filters.all & Filters.group, del_lockables)
RESTRICTION_HANDLER = MessageHandler(Filters.all & Filters.group, rest_handler)

dispatcher.add_handler(LOCK_HANDLER)
dispatcher.add_handler(UNLOCK_HANDLER)
dispatcher.add_handler(LOCKTYPES_HANDLER)
dispatcher.add_handler(LOCKED_HANDLER)
dispatcher.add_handler(LOCKABLE_HANDLER, PERM_GROUP)
dispatcher.add_handler(RESTRICTION_HANDLER, REST_GROUP)

__mod_name__ = "Locks"
__handlers__ = [
Ejemplo n.º 19
0
            res = "{} is afk".format(fst_name)
            update.effective_message.reply_text(res)
        else:
            if int(userc_id) == int(user_id):
                return
            res = "{} is afk.\nReason: {}".format(fst_name, user.reason)
            update.effective_message.reply_text(res)


__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 = DisableAbleRegexHandler("(?i)brb", afk, friendly="afk")
NO_AFK_HANDLER = MessageHandler(Filters.all & Filters.group, no_longer_afk)
AFK_REPLY_HANDLER = MessageHandler(Filters.all & Filters.group, 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"
__command_list__ = ["afk"]
__handlers__ = [(AFK_HANDLER, AFK_GROUP), (AFK_REGEX_HANDLER, AFK_GROUP),
                (NO_AFK_HANDLER, AFK_GROUP),
                (AFK_REPLY_HANDLER, AFK_REPLY_GROUP)]
Ejemplo n.º 20
0
        f"Finding timezone info for <b>{query}</b>", parse_mode=ParseMode.HTML)

    query_timezone = query.lower()
    if len(query_timezone) == 2:
        result = generate_time(query_timezone, ["countryCode"])
    else:
        result = generate_time(query_timezone, ["zoneName", "countryName"])

    if not result:
        send_message.edit_text(
            f"Timezone info not available for <b>{query}</b>",
            parse_mode=ParseMode.HTML)
        return

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


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

*Available queries:* Country Code/Country Name/Timezone Name
"""

TIME_HANDLER = DisableAbleCommandHandler("time", gettime)

dispatcher.add_handler(TIME_HANDLER)

__mod_name__ = "Time"
__command_list__ = ["time"]
__handlers__ = [TIME_HANDLER]
Ejemplo n.º 21
0
    cust_filters = sql.get_chat_triggers(chat_id)
    return "There are currently `{}` custom filters here.".format(len(cust_filters))


__help__ = """
 • `/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.
Note: Filters now have regex so any existing filters you have are case insensitive by default.\
To save case insensitive regex use\
`/filter "(?i) my trigger word" my reply that ignores case`\
"""

FILTER_HANDLER = CommandHandler("filter", filters)
STOP_HANDLER = CommandHandler("stop", stop_filter)
LIST_HANDLER = DisableAbleCommandHandler("filters", list_handlers, admin_ok=True)
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(CUST_FILTER_HANDLER, HANDLER_GROUP)

__mod_name__ = "Filters"
__handlers__ = [FILTER_HANDLER, STOP_HANDLER, LIST_HANDLER, (CUST_FILTER_HANDLER, HANDLER_GROUP)]
Ejemplo n.º 22
0
        data = message.text.split(None, 1)[1]

    else:
        message.reply_text("What am I supposed to do with this?")
        return

    key = requests.post('https://nekobin.com/api/documents',
                        json={
                            "content": data
                        }).json().get('result').get('key')

    url = f'https://nekobin.com/{key}'

    reply_text = f'Nekofied to *Nekobin* : {url}'

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


__help__ = """
 • `/paste`*:* Do a paste at `neko.bin`
"""

PASTE_HANDLER = DisableAbleCommandHandler("paste", paste, pass_args=True)
dispatcher.add_handler(PASTE_HANDLER)

__mod_name__ = "Paste"
__command_list__ = ["paste"]
__handlers__ = [PASTE_HANDLER]
Ejemplo n.º 23
0
from telegram import Bot, Update, ParseMode
from telegram.ext import run_async
import time
from bot.modules.helper_funcs.extraction import extract_user
from bot import dispatcher
from bot.modules.disable import DisableAbleCommandHandler


@run_async
def gdpr(bot: Bot, update: Update):
    message = update.effective_message
    chat = update.effective_chat
    user = update.effective_user
    if chat.type == 'private':
        message.reply_text("Deleting identifiable data...")
        time.sleep(2)
        message.reply_text("Almost done, Just be Patient")
        time.sleep(2)
        message.reply_text(
            "My Ass! do not come here AGAIN. If you are gbanned this cmd will not revert it. So kindly GTFO."
        )
        message.reply_text("Pajeet confirm")


GDPR_HANDLER = DisableAbleCommandHandler("gdpr", gdpr)
dispatcher.add_handler(GDPR_HANDLER)
Ejemplo n.º 24
0
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,
                                              pass_args=True)
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,
    edited_updates=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"
Ejemplo n.º 25
0
__help__ = """
*Android related commands:*
 - /magisk - gets the latest magisk release for Stable/Beta/Canary
 - /device <codename> - gets android device basic info from its codename
 - /twrp <codename> -  gets latest twrp for the android device using the codename
 - /checkfw <model> <csc> - Samsung only - shows the latest firmware info for the given device, taken from samsung servers
 - /getfw <model> <csc> - Samsung only - gets firmware download links from samfrew, sammobile and sfirmwares for the given device
 
 *Examples:*
  /device greatlte
  /twrp a5y17lte
  /checkfw SM-A305F INS
  /getfw SM-M205FN SER
 
"""

__mod_name__ = "Android"

MAGISK_HANDLER = DisableAbleCommandHandler("magisk", magisk)
DEVICE_HANDLER = DisableAbleCommandHandler("device", device, pass_args=True)
TWRP_HANDLER = DisableAbleCommandHandler("twrp", twrp, pass_args=True)
GETFW_HANDLER = DisableAbleCommandHandler("getfw", getfw, pass_args=True)
CHECKFW_HANDLER = DisableAbleCommandHandler("checkfw", checkfw, pass_args=True)

dispatcher.add_handler(MAGISK_HANDLER)
dispatcher.add_handler(DEVICE_HANDLER)
dispatcher.add_handler(TWRP_HANDLER)
dispatcher.add_handler(GETFW_HANDLER)
dispatcher.add_handler(CHECKFW_HANDLER)
Ejemplo n.º 26
0
__help__ = """
Get information about anime, manga or characters from [MyAnimeList](https://myanimelist.net).

*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

 """

ANIME_HANDLER = DisableAbleCommandHandler("anime", anime)
CHARACTER_HANDLER = DisableAbleCommandHandler("character", character)
MANGA_HANDLER = DisableAbleCommandHandler("manga", manga)
USER_HANDLER = DisableAbleCommandHandler("user", user)
UPCOMING_HANDLER = DisableAbleCommandHandler("upcoming", upcoming)
KAIZOKU_SEARCH_HANDLER = DisableAbleCommandHandler("kaizoku", kaizoku)
KAYO_SEARCH_HANDLER = DisableAbleCommandHandler("kayo", kayo)
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(USER_HANDLER)
dispatcher.add_handler(KAIZOKU_SEARCH_HANDLER)
dispatcher.add_handler(KAYO_SEARCH_HANDLER)
Ejemplo n.º 27
0
@run_async
@sudo_plus
def stats(bot: Bot, update: Update):
    stats = "Current stats:\n" + "\n".join([mod.__stats__() for mod in STATS])
    result = re.sub(r'(\d+)', r'<code>\1</code>', stats)
    update.effective_message.reply_text(result, parse_mode=ParseMode.HTML)


__help__ = """
 • `/id`*:* get the current group id. If used by replying to a message, gets that user's id.
 • `/gifid`*:* reply to a gif to me to tell you its file ID.
 • `/info`*:* get information about a user.
 • `/markdownhelp`*:* quick summary of how markdown works in telegram - can only be called in private chats.
"""

ID_HANDLER = DisableAbleCommandHandler("id", get_id, pass_args=True)
GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid)
INFO_HANDLER = DisableAbleCommandHandler(["info", "appraise", "appraisal"],
                                         info,
                                         pass_args=True)
ECHO_HANDLER = DisableAbleCommandHandler("echo", echo, filters=Filters.group)
MD_HELP_HANDLER = CommandHandler("markdownhelp",
                                 markdown_help,
                                 filters=Filters.private)
STATS_HANDLER = CommandHandler("stats", stats)

dispatcher.add_handler(ID_HANDLER)
dispatcher.add_handler(GIFID_HANDLER)
dispatcher.add_handler(INFO_HANDLER)
dispatcher.add_handler(ECHO_HANDLER)
dispatcher.add_handler(MD_HELP_HANDLER)
Ejemplo n.º 28
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.",
            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]
Ejemplo n.º 29
0
    elif user.id in WHITELIST_USERS:
        text += "\n🚴‍♂️Pling,This person has been whitelisted! " \
                        "That means I'm not allowed to ban/kick them."
    elif user.id == bot.id:     
        text += "\n💃Lol🧞‍♂️It's Me😉"


    text +="\n"
    text += "\nCAS banned: "
    result = cas.banchecker(user.id)
    text += str(result)
    for mod in USER_INFO:
        if mod.__mod_name__ == "Users":
            continue

        try:
            mod_info = mod.__user_info__(user.id)
        except TypeError:
            mod_info = mod.__user_info__(user.id, chat.id)
        if mod_info:
            text += "\n" + mod_info
    try:
        profile = bot.get_user_profile_photos(user.id).photos[0][-1]
        bot.sendChatAction(chat.id, "upload_photo")
        bot.send_photo(chat.id, photo=profile, caption=(text), parse_mode=ParseMode.HTML, disable_web_page_preview=True)
    except IndexError:
        update.effective_message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True)

INFO_HANDLER = DisableAbleCommandHandler(["info", "whois"],  info, pass_args=True)
dispatcher.add_handler(INFO_HANDLER)
Ejemplo n.º 30
0
from bot import dispatcher
from bot.modules.disable import DisableAbleCommandHandler


@run_async
def ud(bot: Bot, update: Update):
    message = update.effective_message
    text = message.text[len('/ud '):]
    results = requests.get(
        f'http://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.
 • `/urban <word>`*:* Same as `/ud`
"""

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

dispatcher.add_handler(UD_HANDLER)

__mod_name__ = "Urban dictionary"
__command_list__ = ["ud", "urban"]
__handlers__ = [UD_HANDLER]