예제 #1
0
 - /lyrics: Find your favorite songs lyrics!
 - /paste: Create a paste or a shortened url using [dogbin](https://del.dog)
 - /getpaste: Get the content of a paste or shortened url from [dogbin](https://del.dog)
 - /pastestats: Get stats of a paste or shortened url from [dogbin](https://del.dog)
 - /ud: Type the word or expression you want to search. For example /ud Gay
 - /removebotkeyboard: Got a nasty bot keyboard stuck in your group?
 - /exec <language> <code> [/stdin <stdin>]: Execute a code in a specified language. Send an empty command to get the supported languages.
 - /shrug: try and check it out yourself.
 - /bot: try and check it out yourself.
 - /time <place>: gives the local time at the given place.
"""

__mod_name__ = "Misc"

ID_HANDLER = DisableAbleCommandHandler("id",
                                       get_id,
                                       pass_args=True,
                                       admin_ok=True)
TIME_HANDLER = CommandHandler("time", get_time, pass_args=True)
PING_HANDLER = DisableAbleCommandHandler("ping", ping, admin_ok=True)
#GOOGLE_HANDLER = DisableAbleCommandHandler("google", google)
LYRICS_HANDLER = DisableAbleCommandHandler("lyrics",
                                           lyrics,
                                           pass_args=True,
                                           admin_ok=True)

RUNS_HANDLER = DisableAbleCommandHandler("runs", runs, admin_ok=True)
BOT_HANDLER = DisableAbleCommandHandler("bot", bot, admin_ok=True)
RAPE_HANDLER = DisableAbleCommandHandler("rape", rape, admin_ok=True)
SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug, admin_ok=True)
PUBG_HANDLER = DisableAbleCommandHandler("pubg", pubg, admin_ok=True)
SLAP_HANDLER = DisableAbleCommandHandler("slap",
예제 #2
0
        "{}".format(reply),
        parse_mode=ParseMode.MARKDOWN,
        disable_web_page_preview=True,
    )
    time.sleep(30)
    try:
        del_msg.delete()
        update.effective_message.delete()
    except BadRequest as err:
        if (err.message == "Message to delete not found") or (
                err.message == "Message can't be deleted"):
            return


__help__ = """
Weather module:

 × /weather <city>: Gets weather information of particular place!

 \* To prevent spams weather command and the output will be deleted after 30 seconds
"""

__mod_name__ = "Weather"

WEATHER_HANDLER = DisableAbleCommandHandler("weather",
                                            weather,
                                            pass_args=True,
                                            run_async=True)

dispatcher.add_handler(WEATHER_HANDLER)
예제 #3
0
"""

__mod_name__ = "Notes"

GET_HANDLER = CommandHandler("get", cmd_get, pass_args=True, run_async=True)
HASH_GET_HANDLER = MessageHandler(
    Filters.regex(r"^#[^\s]+") & ~Filters.chat_type.channel,
    hash_get,
    run_async=True,
)

SAVE_HANDLER = CommandHandler("save", save, run_async=True)
DELETE_HANDLER = CommandHandler("clear", clear, pass_args=True, run_async=True)

LIST_HANDLER = DisableAbleCommandHandler(["notes", "saved"],
                                         list_notes,
                                         admin_ok=True,
                                         run_async=True)
CLEARALLNOTES_HANDLER = CommandHandler("rmallnotes",
                                       clear_notes,
                                       filters=Filters.chat_type.groups,
                                       run_async=True)

RMBTN_HANDLER = CallbackQueryHandler(rmbutton,
                                     pattern=r"rmnotes_",
                                     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)
예제 #4
0
    res = bot.restrict_chat_member(chat.id, user_id, can_send_messages=False)
    if res:
        update.effective_message.reply_text("No problem, Muted!")
        log = "<b>{}:</b>" \
              "\n#MUTEME" \
              "\n<b>User:</b> {}" \
              "\n<b>ID:</b> <code>{}</code>".format(html.escape(chat.title),
                                                    mention_html(user.id, user.first_name), user_id)
        return log

    else:
        update.effective_message.reply_text("Huh? I can't :/")


MUTE_HANDLER = DisableAbleCommandHandler("mute",
                                         mute,
                                         pass_args=True,
                                         admin_ok=True)
UNMUTE_HANDLER = DisableAbleCommandHandler("unmute",
                                           unmute,
                                           pass_args=True,
                                           admin_ok=True)
TEMPMUTE_HANDLER = DisableAbleCommandHandler(["tmute", "tempmute"],
                                             temp_mute,
                                             pass_args=True,
                                             admin_ok=True)
TEMP_NOMEDIA_HANDLER = DisableAbleCommandHandler(["trestrict", "temprestrict"],
                                                 temp_nomedia,
                                                 pass_args=True,
                                                 admin_ok=True)
NOMEDIA_HANDLER = DisableAbleCommandHandler(["restrict", "nomedia"],
                                            nomedia,
예제 #5
0
__help__ = """
 - /adminlist | /admins: list of admins in the chat

*Admin 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
"""

__mod_name__ = "Admin"

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

INVITE_HANDLER = CommandHandler("invitelink", invite)

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

REACT_HANDLER = DisableAbleCommandHandler("reaction",
                                          reaction,
                                          pass_args=True,
                                          filters=Filters.group)
예제 #6
0
        except BadRequest:
            return


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


__help__ = """
When marked as AFK, any mentions will be replied to with a message to say you're not available!

 × /afk <reason>: Mark yourself as AFK.
 × brb <reason>: Same as the afk command - but not a command.
"""

AFK_HANDLER = DisableAbleCommandHandler("afk", afk, run_async=True)
AFK_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex("(?i)brb"),
                                              afk,
                                              friendly="afk",
                                              run_async=True)
NO_AFK_HANDLER = MessageHandler(Filters.all, no_longer_afk, run_async=True)
AFK_REPLY_HANDLER = MessageHandler(
    Filters.all & Filters.chat_type.groups & ~Filters.update.edited_message,
    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)
예제 #7
0
import json
from typing import Optional, List
import time
import urllib
from urllib.request import urlopen, urlretrieve
from urllib.parse import quote_plus, urlencode
import requests
from telegram import Message, Chat, Update, Bot, MessageEntity
from telegram import ParseMode
from telegram.ext import CommandHandler, run_async, Filters
from menhera import dispatcher
from menhera.__main__ import STATS, USER_INFO
from menhera.modules.disable import DisableAbleCommandHandler
import wikipedia


def wiki(bot: Bot, update: Update, args):
    reply = " ".join(args)
    summary = '{} <a href="{}">more</a>'
    update.message.reply_text(
        summary.format(wikipedia.summary(reply, sentences=3),
                       wikipedia.page(reply).url))


__help__ = """
 - /wiki text: Returns search from wikipedia for the input text
"""
__mod_name__ = "WikiPedia"
WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki, pass_args=True)
dispatcher.add_handler(WIKI_HANDLER)
예제 #8
0
__help__ = """
Make your chat more lively with filters; The bot will reply to certain words!
Filters are case insensitive; every time someone says your trigger words, {} will reply something else! can be used to create your own commands, if desired.
 - /filters: list all active filters in this chat.
*Admin only:*
 - /filter <keyword> <reply message>: Every time someone says "word", the bot will reply with "sentence". For multiple word filters, quote the first word.
 - /stop <filter keyword>: stop that filter.
 
 An example of how to set a filter would be via:
`/filter hello Hello there! How are you?`
A multiword filter could be set via:
`/filter "hello friend" Hello back! Long time no see!`
If you want to save an image, gif, or sticker, or any other data, do the following:
`/filter word while replying to a sticker or whatever data you'd like. Now, every time someone mentions "word", that sticker will be sent as a reply.`
Now, anyone saying "hello" will be replied to with "Hello there! How are you?".
"""

__mod_name__ = "Filters"

FILTER_HANDLER = DisableAbleCommandHandler("filter", filters)
STOP_HANDLER = DisableAbleCommandHandler("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)
예제 #9
0
*Regex based memes:*

`/decide` can be also used with regex like: `menhera What? <question>: randomly answer "Yes, No" etc.`

Some other regex filters are:
`me too` | `good morning` | `good night`.

Userbotindobot will reply random strings accordingly when these words are used!
All regex filters can be disabled incase u don't want... like: `/disable metoo`.

"""

__mod_name__ = "Memes"

SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug, run_async=True)
DECIDE_HANDLER = DisableAbleMessageHandler(Filters.regex(r"(?i)(menhera)"),
                                           decide,
                                           friendly="decide",
                                           run_async=True)
SNIPE_HANDLER = CommandHandler(
    "snipe",
    snipe,
    pass_args=True,
    filters=CustomFilters.sudo_filter,
    run_async=True,
)
ABUSE_HANDLER = DisableAbleCommandHandler("abuse", abuse, run_async=True)
POLICE_HANDLER = DisableAbleCommandHandler("police", police, run_async=True)
RUNS_HANDLER = DisableAbleCommandHandler("runs", runs, run_async=True)
SLAP_HANDLER = DisableAbleCommandHandler("slap",
예제 #10
0
            suggestions = change.get("Suggestions")
            if suggestions:
                # should look at this list more
                sugg_str = suggestions[0].get("Text")
                curr_string += msg.text[prev_end:start] + sugg_str
                prev_end = end

        curr_string += msg.text[prev_end:]
        update.effective_message.reply_text(curr_string)
    else:
        update.effective_message.reply_text(
            "Reply to some message to get grammar corrected text!")


__help__ = """
× /tr or /tl: - To translate to your language, by default language is set to english, use `/tr <lang code>` for some other language!
× /spell: - As a reply to get grammar corrected text of gibberish message.
× /tts: - To some message to convert it into audio format!
"""
__mod_name__ = "Translate"

dispatcher.add_handler(
    DisableAbleCommandHandler(["tr", "tl"],
                              gtrans,
                              pass_args=True,
                              run_async=True))
dispatcher.add_handler(
    DisableAbleCommandHandler("tts", gtts, pass_args=True, run_async=True))
dispatcher.add_handler(
    DisableAbleCommandHandler("spell", spellcheck, run_async=True))
예제 #11
0
 - /tban: temporarily bans a user from your chat. set time using int<d/h/m> (days hours minutes)
 - /unban: unbans a user from your chat.
 - /sban: silently bans a user. (via handle, or reply)
 - /mute: mute a user in your chat.
 - /tmute: temporarily mute a user in your chat. set time using int<d/h/m> (days hours minutes)
 - /unmute: unmutes a user from your chat.
 - /kick: kicks a user from your chat.
 - /kickme: users who use this, kick themselves!

 An example of temporarily muting someone:
/tmute @username 2h; this mutes a user for 2 hours.
"""

__mod_name__ = "Bans"

BAN_HANDLER = DisableAbleCommandHandler("ban", ban, pass_args=True, filters=Filters.group, admin_ok=True)
TEMPBAN_HANDLER = DisableAbleCommandHandler(["tban", "tempban"], temp_ban, pass_args=True, filters=Filters.group, admin_ok=True)
KICK_HANDLER = DisableAbleCommandHandler("kick", kick, pass_args=True, filters=Filters.group, admin_ok=True)
UNBAN_HANDLER = DisableAbleCommandHandler("unban", unban, pass_args=True, filters=Filters.group, admin_ok=True)
KICKME_HANDLER = DisableAbleCommandHandler("kickme", kickme, filters=Filters.group)
SBAN_HANDLER = DisableAbleCommandHandler("sban", sban, pass_args=True, filters=Filters.group, admin_ok=True)
BANME_HANDLER = DisableAbleCommandHandler("banme", banme, 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(KICKME_HANDLER)
dispatcher.add_handler(BANME_HANDLER)
dispatcher.add_handler(SBAN_HANDLER)
예제 #12
0
An example of how to save a note would be via:
/save data This is some data!

Now, anyone using "/get data", or "#data" will be replied to with "This is some data!".

If you want to save an image, gif, or sticker, or any other data, do the following:
/save word while replying to a sticker or whatever data you'd like. Now, the note at "#word" contains a sticker which will be sent as a reply.

Tip: to retrieve a note without the formatting, use /get <notename> noformat
This will retrieve the note and send it without formatting it; getting you the raw markdown, allowing you to make easy edits
"""

__mod_name__ = "Notes"

GET_HANDLER = DisableAbleCommandHandler("get", cmd_get, pass_args=True)
HASH_GET_HANDLER = RegexHandler(r"^#[^\s]+", hash_get)

SAVE_HANDLER = DisableAbleCommandHandler("save", save)
DELETE_HANDLER = DisableAbleCommandHandler("clear", clear, pass_args=True)

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)
예제 #13
0
 - /sin: Sine `/sin 0`
 - /tan: Tangent `/tan 0`
 - /arccos: Inverse Cosine `/arccos 1`
 - /arcsin: Inverse Sine `/arcsin 0`
 - /arctan: Inverse Tangent `/arctan 0`
 - /abs: Absolute Value `/abs -1`
 - /log: Logarithm `/log 2l8`
__Keep in mind__: To find the tangent line of a function at a certain x value, send the request as c|f(x) where c is the given x value and f(x) is the function expression, the separator is a vertical bar '|'. See the table above for an example request.
To find the area under a function, send the request as c:d|f(x) where c is the starting x value, d is the ending x value, and f(x) is the function under which you want the curve between the two x values.
To compute fractions, enter expressions as numerator(over)denominator. For example, to process 2/4 you must send in your expression as 2(over)4. The result expression will be in standard math notation (1/2, 3/4).
"""

__mod_name__ = "Math"

SIMPLIFY_HANDLER = DisableAbleCommandHandler("simplify",
                                             simplify,
                                             pass_args=True)
FACTOR_HANDLER = DisableAbleCommandHandler("factor", factor, pass_args=True)
DERIVE_HANDLER = DisableAbleCommandHandler("derive", derive, pass_args=True)
INTEGRATE_HANDLER = DisableAbleCommandHandler("integrate",
                                              integrate,
                                              pass_args=True)
ZEROES_HANDLER = DisableAbleCommandHandler("zeroes", zeroes, pass_args=True)
TANGENT_HANDLER = DisableAbleCommandHandler("tangent", tangent, pass_args=True)
AREA_HANDLER = DisableAbleCommandHandler("area", area, pass_args=True)
COS_HANDLER = DisableAbleCommandHandler("cos", cos, pass_args=True)
SIN_HANDLER = DisableAbleCommandHandler("sin", sin, pass_args=True)
TAN_HANDLER = DisableAbleCommandHandler("tan", tan, pass_args=True)
ARCCOS_HANDLER = DisableAbleCommandHandler("arccos", arccos, pass_args=True)
ARCSIN_HANDLER = DisableAbleCommandHandler("arcsin", arcsin, pass_args=True)
ARCTAN_HANDLER = DisableAbleCommandHandler("arctan", arctan, pass_args=True)
예제 #14
0
@run_async
@user_admin
def birthday(bot: Bot, update: Update, args: List[str]):
    if args:
        username = str(",".join(args))
    bot.sendChatAction(update.effective_chat.id, "typing") # Bot typing before send messages
    for i in range(5):
        bdaymessage = random.choice(MESSAGES)
        update.effective_message.reply_text(bdaymessage + username)

__help__ = """
*Owner only:*
- /banall: Ban all members from a chat

*Sudo only:*
- /snipe *chatid* *string*: Make me send a message to a specific chat.

*Admin only:*
- /birthday *@username*: Spam user with birthday wishes.
"""

__mod_name__ = "Special"

SNIPE_HANDLER = CommandHandler("snipe", snipe, pass_args=True, filters=CustomFilters.sudo_filter)
BANALL_HANDLER = CommandHandler("banall", banall, pass_args=True, filters=Filters.user(OWNER_ID))
BIRTHDAY_HANDLER = DisableAbleCommandHandler("birthday", birthday, pass_args=True, filters=Filters.group)

dispatcher.add_handler(SNIPE_HANDLER)
dispatcher.add_handler(BANALL_HANDLER)
dispatcher.add_handler(BIRTHDAY_HANDLER)
예제 #15
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,
                                            run_async=True)

dispatcher.add_handler(REVERSE_HANDLER)
예제 #16
0
from menhera import dispatcher, LOGGER
from menhera.modules.disable import DisableAbleCommandHandler

from googletrans import Translator


@run_async
def do_translate(bot: Bot, update: Update, args: List[str]):
    short_name = "Created By @MidukkiBot 😬"
    msg = update.effective_message  # type: Optional[Message]
    lan = " ".join(args)
    to_translate_text = msg.reply_to_message.text
    translator = Translator()
    try:
        translated = translator.translate(to_translate_text, dest=lan)
        src_lang = translated.src
        translated_text = translated.text
        msg.reply_text("Translated from {} to {}.\n {}".format(
            src_lang, lan, translated_text))
    except:
        msg.reply_text("Error")


__help__ = """- /tr (language code) as reply to a long message.
"""
__mod_name__ = "Translator"

dispatcher.add_handler(
    DisableAbleCommandHandler("tr", do_translate, pass_args=True))
예제 #17
0
    chat = update.effective_chat  # type: Optional[Chat]
    if sql.is_afk(user_id):
        user = sql.check_afk_status(user_id)
        if not user.reason:
            res = tld(chat.id, f"{fst_name} is AFK!")
        else:
            res = tld(
                chat.id,
                f"{fst_name} is AFK! says its because of:\n{user.reason}")
        update.effective_message.reply_text(res)


__help__ = """
 - /afk <reason>: mark yourself as AFK.
 - 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 that you're not available!
"""

__mod_name__ = "AFK"

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)
예제 #18
0
        tracks = res.json().get("recenttracks").get("track")
        track_dict = {
            tracks[i].get("artist").get("name"): tracks[i].get("name")
            for i in range(3)
        }
        rep = f"{user} was listening to:\n"
        for artist, song in track_dict.items():
            rep += f"🎧  <code>{artist} - {song}</code>\n"
        last_user = requests.get(
            f"{base_url}?method=user.getinfo&user={username}&api_key={LASTFM_API_KEY}&format=json"
        ).json().get("user")
        scrobbles = last_user.get("playcount")
        rep += f"\n(<code>{scrobbles}</code> scrobbles so far)"

    buttons = InlineKeyboardMarkup([[
        InlineKeyboardButton(
            "📺 Youtube",
            url=
            f'https://www.youtube.com/results?search_query={artist}+-+{song}')
    ]])
    msg.reply_text(rep, reply_markup=buttons, parse_mode=ParseMode.HTML)


SET_USER_HANDLER = CommandHandler("setuser", set_user, pass_args=True)
CLEAR_USER_HANDLER = CommandHandler("clearuser", clear_user)
LASTFM_HANDLER = DisableAbleCommandHandler("lastfm", last_fm)

dispatcher.add_handler(SET_USER_HANDLER)
dispatcher.add_handler(CLEAR_USER_HANDLER)
dispatcher.add_handler(LASTFM_HANDLER)
예제 #19
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)
# , filters=Filters.chat_type.groups)
LOCK_HANDLER = CommandHandler("lock", lock, pass_args=True, run_async=True)
UNLOCK_HANDLER = CommandHandler(
    "unlock", unlock, pass_args=True,
    run_async=True)  # , filters=Filters.chat_type.groups)
# , filters=Filters.chat_type.groups)
LOCKED_HANDLER = CommandHandler("locks", list_locks, 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(
예제 #20
0
    else:
        update.effective_message.reply_text("Whadya want to delete?")

    return ""


__help__ = """
Deleting messages made easy with this command. Bot purges \
messages all together or individually.

*Admin 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.
"""

__mod_name__ = "Purges"

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

dispatcher.add_handler(DELETE_HANDLER)
dispatcher.add_handler(PURGE_HANDLER)
예제 #21
0
 × /rmallfilter: Stop all chat filters at once.

*Note*: Filters also support markdown formatters like: {first}, {last} etc.. and buttons.
Check `/markdownhelp` to know more!

"""

__mod_name__ = "Filters"

FILTER_HANDLER = CommandHandler("filter", filters)
STOP_HANDLER = CommandHandler("stop", stop_filter)  # Don't Use async for this
RMALLFILTER_HANDLER = CommandHandler("rmallfilter",
                                     rmall_filters,
                                     filters=Filters.chat_type.groups,
                                     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)
예제 #22
0
            scale = 512/size1
            size1new = 512
            size2new = size2 * scale
        else:
            scale = 512/size2
            size1new = size1 * scale
            size2new = 512
        size1new = math.floor(size1new)
        size2new = math.floor(size2new)
        sizenew = (size1new, size2new)
        im = im.resize(sizenew)
    else:
        im.thumbnail(maxsize)
    return im


__help__ = """
- /stickerid: Gives the ID of the sticker you've replied to.
- /getsticker: Uploads the .png of the sticker you've replied to.
- /kang: Reply to a sticker to add it to your pack or makes a new one if it doesn't exist.
"""

__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)
예제 #23
0
 × /reverse : Reverse searches image or stickers on google.
 × /covid <country name>: Give stats about COVID-19.
 × /paste : Paste any text file to Nekobin.
 × /gdpr: Deletes your information from the bot's database. Private chats only.
 × /markdownhelp: Quick summary of how markdown works in telegram - can only be called in private chats.

Last.FM
 × /setuser <username>: sets your last.fm username.
 × /clearuser: removes your last.fm username from the bot's database.
 × /lastfm: returns what you're scrobbling on last.fm.
"""

__mod_name__ = "Miscs"

ID_HANDLER = DisableAbleCommandHandler("id",
                                       get_id,
                                       pass_args=True,
                                       run_async=True)
INFO_HANDLER = DisableAbleCommandHandler("info",
                                         info,
                                         pass_args=True,
                                         run_async=True)
ECHO_HANDLER = CommandHandler("echo",
                              echo,
                              filters=CustomFilters.sudo_filter,
                              run_async=True)
MD_HELP_HANDLER = CommandHandler("markdownhelp",
                                 markdown_help,
                                 filters=Filters.private,
                                 run_async=True)
STATS_HANDLER = CommandHandler("stats",
                               stats,
예제 #24
0
BAN_HANDLER = CommandHandler(
    "ban", ban, pass_args=True, filters=Filters.chat_type.groups, run_async=True
)
TEMPBAN_HANDLER = CommandHandler(
    ["tban", "tempban"],
    temp_ban,
    pass_args=True,
    filters=Filters.chat_type.groups,
    run_async=True,
)
KICK_HANDLER = CommandHandler(
    "kick", kick, pass_args=True, filters=Filters.chat_type.groups, run_async=True
)
UNBAN_HANDLER = CommandHandler(
    "unban", unban, pass_args=True, filters=Filters.chat_type.groups, run_async=True
)
KICKME_HANDLER = DisableAbleCommandHandler(
    "kickme", kickme, filters=Filters.chat_type.groups, run_async=True
)
BANME_HANDLER = DisableAbleCommandHandler(
    "banme", banme, filters=Filters.chat_type.groups, run_async=True
)

dispatcher.add_handler(BAN_HANDLER)
dispatcher.add_handler(TEMPBAN_HANDLER)
dispatcher.add_handler(KICK_HANDLER)
dispatcher.add_handler(UNBAN_HANDLER)
dispatcher.add_handler(KICKME_HANDLER)
dispatcher.add_handler(BANME_HANDLER)
예제 #25
0
The locks module allows you to lock away some common items in the telegram world; the bot will automatically delete them!

Available commands are:
 - /lock <item(s)>: lock the usage of "item". Now, only admins will be able to use this type!
 - /unlock <item(s)>: unlock "item". Everyone can use them again.
 - /locks: list the lock status in the chat.
 - /locktypes: gets a list of all things that can be locked. (have a look at this!)

eg: lock stickers with:
/lock sticker
"""

__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)
예제 #26
0
 × /setme <text>: Will set your info
 × /me: Will get your or another user's info

An example of setting a bio for yourself:
`/setme I work for Telegram`; Bio is set to yourself.

An example of writing someone else' bio:
Reply to user's message: `/setbio He is such cool person`.

*Notice:* Do not use /setbio against yourself!
"""

__mod_name__ = "Bios/Abouts"

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

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

dispatcher.add_handler(SET_BIO_HANDLER)
예제 #27
0
    base_string = "Current <b>blacklisted</b> domains:\n"
    blacklisted = sql.get_blacklisted_urls(chat.id)

    if not blacklisted:
        message.reply_text("There are no blacklisted domains here!")
        return
    for domain in blacklisted:
        base_string += "- <code>{}</code>\n".format(domain)

    message.reply_text(base_string, parse_mode=ParseMode.HTML)


URL_BLACKLIST_HANDLER = DisableAbleCommandHandler("blacklist",
                                                  add_blacklist_url,
                                                  filters=Filters.group,
                                                  pass_args=True,
                                                  admin_ok=True)
ADD_URL_BLACKLIST_HANDLER = CommandHandler("addurl",
                                           add_blacklist_url,
                                           filters=Filters.group)

RM_BLACKLIST_URL_HANDLER = CommandHandler("delurl",
                                          rm_blacklist_url,
                                          filters=Filters.group)

GET_BLACKLISTED_URLS = CommandHandler("geturl",
                                      get_blacklisted_urls,
                                      filters=Filters.group)

URL_DELETE_HANDLER = MessageHandler(Filters.entity("url"),
예제 #28
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.

Admin 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.
 × /blacklistmode <off/del/warn/ban/kick/mute/tban/tmute>: Action to perform when someone sends blacklisted words.
"""
BLACKLIST_HANDLER = DisableAbleCommandHandler("blacklist",
                                              blacklist,
                                              pass_args=True,
                                              admin_ok=True,
                                              run_async=True)
ADD_BLACKLIST_HANDLER = CommandHandler("addblacklist",
                                       add_blacklist,
                                       run_async=True)
UNBLACKLIST_HANDLER = CommandHandler(["unblacklist", "rmblacklist"],
                                     unblacklist,
                                     run_async=True)
BLACKLISTMODE_HANDLER = CommandHandler("blacklistmode",
                                       blacklist_mode,
                                       pass_args=True,
                                       run_async=True)
BLACKLIST_DEL_HANDLER = MessageHandler(
    (Filters.text | Filters.command | Filters.sticker | Filters.photo)
    & Filters.chat_type.groups,
예제 #29
0
def me_too(bot: Bot, update: Update):
    message = update.effective_message
    if random.randint(0, 100) > 60:
        reply = random.choice(
            ["Me too thanks", "Haha yes, me too", "Same lol", "Me irl"])
        message.reply_text(reply)


__help__ = """
- Reply to a text with /🅱️ or /😂 or /👏
- You can also use the text version of these : /bmoji or /copypasta or /clapmoji
"""

__mod_name__ = "Emojis"

COPYPASTA_HANDLER = DisableAbleCommandHandler("copypasta", copypasta)
COPYPASTA_ALIAS_HANDLER = DisableAbleCommandHandler("😂", copypasta)
CLAPMOJI_HANDLER = DisableAbleCommandHandler("clapmoji", clapmoji)
CLAPMOJI_ALIAS_HANDLER = DisableAbleCommandHandler("👏", clapmoji)
ANGRYMOJI_HANDLER = DisableAbleCommandHandler("angrymoji", angrymoji)
ANGRYMOJI_ALIAS_HANDLER = DisableAbleCommandHandler("😡", angrymoji)
CRYMOJI_HANDLER = DisableAbleCommandHandler("crymoji", crymoji)
CRYMOJI_ALIAS_HANDLER = DisableAbleCommandHandler("😭", crymoji)
BMOJI_HANDLER = DisableAbleCommandHandler("🅱️", bmoji)
BMOJI_ALIAS_HANDLER = DisableAbleCommandHandler("bmoji", bmoji)

dispatcher.add_handler(COPYPASTA_HANDLER)
dispatcher.add_handler(COPYPASTA_ALIAS_HANDLER)
dispatcher.add_handler(CLAPMOJI_HANDLER)
dispatcher.add_handler(CLAPMOJI_ALIAS_HANDLER)
dispatcher.add_handler(ANGRYMOJI_HANDLER)
예제 #30
0
    if message.reply_to_message:
        message.reply_to_message.reply_text(rhappy)
    else:
        message.reply_text(rhappy)


@run_async
def rangry(bot: Bot, update: Update):
    message = update.effective_message
    rangry = random.choice(reactionangry)
    if message.reply_to_message:
        message.reply_to_message.reply_text(rangry)
    else:
        message.reply_text(rangry)


__help__ = """
- Reply to a text with /react for normal reactions
- You can also use /happy and /amgery for happy and angry emotions
"""

__mod_name__ = "Reactions"

REACT_HANDLER = DisableAbleCommandHandler("react", react)
RHAPPY_HANDLER = DisableAbleCommandHandler("happy", rhappy)
RANGRY_HANDLER = DisableAbleCommandHandler("amgery", rangry)

dispatcher.add_handler(REACT_HANDLER)
dispatcher.add_handler(RHAPPY_HANDLER)
dispatcher.add_handler(RANGRY_HANDLER)