Exemplo n.º 1
0
    "ungban",
    ungban,
    pass_args=True,
    filters=CustomFilters.support_filter,
    run_async=True,
)
GBAN_LIST = CommandHandler("gbanlist",
                           gbanlist,
                           filters=CustomFilters.support_filter,
                           run_async=True)

GBAN_STATUS = CommandHandler(
    "spamshield",
    gbanstat,
    pass_args=True,
    filters=Filters.chat_type.groups,
    run_async=True,
)

GBAN_ENFORCER = MessageHandler(Filters.all & Filters.chat_type.groups,
                               enforce_gban,
                               run_async=True)

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

if STRICT_GBAN:  # enforce GBANS if this is set
    dispatcher.add_handler(GBAN_ENFORCER, GBAN_ENFORCE_GROUP)
Exemplo n.º 2
0

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 & Filters.chat_type.groups, 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)


__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.º 3
0
    welcomemute,
    pass_args=True,
    filters=Filters.chat_type.groups,
    run_async=True,
)
CLEAN_SERVICE_HANDLER = CommandHandler(
    "cleanservice",
    cleanservice,
    pass_args=True,
    filters=Filters.chat_type.groups,
    run_async=True,
)
WELCOME_HELP = CommandHandler("welcomehelp", welcome_help, run_async=True)
BUTTON_VERIFY_HANDLER = CallbackQueryHandler(user_button,
                                             pattern=r"user_join_",
                                             run_async=True)

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(WELCOMEMUTE_HANDLER)
dispatcher.add_handler(CLEAN_SERVICE_HANDLER)
dispatcher.add_handler(BUTTON_VERIFY_HANDLER)
dispatcher.add_handler(WELCOME_HELP)
Exemplo n.º 4
0
        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)"

    send = msg.reply_text(rep, parse_mode=ParseMode.HTML)
    time.sleep(60)
    try:
        send.delete()
        msg.delete()
    except error.BadRequest:
        return


def __stats__():
    return "× {} menyimpan nama pengguna Last.FM.".format(
        LASTFM_USER.count_documents({}))


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.º 5
0
                                              run_async=True)
UD_HANDLER = DisableAbleCommandHandler("ud", ud, run_async=True)
GETLINK_HANDLER = CommandHandler(
    "getlink",
    getlink,
    pass_args=True,
    filters=CustomFilters.dev_filter,
    run_async=True,
)
STAFFLIST_HANDLER = CommandHandler("staffids",
                                   staff_ids,
                                   filters=Filters.user(OWNER_ID),
                                   run_async=True)
# SRC_HANDLER = CommandHandler("source", src, filters=Filters.private)
COVID_HANDLER = CommandHandler("covid", covid, run_async=True)
PASTE_HANDLER = CommandHandler("paste", paste, run_async=True)

dispatcher.add_handler(WALLPAPER_HANDLER)
dispatcher.add_handler(UD_HANDLER)
dispatcher.add_handler(ID_HANDLER)
dispatcher.add_handler(INFO_HANDLER)
dispatcher.add_handler(ECHO_HANDLER)
dispatcher.add_handler(STATS_HANDLER)
dispatcher.add_handler(GDPR_HANDLER)
dispatcher.add_handler(WIKI_HANDLER)
dispatcher.add_handler(GETLINK_HANDLER)
dispatcher.add_handler(STAFFLIST_HANDLER)
# dispatcher.add_handler(SRC_HANDLER)
dispatcher.add_handler(COVID_HANDLER)
dispatcher.add_handler(PASTE_HANDLER)
Exemplo n.º 6
0
                                                users_db.num_chats())


def __migrate__(old_chat_id, new_chat_id):
    users_db.migrate_chat(old_chat_id, new_chat_id)


__help__ = ""  # no help string

__mod_name__ = "Users"

BROADCAST_HANDLER = CommandHandler("broadcast",
                                   broadcast,
                                   filters=Filters.user(OWNER_ID),
                                   run_async=True)
USER_HANDLER = MessageHandler(Filters.all & Filters.chat_type.groups,
                              log_user,
                              run_async=True)
CHATLIST_HANDLER = CommandHandler("chatlist",
                                  chats,
                                  filters=CustomFilters.sudo_filter,
                                  run_async=True)
CHAT_CHECKER_HANDLER = MessageHandler(Filters.all & Filters.chat_type.groups,
                                      chat_checker,
                                      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)
Exemplo n.º 7
0
    "Anda harus mencoba menahan TNT di mulut Anda dan menyalakannya.",
    "Coba mainkan tangkap dan lempar dengan RDX itu menyenangkan.",
    "Saya dengar phogine beracun tapi saya rasa Anda tidak keberatan menghirupnya untuk bersenang-senang.",
    "Luncurkan diri Anda ke luar angkasa sambil melupakan oksigen di Bumi.",
    "Anda harus mencoba bermain ular tangga, dengan ular asli dan tanpa tangga.",
    "Menari telanjang di beberapa kabel HT.",
    "Gunung Berapi Aktif adalah kolam renang terbaik untuk Anda.",
    "Anda harus mencoba mandi air panas di gunung berapi.",
    "Cobalah untuk menghabiskan satu hari di peti mati dan itu akan menjadi milikmu selamanya.",
    "Pukul Uranium dengan neutron yang bergerak lambat di hadapanmu. Ini akan menjadi pengalaman yang berharga.",
    "Anda bisa menjadi orang pertama yang menginjak matahari. Selamat mencoba.",
    "🤭.",
)


@typing_action
def insult(update, context):
    bot = context.bot
    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))


INSULT_HANDLER = DisableAbleCommandHandler("insult", insult, run_async=True)

dispatcher.add_handler(INSULT_HANDLER)
Exemplo n.º 8
0
    uptime = get_readable_time((time.time() - StartTime))

    message.edit_text(
        "PONG!!\n"
        "<b>Time Taken:</b> <code>{}</code>\n"
        "<b>Service uptime:</b> <code>{}</code>".format(telegram_ping, uptime),
        parse_mode=ParseMode.HTML)
    

@typing_action
def pingall(update, context):
    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 = "⏱Ping results are:\n"
    reply_msg += "\n".join(pinged_list)
    reply_msg += '\n<b>Service uptime:</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.º 9
0
    string = ""

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

    if args:
        string = '  '.join(args).lower()

    if not string:
        message.reply_text(
            "Gunakan `/weebify <text>`", parse_mode=ParseMode.MARKDOWN)
        return

    for normiecharacter in string:
        if normiecharacter in normiefont:
            weebycharacter = weebyfont[normiefont.index(normiecharacter)]
            string = string.replace(normiecharacter, weebycharacter)

    if message.reply_to_message:
        message.reply_to_message.reply_text(string)
    else:
        message.reply_text(string)


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

dispatcher.add_handler(WEEBIFY_HANDLER)

__command_list__ = ["weebify"]
__handlers__ = [WEEBIFY_HANDLER]
Exemplo n.º 10
0
    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)
Exemplo n.º 11
0
Ini juga akan memungkinkan Anda untuk menghapusnya secara otomatis, menghentikan orang dari bluetexting.

 × /cmds: Periksa status saat ini dari perintah yang dinonaktifkan

*Khusus Admin:*
 × /enable <cmd name>: Aktifkan perintah itu
 × /disable <cmd name>: Nonaktifkan perintah itu
 × /listcmds: Buat daftar semua kemungkinan perintah yang dapat dinonaktifkan
    """

    DISABLE_HANDLER = CommandHandler(
        "disable", disable, pass_args=True,
        run_async=True)  # , filters=Filters.chat_type.groups)
    ENABLE_HANDLER = CommandHandler(
        "enable", enable, pass_args=True,
        run_async=True)  # , filters=Filters.chat_type.groups)
    COMMANDS_HANDLER = CommandHandler(
        ["cmds", "disabled"], commands,
        run_async=True)  # , filters=Filters.chat_type.groups)
    # , filters=Filters.chat_type.groups)
    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
Exemplo n.º 12
0
`/setme Saya bekerja untuk Telegram`; Bio diatur untuk diri Anda sendiri.

Contoh penulisan biodata orang lain:
Balas pesan pengguna: `/setbio Dia orang yang sangat keren`.

*Perhatian:* Jangan gunakan /setbio untuk melawan diri sendiri!
"""

__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)
dispatcher.add_handler(GET_BIO_HANDLER)
dispatcher.add_handler(SET_ABOUT_HANDLER)
dispatcher.add_handler(GET_ABOUT_HANDLER)
Exemplo n.º 13
0
LIST_WARN_HANDLER = DisableAbleCommandHandler(
    ["warnlist", "warnfilters"],
    list_warn_filters,
    admin_ok=True,
    run_async=True,
)
WARN_FILTER_HANDLER = MessageHandler(CustomFilters.has_text
                                     & Filters.chat_type.groups,
                                     reply_filter,
                                     run_async=True)
WARN_LIMIT_HANDLER = CommandHandler("warnlimit",
                                    set_warn_limit,
                                    pass_args=True,
                                    run_async=True)
WARN_STRENGTH_HANDLER = CommandHandler("strongwarn",
                                       set_warn_strength,
                                       pass_args=True,
                                       run_async=True)

dispatcher.add_handler(WARN_HANDLER)
dispatcher.add_handler(CALLBACK_QUERY_HANDLER)
dispatcher.add_handler(RESET_WARN_HANDLER)
dispatcher.add_handler(REMOVE_WARNS_HANDLER)
dispatcher.add_handler(MYWARNS_HANDLER)
dispatcher.add_handler(ADD_WARN_HANDLER)
dispatcher.add_handler(RM_WARN_HANDLER)
dispatcher.add_handler(LIST_WARN_HANDLER)
dispatcher.add_handler(WARN_LIMIT_HANDLER)
dispatcher.add_handler(WARN_STRENGTH_HANDLER)
dispatcher.add_handler(WARN_FILTER_HANDLER, WARN_HANDLER_GROUP)
Exemplo n.º 14
0
def gps(update, context):
    args = context.args
    bot = context.bot
    message = update.effective_message
    if len(args) == 0:
        update.effective_message.reply_text(
            "Itu lelucon yang lucu, tapi tidak juga, taruh di lokasi")
    try:
        geolocator = Nominatim(user_agent="SkittBot")
        location = " ".join(args)
        geoloc = geolocator.geocode(location)
        chat_id = update.effective_chat.id
        lon = geoloc.longitude
        lat = geoloc.latitude
        the_loc = Location(lon, lat)
        gm = "https://www.google.com/maps/search/{},{}".format(lat, lon)
        bot.send_location(chat_id, location=the_loc)
        update.message.reply_text("Buka di: [Google Maps]({})".format(gm),
                                  parse_mode=ParseMode.MARKDOWN,
                                  disable_web_page_preview=True)
    except AttributeError:
        update.message.reply_text("Saya tidak dapat menemukannya")


GPS_HANDLER = DisableAbleCommandHandler("gps",
                                        gps,
                                        pass_args=True,
                                        run_async=True)

dispatcher.add_handler(GPS_HANDLER)
Exemplo n.º 15
0
import html
import random
import kaga.modules.truth_and_dare_string as truth_and_dare_string
from kaga import dispatcher
from telegram import ParseMode, Update, Bot
from kaga.modules.disable import DisableAbleCommandHandler
from kaga.modules.helper_funcs.alternate import typing_action

@typing_action
def truth(update, context):
    args = context.args
    update.effective_message.reply_text(random.choice(truth_and_dare_string.TRUTH))

@typing_action
def dare(update, context):
    args = context.args
    update.effective_message.reply_text(random.choice(truth_and_dare_string.DARE))

    
TRUTH_HANDLER = DisableAbleCommandHandler("truth", truth, run_async=True)
DARE_HANDLER = DisableAbleCommandHandler("dare", dare, run_async=True)


dispatcher.add_handler(TRUTH_HANDLER)
dispatcher.add_handler(DARE_HANDLER)
Exemplo n.º 16
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)
Exemplo n.º 17
0
def main():
    # test_handler = CommandHandler("test", test)
    start_handler = CommandHandler("start",
                                   start,
                                   pass_args=True,
                                   run_async=True)

    help_handler = CommandHandler("help", get_help)
    help_callback_handler = CallbackQueryHandler(help_button,
                                                 pattern=r"help_",
                                                 run_async=True)
    help_staff_handler = CommandHandler(
        "staffhelp",
        staff_help,
        filters=CustomFilters.support_filter,
        run_async=True,
    )

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

    migrate_handler = MessageHandler(Filters.status_update.migrate,
                                     migrate_chats)
    is_chat_allowed_handler = MessageHandler(Filters.chat_type.groups,
                                             is_chat_allowed)

    # 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(help_staff_handler)
    dispatcher.add_handler(settings_callback_handler)
    dispatcher.add_handler(migrate_handler)
    dispatcher.add_handler(is_chat_allowed_handler)
    dispatcher.add_error_handler(error_handler)

    if WEBHOOK:
        LOGGER.info("Using webhooks.")
        updater.start_webhook(listen="0.0.0.0", 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=5, clean=True)
        if MESSAGE_DUMP:
            updater.bot.send_message(chat_id=MESSAGE_DUMP,
                                     text="Sistem telah aktif...")

    updater.idle()
Exemplo n.º 18
0
                       f"&from_currency={orig_cur}"
                       f"&to_currency={new_cur}"
                       f"&apikey={CASH_API_KEY}")
        response = requests.get(request_url).json()
        try:
            current_rate = float(response['Realtime Currency Exchange Rate']
                                 ['5. Exchange Rate'])
        except KeyError:
            update.effective_message.reply_text("Mata Uang Tidak Didukung.")
            return
        new_cur_amount = round(orig_cur_amount * current_rate, 5)
        update.effective_message.reply_text(
            f"{orig_cur_amount} {orig_cur} = {new_cur_amount} {new_cur}")

    elif len(args) == 1:
        update.effective_message.reply_text(__help__,
                                            parse_mode=ParseMode.MARKDOWN)

    else:
        update.effective_message.reply_text(
            f"*Invalid Args!!:* Required 3 But Passed {len(args) -1}",
            parse_mode=ParseMode.MARKDOWN)


CONVERTER_HANDLER = CommandHandler('cash', convert)

dispatcher.add_handler(CONVERTER_HANDLER)

__command_list__ = ["cash"]
__handlers__ = [CONVERTER_HANDLER]
Exemplo n.º 19
0
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)
dispatcher.add_handler(CLEARALLNOTES_HANDLER)
dispatcher.add_handler(RMBTN_HANDLER)
Exemplo n.º 20
0
                               speedtst,
                               filters=CustomFilters.sudo_filter,
                               run_async=True)
SYS_STATUS_HANDLER = CommandHandler("sysinfo",
                                    system_status,
                                    filters=CustomFilters.dev_filter,
                                    run_async=True)
LEAVECHAT_HANDLER = CommandHandler(
    ["leavechat", "leavegroup", "leave"],
    leavechat,
    pass_args=True,
    filters=CustomFilters.dev_filter,
    run_async=True,
)
GITPULL_HANDLER = CommandHandler("gitpull",
                                 gitpull,
                                 filters=CustomFilters.dev_filter,
                                 run_async=True)
RESTART_HANDLER = CommandHandler("reboot",
                                 restart,
                                 filters=CustomFilters.dev_filter,
                                 run_async=True)

dispatcher.add_handler(IP_HANDLER)
dispatcher.add_handler(SPEED_HANDLER)
dispatcher.add_handler(PING_HANDLER)
dispatcher.add_handler(SYS_STATUS_HANDLER)
dispatcher.add_handler(LEAVECHAT_HANDLER)
dispatcher.add_handler(GITPULL_HANDLER)
dispatcher.add_handler(RESTART_HANDLER)
Exemplo n.º 21
0
    Filters.regex(r"(?i)(selamat malam)"),
    goodnight,
    friendly="selamatmalam",
    run_async=True,
)
THONKIFY_HANDLER = DisableAbleCommandHandler("thonkify",
                                             thonkify,
                                             run_async=True)
CHANGEMYMIND_HANDLER = DisableAbleCommandHandler("changemymind",
                                                 changemymind,
                                                 run_async=True)
TRUMPTWEET_HANDLER = DisableAbleCommandHandler("trumptweet",
                                               trumptweet,
                                               run_async=True)

dispatcher.add_handler(POLICE_HANDLER)
dispatcher.add_handler(SHRUG_HANDLER)
dispatcher.add_handler(DECIDE_HANDLER)
dispatcher.add_handler(ABUSE_HANDLER)
dispatcher.add_handler(SNIPE_HANDLER)
dispatcher.add_handler(RUNS_HANDLER)
dispatcher.add_handler(SLAP_HANDLER)
dispatcher.add_handler(PUNCH_HANDLER)
dispatcher.add_handler(HUG_HANDLER)
dispatcher.add_handler(GBUN_HANDLER)
dispatcher.add_handler(TABLE_HANDLER)
dispatcher.add_handler(RECITE_HANDLER)
dispatcher.add_handler(CRI_HANDLER)
dispatcher.add_handler(PASTA_HANDLER)
dispatcher.add_handler(CLAP_HANDLER)
dispatcher.add_handler(OWO_HANDLER)
Exemplo n.º 22
0
        return "Tidak ada saluran log yang disetel untuk grup ini!!"

    __help__ = """
*Khusus Admin:*
• /logchannel*:* dapatkan info saluran log
• /setlog*:* mengatur saluran log.
• /unsetlog*:* hapus saluran log.
Mengatur saluran log dilakukan dengan:
• menambahkan bot ke saluran yang diinginkan (sebagai admin!)
• mengirim `/setlog` di saluran
• meneruskan `/setlog` ke grup
"""

    __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

    def gloggable(func):
        return func
Exemplo n.º 23
0
            f"{mention_html(msg.from_user.id, msg.from_user.first_name)}" +
            ", Silakan balas pesan stiker untuk mendapatkan stiker id",
            parse_mode=ParseMode.HTML,
        )


__help__ = """
Kang Stiker dipermudah dengan modul stiker!

× /stickerid: Balas stiker untuk memberi tahu Anda ID filenya.
× /getsticker: Balas stiker kepada saya untuk mengupload file PNG mentahnya.
× /kang: Balas stiker untuk menambahkannya ke paket Anda.
"""

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

dispatcher.add_handler(KANG_HANDLER)
dispatcher.add_handler(STICKERID_HANDLER)
dispatcher.add_handler(GETSTICKER_HANDLER)
Exemplo n.º 24
0
 *Catatan*:
 - Nilai harus diisi untuk tban dan tmute!

 Bisa seperti ini:
 5m = 5 menit
 6h = 6 jam
 3d = 3 hari
 1w = 1 minggu
 """

__mod_name__ = "Antiflood"

FLOOD_BAN_HANDLER = MessageHandler(
    Filters.all & ~Filters.status_update & Filters.chat_type.groups,
    check_flood,
    run_async=True,
)
SET_FLOOD_HANDLER = CommandHandler(
    "setflood", set_flood, pass_args=True,
    run_async=True)  # , filters=Filters.chat_type.groups)
SET_FLOOD_MODE_HANDLER = CommandHandler(
    "setfloodmode", set_flood_mode, pass_args=True,
    run_async=True)  # , filters=Filters.chat_type.groups)
# , filters=Filters.chat_type.groups)
FLOOD_HANDLER = CommandHandler("flood", flood, run_async=True)

dispatcher.add_handler(FLOOD_BAN_HANDLER, FLOOD_GROUP)
dispatcher.add_handler(SET_FLOOD_HANDLER)
dispatcher.add_handler(SET_FLOOD_MODE_HANDLER)
dispatcher.add_handler(FLOOD_HANDLER)
Exemplo n.º 25
0
                text = re.sub(repl, repl_with, to_fix, count=1,
                              flags=re.I).strip()
            elif "g" in flags:
                text = re.sub(repl, repl_with, to_fix).strip()
            else:
                text = re.sub(repl, repl_with, to_fix, count=1).strip()
        except sre_constants.error:
            LOGGER.warning(update.effective_message.text)
            LOGGER.exception("SRE constant error")
            update.effective_message.reply_text(
                "Apakah kamu bahkan sed? Sepertinya tidak.")
            return

        # empty string errors -_-
        if len(text) >= telegram.MAX_MESSAGE_LENGTH:
            update.effective_message.reply_text(
                "Hasil dari perintah sed terlalu lama untuk \
                                                 telegram!")
        elif text:
            update.effective_message.reply_to_message.reply_text(text)


SED_HANDLER = DisableAbleMessageHandler(
    Filters.regex(r"s([{}]).*?\1.*".format("".join(DELIMITERS))),
    sed,
    friendly="sed",
    run_async=True,
)

dispatcher.add_handler(SED_HANDLER)
Exemplo n.º 26
0
UNGBANCHAT_HANDLER = CommandHandler("unblchat",
                                    ungbanChat,
                                    pass_args=True,
                                    filters=CustomFilters.sudo_filter,
                                    run_async=True)
DEFENSE_HANDLER = CommandHandler("setdefense",
                                 setDefense,
                                 pass_args=True,
                                 run_async=True)
GETDEF_HANDLER = CommandHandler("defense", getDefense, run_async=True)
GETTIMESET_HANDLER = CommandHandler("kicktime", getTimeSetting, run_async=True)
SETTIMER_HANDLER = CommandHandler("setkicktime",
                                  setTimeSetting,
                                  pass_args=True,
                                  run_async=True)
ABOUT_CAS_HANDLER = CommandHandler("cas", about_cas, run_async=True)

dispatcher.add_handler(SETCAS_HANDLER)
dispatcher.add_handler(GETCAS_HANDLER)
dispatcher.add_handler(GETVER_HANDLER)
dispatcher.add_handler(CASCHECK_HANDLER)
dispatcher.add_handler(CASQUERY_HANDLER)
dispatcher.add_handler(SETBAN_HANDLER)
dispatcher.add_handler(GBANCHAT_HANDLER)
dispatcher.add_handler(UNGBANCHAT_HANDLER)
dispatcher.add_handler(DEFENSE_HANDLER)
dispatcher.add_handler(GETDEF_HANDLER)
dispatcher.add_handler(GETTIMESET_HANDLER)
dispatcher.add_handler(SETTIMER_HANDLER)
dispatcher.add_handler(ABOUT_CAS_HANDLER)
Exemplo n.º 27
0
            update.effective_message.reply_to_message.delete()
            update.effective_message.delete()
            return "<b>{}:</b>" \
                   "\n#DEL" \
                   "\n<b>Admin:</b> {}" \
                   "\nMessage deleted.".format(html.escape(chat.title),
                                               mention_html(user.id, user.first_name))
    else:
        update.effective_message.reply_text("Walah, ingin menghapus?")

    return ""


__help__ = """
Menghapus pesan menjadi mudah dengan perintah ini. Pembersihan bot \
pesan semua bersama-sama atau satu per satu.

*Khusus Admin:*
 × /del: Menghapus pesan yang Anda balas
 × /purge: Menghapus semua pesan antara ini dan pesan yang dibalas.
 × /purge <integer X>: Menghapus pesan yang dibalas, dan X pesan mengikutinya.
"""

__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)
Exemplo n.º 28
0
 × /rmallfilter: Hentikan semua filter obrolan sekaligus.

*Catatan*: Filter juga mendukung format penurunan harga seperti: {first}, {last} dll .. dan tombol.
Periksa `/markdownhelp` untuk mengetahui lebih lanjut!

"""

__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)
Exemplo n.º 29
0

def get_chat(chat_id, chat_data):
    # print(chat_data)
    try:
        value = chat_data[chat_id]["backups"]
        return value
    except KeyError:
        return {"status": False, "value": False}


__mod_name__ = "Backups"

__help__ = """
*Hanya untuk administrator obrolan:*

 × /import: Balas ke file cadangan untuk kelompok kepala pelayan / emilia untuk mengimpor sebanyak mungkin, membuat transfer sangat mudah! \
 Perhatikan bahwa file/foto tidak dapat diimpor karena pembatasan telegram.

 × /export: Ekspor data grup, yang akan diekspor adalah: aturan, catatan (dokumen, gambar, musik, video, audio, suara, teks, tombol teks) \

"""

IMPORT_HANDLER = CommandHandler("import", import_data, run_async=True)
EXPORT_HANDLER = CommandHandler(
   "export", export_data, pass_chat_data=True, run_async=True
)

dispatcher.add_handler(IMPORT_HANDLER)
dispatcher.add_handler(EXPORT_HANDLER)
Exemplo n.º 30
0
 × /rmblacklist <triggers>: Sama seperti di atas.
 × /blacklistmode <off/del/warn/ban/kick/mute/tban/tmute>: Tindakan yang harus dilakukan ketika seseorang mengirimkan kata-kata yang masuk daftar hitam.
"""
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,
    del_blacklist,
    run_async=True,
)

dispatcher.add_handler(BLACKLIST_HANDLER)
dispatcher.add_handler(ADD_BLACKLIST_HANDLER)
dispatcher.add_handler(UNBLACKLIST_HANDLER)
dispatcher.add_handler(BLACKLISTMODE_HANDLER)
dispatcher.add_handler(BLACKLIST_DEL_HANDLER, group=BLACKLIST_GROUP)