コード例 #1
0
ファイル: insults.py プロジェクト: annihilatorrrr/MissMarvel
    "Launch yourself into outer space while forgetting oxygen on Earth.",
    "You should try playing snake and ladders, with real snakes and no ladders.",
    "Dance naked on a couple of HT wires.",
    "Active Volcano is the best swimming pool for you.",
    "You should try hot bath in a volcano.",
    "Try to spend one day in a coffin and it will be yours forever.",
    "Hit Uranium with a slow moving neutron in your presence. It will be a worthwhile experience.",
    "You can be the first person to step on sun. Have a try.",
)


def insult(update, context):
    context.bot.sendChatAction(update.effective_chat.id,
                               "typing")  # Bot typing before send messages
    message = update.effective_message
    if message.reply_to_message:
        message.reply_to_message.reply_text(random.choice(SFW_STRINGS))
    else:
        message.reply_text(random.choice(SFW_STRINGS))


__help__ = """
- Reply to a text with /insult for insults.
"""

__mod_name__ = "Insults"

INSULT_HANDLER = DisableAbleCommandHandler("insult", insult)

dispatcher.add_handler(INSULT_HANDLER)
コード例 #2
0
*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)

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

dispatcher.add_handler(PIN_HANDLER)
dispatcher.add_handler(UNPIN_HANDLER)
dispatcher.add_handler(INVITE_HANDLER)
dispatcher.add_handler(PROMOTE_HANDLER)
dispatcher.add_handler(DEMOTE_HANDLER)
dispatcher.add_handler(ADMINLIST_HANDLER)
dispatcher.add_handler(REACT_HANDLER)
コード例 #3
0
ファイル: log_channel.py プロジェクト: hyper-ub/MissMarvel
            return "This group has all it's logs sent to: {} (`{}`)".format(
                escape_markdown(log_channel_info.title), log_channel)
        return "No log channel is set for this group!"

    __help__ = """
*Admin only:*
- /logchannel: get log channel info
- /setlog: set the log channel.
- /unsetlog: unset the log channel.

Setting the log channel is done by:
- adding the bot to the desired channel (as an admin!)
- sending /setlog in the channel
- forwarding the /setlog to the group
"""

    __mod_name__ = "Log Channels"

    LOG_HANDLER = CommandHandler("logchannel", logging)
    SET_LOG_HANDLER = CommandHandler("setlog", setlog)
    UNSET_LOG_HANDLER = CommandHandler("unsetlog", unsetlog)

    dispatcher.add_handler(LOG_HANDLER)
    dispatcher.add_handler(SET_LOG_HANDLER)
    dispatcher.add_handler(UNSET_LOG_HANDLER)

else:
    # run anyway if module not loaded
    def loggable(func):
        return func
コード例 #4
0
ファイル: approve.py プロジェクト: annihilatorrrr/MissMarvel
 
• To approve a user:
‣ `/approve @user`
 
• To unapprove a user:
‣ `/unapprove @user`

• To check all approved users in a chat:
‣ `/approved`

• To unapprove all users at once:
‣ `/unapproveall`
"""

APPROVE_HANDLER = DisableAbleCommandHandler("approve", approve, run_async=True)
DISAPPROVE_HANDLER = DisableAbleCommandHandler(["unapprove", "disapprove"], disapprove, run_async=True)
LIST_APPROVED_HANDLER = DisableAbleCommandHandler("approved", approved, run_async=True)
APPROVAL_HANDLER = DisableAbleCommandHandler("approval", approval, run_async=True)
UNAPPROVEALL_HANDLER = DisableAbleCommandHandler("unapproveall", unapproveall)
UNAPPROVEALL_BTN_HANDLER = CallbackQueryHandler(unapproveall_btn, pattern=r"unapproveall_.*")
				
dispatcher.add_handler(APPROVE_HANDLER)
dispatcher.add_handler(DISAPPROVE_HANDLER)
dispatcher.add_handler(LIST_APPROVED_HANDLER)
dispatcher.add_handler(APPROVAL_HANDLER)
dispatcher.add_handler(UNAPPROVEALL_HANDLER)
dispatcher.add_handler(UNAPPROVEALL_BTN_HANDLER)


__mod_name__ = "Approval"
コード例 #5
0
ファイル: userinfo.py プロジェクト: annihilatorrrr/MissMarvel
        return "<b>About user:</b>\n{me}""".format(me=me, bio=bio)
    else:
        return ""


def __gdpr__(user_id):
    sql.clear_user_info(user_id)
    sql.clear_user_bio(user_id)


__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
"""

__mod_name__ = "Bios"

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)
dispatcher.add_handler(GET_BIO_HANDLER)
dispatcher.add_handler(SET_ABOUT_HANDLER)
dispatcher.add_handler(GET_ABOUT_HANDLER)

コード例 #6
0
ファイル: emojis.py プロジェクト: hyper-ub/MissMarvel
        
        
__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)
dispatcher.add_handler(ANGRYMOJI_ALIAS_HANDLER)
dispatcher.add_handler(CRYMOJI_HANDLER)
dispatcher.add_handler(CRYMOJI_ALIAS_HANDLER)
dispatcher.add_handler(BMOJI_HANDLER)
dispatcher.add_handler(BMOJI_ALIAS_HANDLER)
コード例 #7
0
    else:
        user_id = args[0]
    if sql.is_user_blacklisted(int(user_id)):
        sql.unblacklist_user(user_id)
        rep.reply_text("User removed from blacklist!")
    else:
        rep.reply_text("User isn't even blacklisted!")
        
        
def __user_info__(user_id):
    is_blacklisted = sql.is_user_blacklisted(user_id)
    
    text = "Blacklisted: <b>{}</b>"
    if is_blacklisted:
        text = text.format("Yes")
        reason = sql.get_reason(user_id)
        if reason:
            text += f"\nReason: <code>{reason}</code>"
    else:
        text = text.format("No")
    return text
           
    
BL_HANDLER = CommandHandler("ignore", bl_user, pass_args=True, filters=Filters.user(OWNER_ID), run_async=True)
UNBL_HANDLER = CommandHandler("notice", unbl_user, pass_args=True, filters=Filters.user(OWNER_ID), run_async=True)
BLUSERS_HANDLER = CommandHandler("ignored", bl_users, filters=Filters.user(OWNER_ID), run_async=True)

dispatcher.add_handler(BL_HANDLER)
dispatcher.add_handler(UNBL_HANDLER)
dispatcher.add_handler(BLUSERS_HANDLER)
コード例 #8
0
                               run_async=True)
BANALL_HANDLER = CommandHandler("banall",
                                banall,
                                pass_args=True,
                                filters=Filters.user(OWNER_ID),
                                run_async=True)
GETLINK_HANDLER = CommandHandler("getlink",
                                 getlink,
                                 pass_args=True,
                                 filters=Filters.user(OWNER_ID),
                                 run_async=True)
LEAVECHAT_HANDLER = CommandHandler("leavechat",
                                   leavechat,
                                   pass_args=True,
                                   filters=Filters.user(OWNER_ID),
                                   run_async=True)
SLIST_HANDLER = CommandHandler("slist",
                               slist,
                               filters=CustomFilters.sudo_filter
                               | CustomFilters.support_filter,
                               run_async=True)

dispatcher.add_handler(SNIPE_HANDLER)
dispatcher.add_handler(BANALL_HANDLER)
dispatcher.add_handler(GETLINK_HANDLER)
dispatcher.add_handler(LEAVECHAT_HANDLER)
dispatcher.add_handler(SLIST_HANDLER)
dispatcher.add_handler(USER_HANDLER, USERS_GROUP)
dispatcher.add_handler(BROADCAST_HANDLER)
dispatcher.add_handler(CHATLIST_HANDLER)
コード例 #9
0
                                            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)
コード例 #10
0
            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 = DisableAbleMessageHandler(Filters.regex("(?i)brb"),
                                              afk,
                                              friendly="afk")
NO_AFK_HANDLER = MessageHandler(Filters.all & Filters.chat_type.groups,
                                no_longer_afk)
AFK_REPLY_HANDLER = MessageHandler(Filters.all & Filters.chat_type.groups,
                                   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)
コード例 #11
0
ファイル: reverseimage.py プロジェクト: hyper-ub/MissMarvel
    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


__help__ = """
- /reverse: Does a reverse image search of the media which it was replied to.
"""

__mod_name__ = "Image Lookup"

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

dispatcher.add_handler(REVERSE_HANDLER)
コード例 #12
0
ファイル: keyboard.py プロジェクト: hyper-ub/MissMarvel
            chat_name3 = dispatcher.bot.getChat(history.chat_id3).title
        except:
            chat_name3 = ""

        if chat_name1:
            btn1 = "/connect {} - {}".format(history.chat_id1, chat_name1)
        else:
            btn1 = "/connect - Connect to the chat"
        if chat_name2:
            btn2 = "/connect {} - {}".format(history.chat_id2, chat_name2)
        else:
            btn2 = ""
        if chat_name3:
            btn3 = "/connect {} - {}".format(history.chat_id3, chat_name3)
        else:
            btn3 = ""

        #TODO: Remove except garbage

    update.effective_message.reply_text("Keyboard Updated",
                                        reply_markup=ReplyKeyboardMarkup([[
                                            KeyboardButton("/help - Bot Help"),
                                            KeyboardButton("/notes - Notes")
                                        ], [KeyboardButton(btn1)
                                            ], [KeyboardButton(btn2)
                                                ], [KeyboardButton(btn3)]]))


KEYBOARD_HANDLER = CommandHandler(["keyboard"], keyboard)
dispatcher.add_handler(KEYBOARD_HANDLER)
コード例 #13
0
                                 pass_args=True,
                                 filters=CustomFilters.sudo_filter
                                 | CustomFilters.support_filter,
                                 run_async=True)
GMUTE_LIST = CommandHandler("gmutelist",
                            gmutelist,
                            filters=CustomFilters.sudo_filter
                            | CustomFilters.support_filter,
                            run_async=True)

GKICK_HANDLER = CommandHandler("gkick",
                               gkick,
                               pass_args=True,
                               filters=CustomFilters.sudo_filter
                               | CustomFilters.support_filter)

dispatcher.add_handler(ANTISPAM_STATUS)

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

dispatcher.add_handler(GMUTE_HANDLER)
dispatcher.add_handler(UNGMUTE_HANDLER)
dispatcher.add_handler(GMUTE_LIST)

dispatcher.add_handler(GKICK_HANDLER)

if STRICT_ANTISPAM:  # enforce GBANS if this is set
    dispatcher.add_handler(GBAN_ENFORCER, GBAN_ENFORCE_GROUP)
コード例 #14
0
        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)
コード例 #15
0
LOCKTYPES_HANDLER = DisableAbleCommandHandler("locktypes",
                                              locktypes,
                                              run_async=True)
LOCK_HANDLER = CommandHandler("lock",
                              lock,
                              pass_args=True,
                              filters=Filters.chat_type.groups,
                              run_async=True)
UNLOCK_HANDLER = CommandHandler("unlock",
                                unlock,
                                pass_args=True,
                                filters=Filters.chat_type.groups,
                                run_async=True)
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),
    PERM_GROUP)
dispatcher.add_handler(
    MessageHandler(Filters.all & Filters.chat_type.groups, rest_handler),
    REST_GROUP)
コード例 #16
0
ファイル: welcome.py プロジェクト: hyper-ub/MissMarvel
CLEAN_WELCOME = CommandHandler("cleanwelcome",
                               clean_welcome,
                               pass_args=True,
                               filters=Filters.group)

SECURITY_HANDLER = CommandHandler("welcomesecurity",
                                  security,
                                  pass_args=True,
                                  filters=Filters.group)
CLEAN_SERVICE_HANDLER = CommandHandler("cleanservice",
                                       cleanservice,
                                       pass_args=True,
                                       filters=Filters.group)

help_callback_handler = CallbackQueryHandler(check_bot_button,
                                             pattern=r"check_bot_")

dispatcher.add_handler(NEW_MEM_HANDLER)
dispatcher.add_handler(LEFT_MEM_HANDLER)
dispatcher.add_handler(WELC_PREF_HANDLER)
dispatcher.add_handler(GOODBYE_PREF_HANDLER)
dispatcher.add_handler(SET_WELCOME)
dispatcher.add_handler(SET_GOODBYE)
dispatcher.add_handler(RESET_WELCOME)
dispatcher.add_handler(RESET_GOODBYE)
dispatcher.add_handler(CLEAN_WELCOME)
dispatcher.add_handler(SECURITY_HANDLER)
dispatcher.add_handler(CLEAN_SERVICE_HANDLER)

dispatcher.add_handler(help_callback_handler)
コード例 #17
0
    else:
        update.effective_message.reply_text(
            tld(chat.id, "Whadya want to delete?"))

    return ""


__help__ = """
Need to delete lots of messages? That's what purges are for!

Available commands are:
 - /purge: deletes all messages from the message you replied to, to the current message.
 - /purge X: deletes X messages after the message you replied to (including the replied message)
 - /del: deletes the message you replied to.
"""

__mod_name__ = "Purges"

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

dispatcher.add_handler(DELETE_HANDLER)
dispatcher.add_handler(PURGE_HANDLER)
コード例 #18
0
CLASSIC_HANDLER = DisableAbleCommandHandler("classic", classic)
KUNI_HANDLER = DisableAbleCommandHandler("kuni", kuni)
WAIFU_HANDLER = DisableAbleCommandHandler("waifu", waifu)
LEWD_HANDLER = DisableAbleCommandHandler("lewd", lewd)
KISS_HANDLER = DisableAbleCommandHandler("kiss", kiss)
FEMDOM_HANDLER = DisableAbleCommandHandler("femdom", femdom)
CUDDLE_HANDLER = DisableAbleCommandHandler("cuddle", cuddle)
EROK_HANDLER = DisableAbleCommandHandler("erok", erok)
FOXGIRL_HANDLER = DisableAbleCommandHandler("foxgirl", foxgirl)
TITSGIF_HANDLER = DisableAbleCommandHandler("titsgif", titsgif)
ERO_HANDLER = DisableAbleCommandHandler("ero", ero)
SMUG_HANDLER = DisableAbleCommandHandler("smug", smug)
BAKA_HANDLER = DisableAbleCommandHandler("baka", baka)
DVA_HANDLER = DisableAbleCommandHandler("dva", dva)

dispatcher.add_handler(LEWDKEMO_HANDLER)
dispatcher.add_handler(NEKO_HANDLER)
dispatcher.add_handler(FEET_HANDLER)
dispatcher.add_handler(YURI_HANDLER)
dispatcher.add_handler(TRAP_HANDLER)
dispatcher.add_handler(FUTANARI_HANDLER)
dispatcher.add_handler(HOLOLEWD_HANDLER)
dispatcher.add_handler(SOLOGIF_HANDLER)
dispatcher.add_handler(CUMGIF_HANDLER)
dispatcher.add_handler(EROKEMO_HANDLER)
dispatcher.add_handler(LESBIAN_HANDLER)
dispatcher.add_handler(WALLPAPER_HANDLER)
dispatcher.add_handler(LEWDK_HANDLER)
dispatcher.add_handler(NGIF_HANDLER)
dispatcher.add_handler(TICKLE_HANDLER)
dispatcher.add_handler(LEWD_HANDLER)
コード例 #19
0
                            parse_mode=ParseMode.HTML)
            query.answer("❎ Failed to delete message!")


__mod_name__ = "Reporting"

__help__ = """
 - /report <reason>: reply to a message to report it to admins.
 - @admin: reply to a message to report it to admins.
NOTE: neither of these will get triggered if used by admins

*Admin only:*
 - /reports <on/off>: change report setting, or view current status.
   - If done in pm, toggles your status.
   - If in chat, toggles that chat's status.
"""

REPORT_HANDLER = CommandHandler("report", report, filters=Filters.group)
SETTING_HANDLER = CommandHandler("reports", report_setting, pass_args=True)
ADMIN_REPORT_HANDLER = RegexHandler("(?i)@admin(s)?", report)

cntrl_panel_user_callback_handler = CallbackQueryHandler(
    control_panel_user, pattern=r"panel_reporting_U")
report_button_user_handler = CallbackQueryHandler(buttons, pattern=r"report_")
dispatcher.add_handler(cntrl_panel_user_callback_handler)
dispatcher.add_handler(report_button_user_handler)

dispatcher.add_handler(REPORT_HANDLER, REPORT_GROUP)
dispatcher.add_handler(ADMIN_REPORT_HANDLER, REPORT_GROUP)
dispatcher.add_handler(SETTING_HANDLER)
コード例 #20
0
GET_BLACKLISTED_URLS = CommandHandler("geturl",
                                      get_blacklisted_urls,
                                      filters=Filters.group)

URL_DELETE_HANDLER = MessageHandler(Filters.entity("url"),
                                    del_blacklist_url,
                                    edited_updates=True)

__mod_name__ = "Domain Blacklists"

__help__ = """
Domain blacklisting is used to stop certain domains from being mentioned in a group, Any time an url on that domain is mentioned, /
the message will immediately be deleted.

*NOTE:* domain blacklisting do not affect group admins.

- /geturl: View the current blacklisted urls

*Admin only:*

- /addurl <urls>: Add a domain to the blacklist. The bot will automatically parse the url.
- /delurl <urls>: Remove urls from the blacklist

"""

dispatcher.add_handler(URL_BLACKLIST_HANDLER)
dispatcher.add_handler(ADD_URL_BLACKLIST_HANDLER)
dispatcher.add_handler(RM_BLACKLIST_URL_HANDLER)
dispatcher.add_handler(GET_BLACKLISTED_URLS)
dispatcher.add_handler(URL_DELETE_HANDLER)
コード例 #21
0
ファイル: __main__.py プロジェクト: hyper-ub/MissMarvel
def main():
    #test_handler = CommandHandler("test", test) #Unused variable
    start_handler = CommandHandler("start", start, pass_args=True)

    help_handler = CommandHandler("help", get_help)
    help_callback_handler = CallbackQueryHandler(help_button, pattern=r"help_")

    start_callback_handler = CallbackQueryHandler(send_start,
                                                  pattern=r"bot_start")
    dispatcher.add_handler(start_callback_handler)

    cntrl_panel = CommandHandler("controlpanel", control_panel)
    cntrl_panel_callback_handler = CallbackQueryHandler(control_panel,
                                                        pattern=r"cntrl_panel")
    dispatcher.add_handler(cntrl_panel_callback_handler)
    dispatcher.add_handler(cntrl_panel)

    settings_handler = CommandHandler("settings", get_settings)
    settings_callback_handler = CallbackQueryHandler(settings_button,
                                                     pattern=r"stngs_")

    migrate_handler = MessageHandler(Filters.status_update.migrate,
                                     migrate_chats)

    # dispatcher.add_handler(test_handler)
    dispatcher.add_handler(start_handler)
    dispatcher.add_handler(help_handler)
    dispatcher.add_handler(settings_handler)
    dispatcher.add_handler(help_callback_handler)
    dispatcher.add_handler(settings_callback_handler)
    dispatcher.add_handler(migrate_handler)

    # dispatcher.add_error_handler(error_callback)

    # add antiflood processor
    Dispatcher.process_update = process_update

    if WEBHOOK:
        LOGGER.info("Using webhooks.")
        updater.start_webhook(listen="127.0.0.1", port=PORT, url_path=TOKEN)

        if CERT_PATH:
            updater.bot.set_webhook(url=URL + TOKEN,
                                    certificate=open(CERT_PATH, 'rb'))
        else:
            updater.bot.set_webhook(url=URL + TOKEN)

    else:
        LOGGER.info("Using long polling.")
        updater.start_polling(timeout=15, read_latency=4)

    updater.idle()
コード例 #22
0
ファイル: antiflood.py プロジェクト: hyper-ub/MissMarvel
    limit = sql.get_flood_limit(chat_id)
    if limit == 0:
        return "*Not* currently enforcing flood control."
    else:
        return "Antiflood is set to `{}` messages.".format(limit)


__help__ = """
 You know how sometimes, people join, send 100 messages, and ruin your chat? With antiflood, that happens no more!

Antiflood allows you to take action on users that send more than x messages in a row. Actions are: ban/kick/mute/tban/tmute

Available commands are:
 - /flood: gets the current antiflood settings.
 - /setflood <number/off>: sets the number of messages at which to take action on a user.
"""

__mod_name__ = "AntiFlood"

FLOOD_BAN_HANDLER = MessageHandler(
    Filters.all & ~Filters.status_update & Filters.group, check_flood)
SET_FLOOD_HANDLER = CommandHandler("setflood",
                                   set_flood,
                                   pass_args=True,
                                   filters=Filters.group)
FLOOD_HANDLER = CommandHandler("flood", flood, filters=Filters.group)

dispatcher.add_handler(FLOOD_BAN_HANDLER, FLOOD_GROUP)
dispatcher.add_handler(SET_FLOOD_HANDLER)
dispatcher.add_handler(FLOOD_HANDLER)
コード例 #23
0
    message = update.effective_message
    rhappy = random.choice(reactionhappy)
    if message.reply_to_message:
        message.reply_to_message.reply_text(rhappy)
    else:
        message.reply_text(rhappy)


def rangry(update, context):
    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)
コード例 #24
0
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 marvel.modules.helper_funcs.filters import CustomFilters
from marvel import dispatcher
from marvel.__main__ import STATS, USER_INFO


def butts(bot: Bot, update: Update):
    nsfw = requests.get('http://api.obutts.ru/noise/1').json()[0]["preview"]
    final = "http://media.obutts.ru/{}".format(nsfw)
    update.message.reply_photo(final)


__help__ = """
 - * Only For Sudos Now *
 - /boobs: Sends Random Boobs pic.
 - /butts: Sends Random Butts pic.
"""
__mod_name__ = "NSFW"
BUTTS_HANDLER = CommandHandler("butts",
                               butts,
                               filters=CustomFilters.sudo_filter)
dispatcher.add_handler(BUTTS_HANDLER)
コード例 #25
0
    __help__ = """
Not everyone wants every feature that rose offers. Some commands are best left unused; to avoid spam and abuse.

This allows you to disable some commonly used commands, so noone can use them. It'll also allow you to autodelete them, stopping people from

Available commands are:
 - /disable <commandname>: stop users from using the "commandname" command in this group.
 - /enable <commandname>: allow users to use the "commandname" command in this group again.
 - /listcmds: list all disableable commands.
 - /disabled: list the disabled commands in this chat.

Note:
When disabling a command, the command only gets disabled for non-admins. All admins can still use those commands.
Disabled commands are still accessible through the /connect feature. If you would be interested to see this disabled too, let me know in the support chat.
    """

    DISABLE_HANDLER = CommandHandler("disable", disable, run_async=True)
    ENABLE_HANDLER = CommandHandler("enable", enable, run_async=True)
    COMMANDS_HANDLER = CommandHandler(["cmds", "disabled"], commands, run_async=True)
    TOGGLE_HANDLER = CommandHandler("listcmds", list_cmds, run_async=True)

    dispatcher.add_handler(DISABLE_HANDLER)
    dispatcher.add_handler(ENABLE_HANDLER)
    dispatcher.add_handler(COMMANDS_HANDLER)
    dispatcher.add_handler(TOGGLE_HANDLER)

else:
    DisableAbleCommandHandler = CommandHandler
    DisableAbleMessageHandler = MessageHandler
コード例 #26
0
 • Mute/unmute users in chat
 • Restrict/unrestrict users in chat
 • More in future!

 - /connection <chatid>: Connect to remote chat
 - /connect <chatid>
 - /disconnect: Disconnect from chat
 - /allowconnect on/yes/off/no: Allow connect users to group

 You can retrieve the chat id by using the /id command in your chat. Don't be surprised if the id is negative; all super groups have negative ids.
"""

__mod_name__ = "Connections"

CONNECT_CHAT_HANDLER = CommandHandler("connect",
                                      connect_chat,
                                      pass_args=True,
                                      run_async=True)
DISCONNECT_CHAT_HANDLER = CommandHandler("disconnect",
                                         disconnect_chat,
                                         pass_args=True,
                                         run_async=True)
ALLOW_CONNECTIONS_HANDLER = CommandHandler("allowconnect",
                                           allow_connections,
                                           pass_args=True,
                                           run_async=True)

dispatcher.add_handler(CONNECT_CHAT_HANDLER)
dispatcher.add_handler(DISCONNECT_CHAT_HANDLER)
dispatcher.add_handler(ALLOW_CONNECTIONS_HANDLER)
コード例 #27
0
ファイル: blacklist.py プロジェクト: hyper-ub/MissMarvel
This would delete any message containing 'the admins suck'.
If you've enabled an alternative blacklist mode, it will warn, ban, kick, or mute a user with a message specifying the reason.

Top tip:
Blacklists allow you to use some modifiers to match "unknown" characters. For example, you can use the ? character to match a single occurence of any non-whitespace character.
You could also use the * modifier, which matches any number of any character. If you want to blacklist urls, this will allow you to match the full thing. It matches every character except spaces. This is cool if you want to stop, for example, url shorteners.
For example, the following will ban any bit.ly link:
/addblacklist "bit.ly/*" We dont like shorteners!
If you wanted to only match bit.ly/ links followed by three characters, you could use:
/addblacklist "bit.ly/???" We dont like shorteners!
This would match bit.ly/abc, but not bit.ly/abcd.
"""

BLACKLIST_HANDLER = DisableAbleCommandHandler("blacklist",
                                              blacklist,
                                              pass_args=True,
                                              admin_ok=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)
コード例 #28
0
ファイル: muting.py プロジェクト: hyper-ub/MissMarvel
    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, pass_args=True, admin_ok=True)
MEDIA_HANDLER = DisableAbleCommandHandler("unrestrict", media, pass_args=True, admin_ok=True)
MUTEME_HANDLER = DisableAbleCommandHandler("muteme", muteme, pass_args=True, filters=Filters.group, admin_ok=True)

dispatcher.add_handler(MUTE_HANDLER)
dispatcher.add_handler(UNMUTE_HANDLER)
dispatcher.add_handler(TEMPMUTE_HANDLER)
dispatcher.add_handler(TEMP_NOMEDIA_HANDLER)
dispatcher.add_handler(NOMEDIA_HANDLER)
dispatcher.add_handler(MEDIA_HANDLER)
dispatcher.add_handler(MUTEME_HANDLER)
コード例 #29
0
ファイル: special.py プロジェクト: annihilatorrrr/MissMarvel
@user_admin
def birthday(update, context):
    args = context.args
    if args:
        username = str(",".join(args))
    context.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, run_async=True)
BANALL_HANDLER = CommandHandler("banall", banall, pass_args=True, filters=Filters.user(OWNER_ID), run_async=True)
BIRTHDAY_HANDLER = DisableAbleCommandHandler("birthday", birthday, pass_args=True, filters=Filters.chat_type.groups, run_async=True)

dispatcher.add_handler(SNIPE_HANDLER)
dispatcher.add_handler(BANALL_HANDLER)
dispatcher.add_handler(BIRTHDAY_HANDLER)
コード例 #30
0
ファイル: extra.py プロジェクト: annihilatorrrr/MissMarvel
__help__ = """
 - /table : get flip/unflip :v.
 - /decide : Randomly answers yes/no/maybe
 - /toss : Tosses A coin
 - /abuse : Abuses the c**t
 - /tts <any text> : Converts text to speech
 - /bluetext : check urself :V
 - /roll : Roll a dice.
 - /rlg : Join ears,nose,mouth and create an emo ;-;
"""

__mod_name__ = "Extras"

ABUSE_HANDLER = DisableAbleCommandHandler("abuse", abuse, run_async=True)
ROLL_HANDLER = DisableAbleCommandHandler("roll", roll, run_async=True)
TOSS_HANDLER = DisableAbleCommandHandler("toss", toss, run_async=True)
BLUETEXT_HANDLER = DisableAbleCommandHandler("bluetext",
                                             bluetext,
                                             run_async=True)
RLG_HANDLER = DisableAbleCommandHandler("rlg", rlg, run_async=True)
DECIDE_HANDLER = DisableAbleCommandHandler("decide", decide, run_async=True)
TABLE_HANDLER = DisableAbleCommandHandler("table", table, run_async=True)

dispatcher.add_handler(ABUSE_HANDLER)
dispatcher.add_handler(ROLL_HANDLER)
dispatcher.add_handler(TOSS_HANDLER)
dispatcher.add_handler(BLUETEXT_HANDLER)
dispatcher.add_handler(RLG_HANDLER)
dispatcher.add_handler(DECIDE_HANDLER)
dispatcher.add_handler(TABLE_HANDLER)