Exemplo n.º 1
0
            "*Ejemplo:* `/tr en-es` Para traducir del inglés al español\n\n"
            "Para ver la lista de códigos de idioma puedes hacer click [aquí](http://t.me/CrimsonMeguRobot?start=ghelp_traductor).",
            parse_mode="markdown",
            disable_web_page_preview=True,
        )
    except ValueError:
        update.effective_message.reply_text(
            "No se encontró el idioma deseado!")
    else:
        return


__help__ = """
• `/tr` o `/tl` <código de idioma> Como respuesta a un mensaje largo. (Traducción predeterminada en español)
*Ejemplos:* 
`/tr en`: Traduce algo al inglés.
`/tr en-es`: Traduce del inglés al español.

*Lista de códigos de idioma:*\n\n`af`,`am`,`ar`,`az`,`be`,`bg`,`bn`,`bs`,`ca`,`ceb`,`co`,`cs`,`cy`,`da`,`de`,`el`,`en`,`eo`,`es`,`et`,`eu`,`fa`,`fi`,`fr`,`fy`,`ga`,`gd`,`gl`,`gu`,`ha`,`haw`,`hi`,`hmn`,`hr`,`ht`,`hu`,`hy`,`id`,`ig`,`is`,`it`,`iw`,`ja`,`jw`,`ka`,`kk`,`km`,`kn`,`ko`,`ku`,`ky`,`la`,`lb`,`lo`,`lt`,`lv`,`mg`,`mi`,`mk`,`ml`,`mn`,`mr`,`ms`,`mt`,`my`,`ne`,`nl`,`no`,`ny`,`pa`,`pl`,`ps`,`pt`,`ro`,`ru`,`sd`,`si`,`sk`,`sl`,`sm`,`sn`,`so`,`sq`,`sr`,`st`,`su`,`sv`,`sw`,`ta`,`te`,`tg`,`th`,`tl`,`tr`,`uk`,`ur`,`uz`,`vi`,`xh`,`yi`,`yo`,`zh`,`zh_CN`,`zh_TW`,`zu`
"""

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

dispatcher.add_handler(TRANSLATE_HANDLER)

__mod_name__ = "Traductor"
__command_list__ = ["tr", "tl"]
__handlers__ = [TRANSLATE_HANDLER]
Exemplo n.º 2
0
                        f"\n-{event.from_id} ({event.chat_id}) : {event.text}")
        else:
            with open("updates.txt", "w+") as f:
                f.write(
                    f"- {event.from_id} ({event.chat_id}) : {event.text} | {datetime.datetime.now()}"
                )


support_chat = os.getenv("SUPPORT_CHAT")


@dev_plus
def logs(update: Update, context: CallbackContext):
    user = update.effective_user
    msg = update.effective_message
    with open("log.txt", "rb") as f:
        context.bot.send_document(document=f, filename=f.name, chat_id=user.id)
    msg.reply_text("[Logs enviados](tg://user?id={})".format(context.bot.id),
                   parse_mode=ParseMode.MARKDOWN)


LOG_HANDLER = CommandHandler("logs", logs, run_async=True)
dispatcher.add_handler(LOG_HANDLER)

DEBUG_HANDLER = CommandHandler("debug", debug, run_async=True)
dispatcher.add_handler(DEBUG_HANDLER)

__mod_name__ = "Debug"
__command_list__ = ["debug"]
__handlers__ = [DEBUG_HANDLER]
Exemplo n.º 3
0
*Nota:* Los nombres de las notas no distinguen entre mayúsculas y minúsculas y se convierten automáticamente a minúsculas antes de minúsculas
"""

__mod_name__ = "Notas"

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

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

CLEARALL = DisableAbleCommandHandler("removeallnotes", clearall)
CLEARALL_BTN = CallbackQueryHandler(clearall_btn, pattern=r"notes_.*")

dispatcher.add_handler(GET_HANDLER)
dispatcher.add_handler(SAVE_HANDLER)
dispatcher.add_handler(LIST_HANDLER)
dispatcher.add_handler(DELETE_HANDLER)
dispatcher.add_handler(HASH_GET_HANDLER)
dispatcher.add_handler(CLEARALL)
dispatcher.add_handler(CLEARALL_BTN)

__command_list__ = ["get", "save", "clear", "notes", "saved", "removeallnotes"]
Exemplo n.º 4
0
                 "<b>Tiempo tomado:</b> <code>{}</code>\n"
                 "<b>Tiempo en servicio:</b> <code>{}</code>".format(
                     telegram_ping, uptime))

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


def pingall(update: Update, context: CallbackContext):
    to_ping = ["Kaizoku", "Kayo", "Telegram", "Jikan"]
    pinged_list = ping_func(to_ping)
    pinged_list.insert(2, "")
    uptime = get_readable_time((time.time() - StartTime))

    reply_msg = "⏱Resultados de ping:\n"
    reply_msg += "\n".join(pinged_list)
    reply_msg += "\n<b>Tiempo en servicio:</b> <code>{}</code>".format(uptime)

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


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

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

__command_list__ = ["ping", "pingall"]
__handlers__ = [PING_HANDLER, PINGALL_HANDLER]
Exemplo n.º 5
0
 •`/allowconnect <yes/no>`: Permite que un usuario se conecte a un grupo
"""

CONNECT_CHAT_HANDLER = CommandHandler("connect",
                                      connect_chat,
                                      pass_args=True,
                                      run_async=True)
CONNECTION_CHAT_HANDLER = CommandHandler("connection",
                                         connection_chat,
                                         run_async=True)
DISCONNECT_CHAT_HANDLER = CommandHandler("disconnect",
                                         disconnect_chat,
                                         run_async=True)
ALLOW_CONNECTIONS_HANDLER = CommandHandler("allowconnect",
                                           allow_connections,
                                           pass_args=True,
                                           run_async=True)
HELP_CONNECT_CHAT_HANDLER = CommandHandler("helpconnect",
                                           help_connect_chat,
                                           run_async=True)
CONNECT_BTN_HANDLER = CallbackQueryHandler(connect_button,
                                           pattern=r"connect",
                                           run_async=True)

dispatcher.add_handler(CONNECT_CHAT_HANDLER)
dispatcher.add_handler(CONNECTION_CHAT_HANDLER)
dispatcher.add_handler(DISCONNECT_CHAT_HANDLER)
dispatcher.add_handler(ALLOW_CONNECTIONS_HANDLER)
dispatcher.add_handler(HELP_CONNECT_CHAT_HANDLER)
dispatcher.add_handler(CONNECT_BTN_HANDLER)
Exemplo n.º 6
0
    is_blacklisted = sql.is_user_blacklisted(user_id)

    text = "<b>Lista Negra:</b> <code>{}</code>"
    if user_id in [777000, 1087968824]:
        return ""
    if user_id == dispatcher.bot.id:
        return ""
    if int(user_id) in SUDO_USERS + FROG_USERS + WHITELIST_USERS:
        return ""
    if is_blacklisted:
        text = text.format("Si")
        reason = sql.get_reason(user_id)
        if reason:
            text += f"\nRazón: <code>{reason}</code>"
    else:
        text = text.format("No")

    return text


BL_HANDLER = CommandHandler("ignore", bl_user, run_async=True)
UNBL_HANDLER = CommandHandler("notice", unbl_user, run_async=True)
BLUSERS_HANDLER = CommandHandler("ignoredlist", bl_users, run_async=True)

dispatcher.add_handler(BL_HANDLER)
dispatcher.add_handler(UNBL_HANDLER)
dispatcher.add_handler(BLUSERS_HANDLER)

__mod_name__ = "BlackList de Usuarios"
__handlers__ = [BL_HANDLER, UNBL_HANDLER, BLUSERS_HANDLER]
Exemplo n.º 7
0
 •`/upcoming`*: * Devuelve una lista de nuevos animes en las próximas temporadas.
 •`/airing <anime>`*:* Devuelve información de emisión de anime.
 •`/whatanime`*:* Busca un anime respondiendo a un GIF, vídeo o imagen de una captura de un capítulo del Anime.
 """

AIRING_HANDLER = DisableAbleCommandHandler("airing", airing, run_async=True)
ANIME_HANDLER = DisableAbleCommandHandler("anime", anime, run_async=True)
CHARACTER_HANDLER = DisableAbleCommandHandler("character",
                                              character,
                                              run_async=True)
MANGA_HANDLER = DisableAbleCommandHandler("manga", manga, run_async=True)
UPCOMING_HANDLER = DisableAbleCommandHandler("upcoming",
                                             upcoming,
                                             run_async=True)

dispatcher.add_handler(ANIME_HANDLER)
dispatcher.add_handler(CHARACTER_HANDLER)
dispatcher.add_handler(MANGA_HANDLER)
dispatcher.add_handler(AIRING_HANDLER)
dispatcher.add_handler(UPCOMING_HANDLER)

__mod_name__ = "Anime"
__command_list__ = [
    "anime",
    "manga",
    "character",
    "upcoming",
    "airing",
]
__handlers__ = [
    ANIME_HANDLER,
Exemplo n.º 8
0
CLASSIC_HANDLER = CommandHandler("classic", classic, run_async=True)
KUNI_HANDLER = CommandHandler("kuni", kuni, run_async=True)
WAIFU_HANDLER = CommandHandler("waifu", waifu, run_async=True)
LEWD_HANDLER = CommandHandler("lewd", lewd, run_async=True)
KISS_HANDLER = CommandHandler("kiss", kiss, run_async=True)
FEMDOM_HANDLER = CommandHandler("femdom", femdom, run_async=True)
CUDDLE_HANDLER = CommandHandler("hug", hug, run_async=True)
EROK_HANDLER = CommandHandler("erok", erok, run_async=True)
FOXGIRL_HANDLER = CommandHandler("foxgirl", foxgirl, run_async=True)
TITSGIF_HANDLER = CommandHandler("titsgif", titsgif, run_async=True)
ERO_HANDLER = CommandHandler("ero", ero, run_async=True)
SMUG_HANDLER = CommandHandler("smug", smug, run_async=True)
BAKA_HANDLER = CommandHandler("baka", baka, run_async=True)
DVA_HANDLER = CommandHandler("dva", dva, run_async=True)

dispatcher.add_handler(ADD_NSFW_HANDLER)
dispatcher.add_handler(REMOVE_NSFW_HANDLER)
dispatcher.add_handler(LIST_NSFW_CHATS_HANDLER)
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(LEWDK_HANDLER)
dispatcher.add_handler(NGIF_HANDLER)
Exemplo n.º 9
0
import requests
from MeguRobot import dispatcher
from MeguRobot.modules.disable import DisableAbleCommandHandler
from telegram import ParseMode, Update
from telegram.ext import CallbackContext


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


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

dispatcher.add_handler(UD_HANDLER)

__command_list__ = ["ud"]
__handlers__ = [UD_HANDLER]
Exemplo n.º 10
0
            )


def list_errors(update: Update, context: CallbackContext):
    if update.effective_user.id not in DEV_USERS:
        return
    e = {
        k: v
        for k, v in sorted(
            errors.items(), key=lambda item: item[1], reverse=True)
    }
    msg = "<b>Lista de errores:</b>\n"
    for x in e:
        msg += f"• <code>{x}:</code> <b>{e[x]}</b> #{x.identifier}\n"
    msg += f"{len(errors)} errores han ocurrido desde el inicio del servicio."
    if len(msg) > 4096:
        with open("errors_msg.txt", "w+") as f:
            f.write(msg)
        context.bot.send_document(
            update.effective_chat.id,
            open("errors_msg.txt", "rb"),
            caption=f"Han ocurrido demasiados errores...",
            parse_mode="html",
        )
        return
    update.effective_message.reply_text(msg, parse_mode="html")


dispatcher.add_error_handler(error_callback)
dispatcher.add_handler(CommandHandler("errors", list_errors))
Exemplo n.º 11
0
*Reaccionar:*
 •`/react`: Reacciona con una reacción aleatoria
*Urban Dictonary(ENG):*
 •`/ud <palabra>` : Escriba la palabra o expresión que desea utilizar para la búsqueda
* Wikipedia: *
 •`/wiki <query>`: Busca en Wikipedia
*Convertidor de moneda:*
 •`/cash`: Convertidor de moneda
*Ejemplo:*
  `/cash 1 USD INR`
        O
  `/cash 1 usd inr`
*Salida:* `1.0 USD = 75.505 INR`
"""

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

dispatcher.add_handler(SAY_HANDLER)
dispatcher.add_handler(MD_HELP_HANDLER)

__mod_name__ = "Extras"
__command_list__ = ["say"]
__handlers__ = [
    SAY_HANDLER,
    MD_HELP_HANDLER,
]
Exemplo n.º 12
0
        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 hasta ahora)"

    msg.reply_text(rep, parse_mode=ParseMode.HTML)


__help__ = """
*Comandos disponibles:*
 •`/setuser <nombre de usuario>`: Establece tu nombre de usuario de Last.FM.
 •`/clearuser`: Elimina tu nombre de usuario de Last.FM del bot.
 •`/lastfm`: Devuelve lo que estás buscando en Last.FM.
"""

__mod_name__ = "Last.FM"

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

dispatcher.add_handler(SET_USER_HANDLER)
dispatcher.add_handler(CLEAR_USER_HANDLER)
dispatcher.add_handler(LASTFM_HANDLER)
Exemplo n.º 13
0
ADD_CLEAN_BLUE_TEXT_GLOBAL_HANDLER = CommandHandler(
    "gignoreblue", add_bluetext_ignore_global, run_async=True
)
REMOVE_CLEAN_BLUE_TEXT_GLOBAL_HANDLER = CommandHandler(
    "ungignoreblue", remove_bluetext_ignore_global, run_async=True
)
LIST_CLEAN_BLUE_TEXT_HANDLER = CommandHandler(
    "listblue", bluetext_ignore_list, run_async=True
)
CLEAN_BLUE_TEXT_HANDLER = MessageHandler(
    Filters.command & Filters.chat_type.groups,
    clean_blue_text_must_click,
    run_async=True,
)

dispatcher.add_handler(SET_CLEAN_BLUE_TEXT_HANDLER)
dispatcher.add_handler(ADD_CLEAN_BLUE_TEXT_HANDLER)
dispatcher.add_handler(REMOVE_CLEAN_BLUE_TEXT_HANDLER)
dispatcher.add_handler(ADD_CLEAN_BLUE_TEXT_GLOBAL_HANDLER)
dispatcher.add_handler(REMOVE_CLEAN_BLUE_TEXT_GLOBAL_HANDLER)
dispatcher.add_handler(LIST_CLEAN_BLUE_TEXT_HANDLER)
dispatcher.add_handler(CLEAN_BLUE_TEXT_HANDLER, BLUE_TEXT_CLEAN_GROUP)

__mod_name__ = "Cleaner"
__handlers__ = [
    SET_CLEAN_BLUE_TEXT_HANDLER,
    ADD_CLEAN_BLUE_TEXT_HANDLER,
    REMOVE_CLEAN_BLUE_TEXT_HANDLER,
    ADD_CLEAN_BLUE_TEXT_GLOBAL_HANDLER,
    REMOVE_CLEAN_BLUE_TEXT_GLOBAL_HANDLER,
    LIST_CLEAN_BLUE_TEXT_HANDLER,
Exemplo n.º 14
0
def __migrate__(old_chat_id, new_chat_id):
    sql.migrate_chat(old_chat_id, new_chat_id)


__help__ = ""  # no help string

BROADCAST_HANDLER = CommandHandler(
    ["broadcastall", "broadcastusers", "broadcastgroups"],
    broadcast,
    run_async=True)
USER_HANDLER = MessageHandler(Filters.all & Filters.chat_type.groups,
                              log_user,
                              run_async=True)
CHAT_CHECKER_HANDLER = MessageHandler(Filters.all & Filters.chat_type.groups,
                                      chat_checker,
                                      run_async=True)
CHATLIST_HANDLER = CommandHandler("groups", chats, run_async=True)

dispatcher.add_handler(USER_HANDLER, USERS_GROUP)
dispatcher.add_handler(BROADCAST_HANDLER)
dispatcher.add_handler(CHATLIST_HANDLER)
dispatcher.add_handler(CHAT_CHECKER_HANDLER, CHAT_GROUP)

__mod_name__ = "Users"
__handlers__ = [(USER_HANDLER, USERS_GROUP), BROADCAST_HANDLER,
                CHATLIST_HANDLER]

__command_list__ = [
    "broadcastall", "broadcastusers", "broadcastgroups", "groups"
]
Exemplo n.º 15
0
            wallpapers = json_rep.get("wallpapers")
            if not wallpapers:
                msg.reply_text("No se han encontrado resultados!")
                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="Vista Previa",
                    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,
                )


__mod_name__ = "Wallpapers"
WALLPAPER_HANDLER = DisableAbleCommandHandler("wall", wall, run_async=True)
dispatcher.add_handler(WALLPAPER_HANDLER)
__command_list__ = ["wall"]
Exemplo n.º 16
0
                user_id,
                chat.title,
                chat.id,
                excp.message,
            )
            message.reply_text(
                "Bueno maldita sea, no puedo silenciar a ese usuario.")

    return ""


__help__ = """
*Solo administradores:*
 •`/mute <userhandle>`: Silencia a un usuario. También se puede utilizar respondiendo al usuario.
 •`/tmute <userhandle> x (m/h/d)`: Silencia a un usuario por x tiempo. (a través del identificador o respuesta). `m`=`minutos`, `h`=`horas`, `d`=`días`.
 •`/unmute <userhandle>`: Desilencia a un usuario. También se puede utilizar respondiendo al usuario.
"""

MUTE_HANDLER = CommandHandler("mute", mute, run_async=True)
UNMUTE_HANDLER = CommandHandler("unmute", unmute, run_async=True)
TEMPMUTE_HANDLER = CommandHandler(["tmute", "tempmute"],
                                  temp_mute,
                                  run_async=True)

dispatcher.add_handler(MUTE_HANDLER)
dispatcher.add_handler(UNMUTE_HANDLER)
dispatcher.add_handler(TEMPMUTE_HANDLER)

__mod_name__ = "Muteo"
__handlers__ = [MUTE_HANDLER, UNMUTE_HANDLER, TEMPMUTE_HANDLER]
Exemplo n.º 17
0
            replymsg = f"*Resultados de Speedtest:*[\u200c\u200c\u200e]({speedtest_image})"
            speedtest_image = speed.results.share()
            update.effective_message.edit_text(replymsg,
                                               parse_mode=ParseMode.MARKDOWN)
            msg.delete()

        elif query.data == "speedtest_text":
            replymsg = "*Resultados de Speedtest:*"
            result = speed.results.dict()
            replymsg += f"\nDescarga: `{convert(result['download'])}Mb/s`\nSubida: `{convert(result['upload'])}Mb/s`\nPing: `{result['ping']}`"
            update.effective_message.edit_text(replymsg,
                                               parse_mode=ParseMode.MARKDOWN)
    else:
        query.answer(
            "Debes ser parte de la Asociación de Aventureros para usar este comando."
        )


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

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

__mod_name__ = "SpeedTest"
__command_list__ = ["speedtest"]
__handlers__ = [SPEED_TEST_HANDLER, SPEED_TEST_CALLBACKHANDLER]
Exemplo n.º 18
0
        data = message.reply_to_message.text

    elif len(args) >= 1:
        data = message.text.split(None, 1)[1]

    else:
        message.reply_text("Qué se supone que debo hacer con esto?")
        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"Copiado a *Nekobin* : {url}"

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


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

__command_list__ = ["paste"]
__handlers__ = [PASTE_HANDLER]
Exemplo n.º 19
0
            bot.send_message(int(chat_id), str(to_send))
        except TelegramError:
            update.effective_message.reply_text(
                "No pude enviar el mensaje. ¿Tal vez no formo parte de ese grupo?"
            )


INFO_HANDLER = DisableAbleCommandHandler("info",
                                         info,
                                         pass_args=True,
                                         run_async=True)
STATS_HANDLER = CommandHandler("stats", stats, run_async=True)
ID_HANDLER = DisableAbleCommandHandler("id", get_id, run_async=True)
GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid, run_async=True)
SISINFO_HANDLER = CommandHandler("sinfo", sisinfo, run_async=True)
SNIPE_HANDLER = CommandHandler("snipe", snipe, run_async=True)

dispatcher.add_handler(INFO_HANDLER)
dispatcher.add_handler(STATS_HANDLER)
dispatcher.add_handler(ID_HANDLER)
dispatcher.add_handler(GIFID_HANDLER)
dispatcher.add_handler(SISINFO_HANDLER)
dispatcher.add_handler(SNIPE_HANDLER)

__mod_name__ = "Misceláneo"
__command_list__ = ["info", "id", "stats", "gifid", "sinfo", "snipe"]
__handlers__ = [
    INFO_HANDLER, STATS_HANDLER, GIFID_HANDLER, ID_HANDLER, SISINFO_HANDLER,
    SNIPE_HANDLER
]
Exemplo n.º 20
0
 •`/tban <usuario> x (m/h/d)`: Prohíbe (Banea) a un usuario durante el tiempo `x`. (a través del ID o respondiendo). `m` = `minutos`, `h` = `horas`, `d` = `días`.
 •`/unban <usuario>`: Desbloquea a un usuario. (a través del ID o respondiendo)
 •`/kick o /exploit <usuario>`: Saca a un usuario del grupo. (a través del ID o respondiendo)
"""

BAN_HANDLER = CommandHandler("ban", ban, run_async=True)
TEMPBAN_HANDLER = CommandHandler(["tban"], temp_ban, run_async=True)
EXPLOIT_HANDLER = CommandHandler(["exploit", "kick"], exploit, run_async=True)
UNBAN_HANDLER = CommandHandler("unban", unban, run_async=True)
ROAR_HANDLER = CommandHandler("roar", selfunban, run_async=True)
EXPLOITME_HANDLER = DisableAbleCommandHandler("exploitme",
                                              exploitme,
                                              filters=Filters.chat_type.groups,
                                              run_async=True)

dispatcher.add_handler(BAN_HANDLER)
dispatcher.add_handler(TEMPBAN_HANDLER)
dispatcher.add_handler(EXPLOIT_HANDLER)
dispatcher.add_handler(UNBAN_HANDLER)
dispatcher.add_handler(ROAR_HANDLER)
dispatcher.add_handler(EXPLOITME_HANDLER)

__mod_name__ = "Bans"
__handlers__ = [
    BAN_HANDLER,
    TEMPBAN_HANDLER,
    EXPLOIT_HANDLER,
    UNBAN_HANDLER,
    ROAR_HANDLER,
    EXPLOITME_HANDLER,
]
Exemplo n.º 21
0
__help__ = """
•`/rules`: Obtén las reglas del grupo.

*Solo administradores:*

•`/setrules <reglas aqui>`: Establece las reglas del grupo.
•`/clearrules`: Quita las reglas del grupo.
"""

__mod_name__ = "Reglas"

__command_list__ = ["rules", "setrules", "clearrules"]

GET_RULES_HANDLER = CommandHandler("rules",
                                   get_rules,
                                   filters=Filters.chat_type.groups,
                                   run_async=True)
SET_RULES_HANDLER = CommandHandler("setrules",
                                   set_rules,
                                   filters=Filters.chat_type.groups,
                                   run_async=True)
RESET_RULES_HANDLER = CommandHandler("clearrules",
                                     clear_rules,
                                     filters=Filters.chat_type.groups,
                                     run_async=True)

dispatcher.add_handler(GET_RULES_HANDLER)
dispatcher.add_handler(SET_RULES_HANDLER)
dispatcher.add_handler(RESET_RULES_HANDLER)
Exemplo n.º 22
0
"""

__mod_name__ = "Triggers"

FILTER_HANDLER = CommandHandler("settrigger", filters, run_async=False)
STOP_HANDLER = CommandHandler("deltrigger", stop_filter, run_async=False)
RMALLFILTER_HANDLER = CommandHandler("rmalltriggers",
                                     rmall_filters,
                                     filters=Filters.chat_type.groups)
RMALLFILTER_CALLBACK = CallbackQueryHandler(rmall_callback,
                                            pattern=r"filters_.*")
LIST_HANDLER = DisableAbleCommandHandler("triggers",
                                         list_handlers,
                                         admin_ok=True)
CUST_FILTER_HANDLER = MessageHandler(
    CustomFilters.has_text & ~Filters.update.edited_message, 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)
dispatcher.add_handler(RMALLFILTER_HANDLER)
dispatcher.add_handler(RMALLFILTER_CALLBACK)

__handlers__ = [
    FILTER_HANDLER,
    STOP_HANDLER,
    LIST_HANDLER,
    (CUST_FILTER_HANDLER, HANDLER_GROUP, RMALLFILTER_HANDLER),
]
Exemplo n.º 23
0
            message.reply_text(
                "Bueno maldita sea, no puedo silenciar a ese usuario.")


RBAN_HANDLER = CommandHandler("rban",
                              rban,
                              filters=CustomFilters.sudo_filter,
                              run_async=True)
RUNBAN_HANDLER = CommandHandler("runban",
                                runban,
                                filters=CustomFilters.sudo_filter,
                                run_async=True)
RKICK_HANDLER = CommandHandler("rexploit",
                               rkick,
                               filters=CustomFilters.sudo_filter,
                               run_async=True)
RMUTE_HANDLER = CommandHandler("rmute",
                               rmute,
                               filters=CustomFilters.sudo_filter,
                               run_async=True)
RUNMUTE_HANDLER = CommandHandler("runmute",
                                 runmute,
                                 filters=CustomFilters.sudo_filter,
                                 run_async=True)

dispatcher.add_handler(RBAN_HANDLER)
dispatcher.add_handler(RUNBAN_HANDLER)
dispatcher.add_handler(RKICK_HANDLER)
dispatcher.add_handler(RMUTE_HANDLER)
dispatcher.add_handler(RUNMUTE_HANDLER)
Exemplo n.º 24
0
from time import sleep

from MeguRobot import dispatcher
from MeguRobot.modules.helper_funcs.chat_status import dev_plus
from telegram import TelegramError, Update
from telegram.ext import CallbackContext, CommandHandler


@dev_plus
def leave(update: Update, context: CallbackContext):
    bot = context.bot
    args = context.args
    if args:
        chat_id = str(args[0])
        try:
            bot.leave_chat(int(chat_id))
            update.effective_message.reply_text("Beep boop, dejé ese grupo!.")
        except TelegramError:
            update.effective_message.reply_text(
                "Beep boop, no pude dejar ese grupo (no sé por qué).")
    else:
        update.effective_message.reply_text("Envíame un ID de chat válido")


LEAVE_HANDLER = CommandHandler("leave", leave, run_async=True)

dispatcher.add_handler(LEAVE_HANDLER)

__mod_name__ = "Dev"
__handlers__ = [LEAVE_HANDLER]
Exemplo n.º 25
0
    if success:
        msg.reply_text(
            "Stickerpack creado correctamente. Puedes encontrarlo [aquí](https://t.me/addstickers/%s"
            % packname,
            parse_mode=ParseMode.MARKDOWN,
        )
    else:
        msg.reply_text(
            "No se pudo crear el paquete de Stickers. Posiblemente debido a la magia negra."
        )


__help__ = """
•`/stickerid`: Responde a un sticker para decirte su ID de archivo.
•`/getsticker`: Responde a un sticker para subir su archivo PNG sin formato.
•`/steal`: Responde a un sticker para agregarlo a tu Stickerpack.
"""

__mod_name__ = "Stickers"
STICKERID_HANDLER = DisableAbleCommandHandler("stickerid", stickerid, run_async=True)
STICKERS_HANDLER = DisableAbleCommandHandler("stickers", cb_sticker, run_async=True)
GETSTICKER_HANDLER = DisableAbleCommandHandler("getsticker", getsticker, run_async=True)
STEAL_HANDLER = DisableAbleCommandHandler(
    ["steal", "kang"], steal, admin_ok=True, run_async=True
)

dispatcher.add_handler(STICKERID_HANDLER)
dispatcher.add_handler(STICKERS_HANDLER)
dispatcher.add_handler(GETSTICKER_HANDLER)
dispatcher.add_handler(STEAL_HANDLER)
Exemplo n.º 26
0
                                              friendly="afk",
                                              run_async=True)

NO_AFK_HANDLER = DisableAbleMessageHandler(
    Filters.all & Filters.chat_type.groups,
    no_longer_afk,
    friendly="afk",
)
AFK_REPLY_HANDLER = DisableAbleMessageHandler(
    (Filters.entity(MessageEntity.MENTION)
     | Filters.entity(MessageEntity.TEXT_MENTION)
     | Filters.reply)
    & Filters.chat_type.groups,
    reply_afk,
    friendly="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),
]
Exemplo n.º 27
0
from MeguRobot import dispatcher
from MeguRobot.modules.disable import DisableAbleCommandHandler
from telegram import Update
from telegram.ext import CallbackContext


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


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

dispatcher.add_handler(SHOUT_HANDLER)

__command_list__ = ["shout"]
__handlers__ = [SHOUT_HANDLER]
Exemplo n.º 28
0
UNFROG_HANDLER = CommandHandler(("removefrog"), removefrog, run_async=True)
UNWHITELIST_HANDLER = CommandHandler(
    ("removewhitelist", "removegianttoad"), removewhitelist, run_async=True
)

WHITELISTLIST_HANDLER = CommandHandler(
    ["whitelistlist", "toads"], whitelistlist, run_async=True
)
FROGLIST_HANDLER = CommandHandler(["frogs"], froglist, run_async=True)
SUPPORTLIST_HANDLER = CommandHandler(
    ["supportlist", "demons"], supportlist, run_async=True
)
SUDOLIST_HANDLER = CommandHandler(["sudolist", "destroyers"], sudolist, run_async=True)
DEVLIST_HANDLER = CommandHandler(["devlist", "cardemons"], devlist, run_async=True)

dispatcher.add_handler(SUDO_HANDLER)
dispatcher.add_handler(SUPPORT_HANDLER)
dispatcher.add_handler(FROG_HANDLER)
dispatcher.add_handler(WHITELIST_HANDLER)
dispatcher.add_handler(UNSUDO_HANDLER)
dispatcher.add_handler(UNSUPPORT_HANDLER)
dispatcher.add_handler(UNFROG_HANDLER)
dispatcher.add_handler(UNWHITELIST_HANDLER)

dispatcher.add_handler(WHITELISTLIST_HANDLER)
dispatcher.add_handler(FROGLIST_HANDLER)
dispatcher.add_handler(SUPPORTLIST_HANDLER)
dispatcher.add_handler(SUDOLIST_HANDLER)
dispatcher.add_handler(DEVLIST_HANDLER)

__mod_name__ = "Aventureros"
Exemplo n.º 29
0
El bloqueo de bots evitará que los no administradores agreguen bots al chat.

Nota:
 • Desbloquear el permiso *info* permitirá a los miembros (no administradores) cambiar la información del grupo, como la descripción o el nombre del grupo
 • Desbloquear el permiso *pin* permitirá a los miembros (no administradores) anclar un mensaje en un grupo
"""

__mod_name__ = "Bloqueos"

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

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)
Exemplo n.º 30
0
def load(update: Update, context: CallbackContext):
    message = update.effective_message
    text = message.text.split(" ", 1)[1]
    load_messasge = message.reply_text(
        f"Intentando cargar el módulo: <b>{text}</b>",
        parse_mode=ParseMode.HTML)

    try:
        imported_module = importlib.import_module("MeguRobot.modules." + text)
    except:
        load_messasge.edit_text("Existe ese módulo?")
        return

    if not hasattr(imported_module, "__mod_name__"):
        imported_module.__mod_name__ = imported_module.__name__

    if not imported_module.__mod_name__.lower() in IMPORTED:
        IMPORTED[imported_module.__mod_name__.lower()] = imported_module
    else:
        load_messasge.edit_text("Módulo ya cargado.")
        return
    if "__handlers__" in dir(imported_module):
        handlers = imported_module.__handlers__
        for handler in handlers:
            if not isinstance(handler, tuple):
                dispatcher.add_handler(handler)
            else:
                if isinstance(handler[0], collections.Callable):
                    callback, telethon_event = handler
                    telethn.add_event_handler(callback, telethon_event)
                else:
                    handler_name, priority = handler
                    dispatcher.add_handler(handler_name, priority)
    else:
        IMPORTED.pop(imported_module.__mod_name__.lower())
        load_messasge.edit_text("El módulo no se puede cargar.")
        return

    if hasattr(imported_module, "__help__") and imported_module.__help__:
        HELPABLE[imported_module.__mod_name__.lower()] = imported_module

    # Chats to migrate on chat_migrated events
    if hasattr(imported_module, "__migrate__"):
        MIGRATEABLE.append(imported_module)

    if hasattr(imported_module, "__stats__"):
        STATS.append(imported_module)

    if hasattr(imported_module, "__user_info__"):
        USER_INFO.append(imported_module)

    if hasattr(imported_module, "__import_data__"):
        DATA_IMPORT.append(imported_module)

    if hasattr(imported_module, "__export_data__"):
        DATA_EXPORT.append(imported_module)

    if hasattr(imported_module, "__chat_settings__"):
        CHAT_SETTINGS[imported_module.__mod_name__.lower()] = imported_module

    if hasattr(imported_module, "__user_settings__"):
        USER_SETTINGS[imported_module.__mod_name__.lower()] = imported_module

    load_messasge.edit_text(
        "Módulo cargado correctamente: <b>{}</b>".format(text),
        parse_mode=ParseMode.HTML,
    )