コード例 #1
0
        teks = tl(update.effective_message,
                  "*Cuaca di {} saat ini*\n").format(data.get('LocalizedName'))
        teks += "{}\n".format(cuaca)
        teks += tl(update.effective_message,
                   "*Lokasi:* `{}`\n\n").format(", ".join(lok))

        # try:
        #     context.bot.send_photo(chat_id, photo=datas.get('Photos')[0].get('LandscapeLink'), caption=teks, parse_mode="markdown", reply_to_message_id=message.message_id, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="More info", url=datas.get('Link'))]]))
        # except:
        send_message(update.effective_message,
                     teks,
                     parse_mode="markdown",
                     disable_web_page_preview=True,
                     reply_markup=InlineKeyboardMarkup([[
                         InlineKeyboardButton(text="More info",
                                              url=datas.get('Link'))
                     ]]))


__help__ = "weather_help"

__mod_name__ = "Weather"

CUACA_HANDLER = DisableAbleCommandHandler(["cuaca", "weather"],
                                          accuweather,
                                          pass_args=True)
# ACCUWEATHER_HANDLER = DisableAbleCommandHandler("accuweather", accuweather, pass_args=True)

dispatcher.add_handler(CUACA_HANDLER)
# dispatcher.add_handler(ACCUWEATHER_HANDLER)
コード例 #2
0
ファイル: locks.py プロジェクト: minatouzuki/UtahaRobot
 ✗ /locks: The current list of locks in this chat.
 
Locks can be used to restrict a group's users.
eg:
Locking urls will auto-delete all messages with urls, locking stickers will restrict all \
non-admin users from sending stickers, etc.
Locking bots will stop non-admins from adding bots to the chat.

Note:
 • Unlocking permission *info* will allow members (non-admins) to change the group information, such as the description or the group name
 • Unlocking permission *pin* will allow members (non-admins) to pinned a message in a group
"""

__mod_name__ = "Locks"

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

dispatcher.add_handler(LOCK_HANDLER)
dispatcher.add_handler(UNLOCK_HANDLER)
dispatcher.add_handler(LOCKTYPES_HANDLER)
dispatcher.add_handler(LOCKED_HANDLER)

dispatcher.add_handler(
    MessageHandler(Filters.all & Filters.group, del_lockables), PERM_GROUP
)
コード例 #3
0
ファイル: userinfo.py プロジェクト: minatouzuki/UtahaRobot
promoting your profile.

All bios are displayed on /info command.

 ✗ /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

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

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

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

__mod_name__ = "Bios/Abouts"

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

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

dispatcher.add_handler(SET_BIO_HANDLER)
dispatcher.add_handler(GET_BIO_HANDLER)
dispatcher.add_handler(SET_ABOUT_HANDLER)
dispatcher.add_handler(GET_ABOUT_HANDLER)
コード例 #4
0
ファイル: afk.py プロジェクト: annihilatorrrr/utahbot
                if valid:
                    if not reason:
                        res = tl(update.effective_message,
                                 "{} sedang AFK!").format(fst_name)
                    else:
                        res = tl(update.effective_message,
                                 "{} sedang AFK!\nKarena : {}").format(
                                     fst_name, reason)
                    send_message(update.effective_message, res)


__help__ = "afk_help"

__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.group & ~Filters.update.edited_message,
    no_longer_afk)
AFK_REPLY_HANDLER = MessageHandler(Filters.all & Filters.group, reply_afk)
# AFK_REPLY_HANDLER = MessageHandler(Filters.entity(MessageEntity.MENTION) | Filters.entity(MessageEntity.TEXT_MENTION),
#                                   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)
コード例 #5
0
ファイル: translator.py プロジェクト: minatouzuki/UtahaRobot
        prev_end = 0

        for change in changes:
            start = change.get("From")
            end = change.get("To") + 1
            suggestions = change.get("Suggestions")
            if suggestions:
                sugg_str = suggestions[0].get(
                    "Text")  # should look at this list more
                curr_string += msg.text[prev_end:start] + sugg_str
                prev_end = end

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


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

dispatcher.add_handler(
    DisableAbleCommandHandler(["tr", "tl"], gtrans, pass_args=True))
dispatcher.add_handler(DisableAbleCommandHandler("tts", gtts, pass_args=True))
dispatcher.add_handler(DisableAbleCommandHandler("splcheck", spellcheck))
コード例 #6
0
    for trigger in filters:
        sql.add_to_blacklist(chat_id, trigger)


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


def __chat_settings__(chat_id, user_id):
    cust_filters = sql.get_chat_triggers(chat_id)
    return tl(user_id,
              "Ada `{}` filter khusus di sini.").format(len(cust_filters))


__help__ = "filters_help"

__mod_name__ = "Filters"

FILTER_HANDLER = CommandHandler("filter", filters)
STOP_HANDLER = CommandHandler("stop", stop_filter)
LIST_HANDLER = DisableAbleCommandHandler("filters",
                                         list_handlers,
                                         admin_ok=True)
CUST_FILTER_HANDLER = MessageHandler(
    CustomFilters.has_text & ~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)
コード例 #7
0
            parse_mode=ParseMode.HTML,
        )
    else:
        update.effective_message.reply_text(
            "Hello " +
            f"{mention_html(msg.from_user.id, msg.from_user.first_name)}" +
            ", Please reply to sticker message to get id sticker",
            parse_mode=ParseMode.HTML,
        )


__help__ = """
Kanging Stickers made easy with stickers module !

✗ /stickerid: Reply to a sticker to me to tell you its file ID.
✗ /getsticker: Reply to a sticker to me to upload its raw PNG file.
✗ /kang: Reply to a sticker to add it to your pack.
"""

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

dispatcher.add_handler(KANG_HANDLER)
dispatcher.add_handler(STICKERID_HANDLER)
dispatcher.add_handler(GETSTICKER_HANDLER)
コード例 #8
0
An "odds and ends" module for small, simple commands which don't really fit anywhere

 ✗ /id: Get the current group id. If used by replying to a message, gets that user's id.
 ✗ /info: Get information about a user.
 ✗ /wiki : Search wikipedia articles.
 ✗ /rmeme: Sends random meme scraped from reddit.
 ✗ /ud <query> : Search stuffs in urban dictionary.
 ✗ /wall <query> : Get random wallpapers directly from bot! .
 ✗ /reverse : Reverse searches image or stickers on google.
 ✗ /gdpr: Deletes your information from the bot's database. Private chats only.
 ✗ /markdownhelp: Quick summary of how markdown works in telegram - can only be called in private chats.
"""

__mod_name__ = "Misc"

ID_HANDLER = DisableAbleCommandHandler("id", get_id, pass_args=True)
INFO_HANDLER = DisableAbleCommandHandler("info", info, pass_args=True)
ECHO_HANDLER = CommandHandler("echo", echo, filters=CustomFilters.sudo_filter)
MD_HELP_HANDLER = CommandHandler("markdownhelp", markdown_help, filters=Filters.private)
STATS_HANDLER = CommandHandler("stats", stats, filters=Filters.user(OWNER_ID))
GDPR_HANDLER = CommandHandler("gdpr", gdpr, filters=Filters.private)
WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki)
WALLPAPER_HANDLER = DisableAbleCommandHandler("wall", wall, pass_args=True)
UD_HANDLER = DisableAbleCommandHandler("ud", ud)
BIN_HANDLER = DisableAbleCommandHandler("bin", bin)
GETLINK_HANDLER = CommandHandler(
    "getlink", getlink, pass_args=True, filters=Filters.user(OWNER_ID)
)
STAFFLIST_HANDLER = CommandHandler(
    "staffids", staff_ids, filters=Filters.user(OWNER_ID)
)
コード例 #9
0
ファイル: blacklist.py プロジェクト: minatouzuki/UtahaRobot
__help__ = """

Blacklists are used to stop certain triggers from being said in a group. Any time the trigger is mentioned, the message will immediately be deleted. A good combo is sometimes to pair this up with warn filters!

*NOTE*: Blacklists do not affect group admins.

 ✗ /blacklist: View the current blacklisted words.

Admin only:
 ✗ /addblacklist <triggers>: Add a trigger to the blacklist. Each line is considered one trigger, so using different lines will allow you to add multiple triggers.
 ✗ /unblacklist <triggers>: Remove triggers from the blacklist. Same newline logic applies here, so you can remove multiple triggers at once.
 ✗ /rmblacklist <triggers>: Same as above.
 ✗ /blacklistmode <off/del/warn/ban/kick/mute/tban/tmute>: Action to perform when someone sends blacklisted words.
"""
BLACKLIST_HANDLER = DisableAbleCommandHandler("blacklist",
                                              blacklist,
                                              pass_args=True,
                                              admin_ok=True)
ADD_BLACKLIST_HANDLER = CommandHandler("addblacklist", add_blacklist)
UNBLACKLIST_HANDLER = CommandHandler(["unblacklist", "rmblacklist"],
                                     unblacklist)
BLACKLISTMODE_HANDLER = CommandHandler("blacklistmode",
                                       blacklist_mode,
                                       pass_args=True)
BLACKLIST_DEL_HANDLER = MessageHandler(
    (Filters.text | Filters.command | Filters.sticker | Filters.photo)
    & Filters.group,
    del_blacklist,
)

dispatcher.add_handler(BLACKLIST_HANDLER)
dispatcher.add_handler(ADD_BLACKLIST_HANDLER)
コード例 #10
0
    blacklisted = sql.num_stickers_chat_filters(chat_id)
    return tl(user_id, "Ada `{}` daftar hitam stiker.").format(blacklisted)


def __stats__():
    return tl(OWNER_ID,
              "{} pemicu daftar hitam stiker, di seluruh {} obrolan.").format(
                  sql.num_stickers_filters(), sql.num_stickers_filter_chats())


__help__ = "blstickers_help"

__mod_name__ = "Sticker Blacklist"

BLACKLIST_STICKER_HANDLER = DisableAbleCommandHandler("blsticker",
                                                      blackliststicker,
                                                      pass_args=True,
                                                      admin_ok=True)
ADDBLACKLIST_STICKER_HANDLER = DisableAbleCommandHandler(
    "addblsticker", add_blackliststicker)
UNBLACKLIST_STICKER_HANDLER = CommandHandler(["unblsticker", "rmblsticker"],
                                             unblackliststicker)
BLACKLISTMODE_HANDLER = CommandHandler("blstickermode",
                                       blacklist_mode,
                                       pass_args=True)
BLACKLIST_STICKER_DEL_HANDLER = MessageHandler(Filters.sticker & Filters.group,
                                               del_blackliststicker)

dispatcher.add_handler(BLACKLIST_STICKER_HANDLER)
dispatcher.add_handler(ADDBLACKLIST_STICKER_HANDLER)
dispatcher.add_handler(UNBLACKLIST_STICKER_HANDLER)
dispatcher.add_handler(BLACKLISTMODE_HANDLER)
コード例 #11
0
ファイル: android.py プロジェクト: minatouzuki/UtahaRobot
            dl_file = download.text
            size = trs[i].find("span", {"class": "filesize"}).text
            reply += f"[{dl_file}]({dl_link}) - {size}\n"

        update.message.reply_text(
            "{}".format(reply),
            parse_mode=ParseMode.MARKDOWN,
            disable_web_page_preview=True,
        )


__help__ = """
Get Latest magisk relese, Twrp for your device or info about some device using its codename, Directly from Bot!

*Android related commands:*

 ✗ /magisk - Gets the latest magisk release for Stable/Beta/Canary.
 ✗ /device <codename> - Gets android device basic info from its codename.
 ✗ /twrp <codename> -  Gets latest twrp for the android device using the codename.
"""

__mod_name__ = "Android"

MAGISK_HANDLER = DisableAbleCommandHandler("magisk", magisk)
DEVICE_HANDLER = DisableAbleCommandHandler("device", device, pass_args=True)
TWRP_HANDLER = DisableAbleCommandHandler("twrp", twrp, pass_args=True)

dispatcher.add_handler(MAGISK_HANDLER)
dispatcher.add_handler(DEVICE_HANDLER)
dispatcher.add_handler(TWRP_HANDLER)
コード例 #12
0
ファイル: languages.py プロジェクト: annihilatorrrr/utahbot
           "Bahasa di *{}* saat ini adalah:\n{}.\n\nPilih bahasa:").format(
               chatname, currlang),
        parse_mode="markdown",
        reply_markup=keyboard)


@run_async
@user_admin_no_reply
def button(update, context):
    query = update.callback_query  # type: Optional[CallbackQuery]
    user = update.effective_user  # type: Optional[User]
    match = re.match(r"set_lang\((.+?)\)", query.data)
    if match:
        set_lang = match.group(1)
        chat = update.effective_chat  # type: Optional[Chat]
        sql.set_lang(chat.id, set_lang)
        update.effective_message.edit_text(
            tl(query.message,
               "Bahasa telah di ubah ke {}!").format(LANGS_TEXT.get(set_lang)))


__help__ = "language_help"

__mod_name__ = "Languages"

SETLANG_HANDLER = DisableAbleCommandHandler("setlang", set_language)
CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"set_lang")

dispatcher.add_handler(SETLANG_HANDLER)
dispatcher.add_handler(CALLBACK_QUERY_HANDLER)
コード例 #13
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
)

dispatcher.add_handler(REVERSE_HANDLER)
コード例 #14
0
ファイル: admin.py プロジェクト: annihilatorrrr/utahbot
INVITE_HANDLER = CommandHandler("invitelink", invite, filters=Filters.group)

PROMOTE_HANDLER = CommandHandler("promote",
                                 promote,
                                 pass_args=True,
                                 filters=Filters.group)
DEMOTE_HANDLER = CommandHandler("demote",
                                demote,
                                pass_args=True,
                                filters=Filters.group)

PERMANENT_PIN_SET_HANDLER = CommandHandler("permanentpin",
                                           permanent_pin_set,
                                           pass_args=True,
                                           filters=Filters.group)
PERMANENT_PIN_HANDLER = MessageHandler(
    Filters.status_update.pinned_message | Filters.user(777000), permanent_pin)

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

dispatcher.add_handler(PIN_HANDLER)
dispatcher.add_handler(UNPIN_HANDLER)
dispatcher.add_handler(PERMAPIN_HANDLER)
dispatcher.add_handler(INVITE_HANDLER)
dispatcher.add_handler(PROMOTE_HANDLER)
dispatcher.add_handler(DEMOTE_HANDLER)
dispatcher.add_handler(PERMANENT_PIN_SET_HANDLER)
dispatcher.add_handler(PERMANENT_PIN_HANDLER)
dispatcher.add_handler(ADMINLIST_HANDLER)
コード例 #15
0
ファイル: misc.py プロジェクト: annihilatorrrr/utahbot
    send_message(update.effective_message, tl(update.effective_message, "/save test Ini adalah tes markdown. _miring_, *tebal*, `kode`, "
                                        "[URL](contoh.com) [tombol](buttonurl:github.com) "
                                        "[tombol2](buttonurl:google.com:same)"))


@run_async
def stats(update, context):
    send_message(update.effective_message, tl(update.effective_message, "Statistik saat ini:\n") + "\n".join([mod.__stats__() for mod in STATS]))


# /ip is for private use
__help__ = "misc_help"

__mod_name__ = "Misc"

ID_HANDLER = DisableAbleCommandHandler("id", get_id, pass_args=True)
IP_HANDLER = CommandHandler("ip", get_bot_ip, filters=Filters.chat(OWNER_ID))

TIME_HANDLER = DisableAbleCommandHandler("time", get_time_alt, pass_args=True)

RUNS_HANDLER = DisableAbleCommandHandler(["runs", "lari"], runs)
SLAP_HANDLER = DisableAbleCommandHandler("slap", slap, pass_args=True)
INFO_HANDLER = DisableAbleCommandHandler("info", info, pass_args=True)

ECHO_HANDLER = CommandHandler("echo", echo, filters=Filters.user(OWNER_ID))
MD_HELP_HANDLER = CommandHandler("markdownhelp", markdown_help, filters=Filters.private)

STATS_HANDLER = CommandHandler("stats", stats, filters=CustomFilters.sudo_filter)

dispatcher.add_handler(ID_HANDLER)
dispatcher.add_handler(IP_HANDLER)
コード例 #16
0
ファイル: memes.py プロジェクト: minatouzuki/UtahaRobot
*Regex based memes:*

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

Some other regex filters are:
`me too` | `goodmorning` | `goodnight`.

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

"""

__mod_name__ = "Memes"

SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug)
DECIDE_HANDLER = DisableAbleMessageHandler(Filters.regex(r"(?i)^skylee\?"),
                                           decide,
                                           friendly="decide")
SNIPE_HANDLER = CommandHandler("snipe",
                               snipe,
                               pass_args=True,
                               filters=CustomFilters.sudo_filter)
ABUSE_HANDLER = DisableAbleCommandHandler("abuse", abuse)
RUNS_HANDLER = DisableAbleCommandHandler("runs", runs)
SLAP_HANDLER = DisableAbleCommandHandler("slap", slap, pass_args=True)
PUNCH_HANDLER = DisableAbleCommandHandler("punch", punch, pass_args=True)
HUG_HANDLER = DisableAbleCommandHandler("warm", hug, pass_args=True)
GBUN_HANDLER = CommandHandler("gbun", gbun)
TABLE_HANDLER = DisableAbleCommandHandler("table", table)
CRI_HANDLER = DisableAbleCommandHandler("cri", cri)
コード例 #17
0
ファイル: notes.py プロジェクト: annihilatorrrr/utahbot
def __migrate__(old_chat_id, new_chat_id):
	sql.migrate_chat(old_chat_id, new_chat_id)


def __chat_settings__(chat_id, user_id):
	notes = sql.get_all_chat_notes(chat_id)
	return tl(user_id, "Ada catatan `{}` dalam obrolan ini.").format(len(notes))


__help__ = "notes_help"

__mod_name__ = "Notes"

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

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

PMNOTE_HANDLER = CommandHandler("privatenote", private_note, pass_args=True)

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

dispatcher.add_handler(GET_HANDLER)
dispatcher.add_handler(SAVE_HANDLER)
dispatcher.add_handler(LIST_HANDLER)
dispatcher.add_handler(DELETE_HANDLER)
dispatcher.add_handler(PMNOTE_HANDLER)
dispatcher.add_handler(HASH_GET_HANDLER)
コード例 #18
0
*Available commands:*
 - /anime <anime>: returns information about the anime.
 - /character <character>: returns information about the character.
 - /manga <manga>: returns information about the manga.
 - /user <user>: returns information about a MyAnimeList user.
 - /upcoming: returns a list of new anime in the upcoming seasons.
 - /airing <anime>: returns anime airing info.
 - /watchlist: to get your saved watchlist.
 - /mangalist: to get your saved manga read list.
 - /characterlist | fcl: to get your favorite characters list.
 - /removewatchlist | rwl <anime>: to remove a anime from your list.
 - /rfcharacter | rfcl <character>: to remove a character from your list.  
 - /rmanga | rml <manga>: to remove a manga from your list.
 """

ANIME_HANDLER = DisableAbleCommandHandler("anime", anime)
AIRING_HANDLER = DisableAbleCommandHandler("airing", airing)
CHARACTER_HANDLER = DisableAbleCommandHandler("character", character)
MANGA_HANDLER = DisableAbleCommandHandler("manga", manga)
USER_HANDLER = DisableAbleCommandHandler("user", user)
UPCOMING_HANDLER = DisableAbleCommandHandler("upcoming", upcoming)
WATCHLIST_HANDLER = DisableAbleCommandHandler("watchlist", watchlist)
MANGALIST_HANDLER = DisableAbleCommandHandler("mangalist", readmanga)
FVRT_CHAR_HANDLER = DisableAbleCommandHandler(["characterlist", "fcl"],
                                              fvrtchar)
REMOVE_WATCHLIST_HANDLER = DisableAbleCommandHandler(
    ["removewatchlist", "rwl"], removewatchlist)
REMOVE_FVRT_CHAR_HANDLER = DisableAbleCommandHandler(["rfcharacter", "rfcl"],
                                                     removefvrtchar)
REMOVE_MANGA_CHAR_HANDLER = DisableAbleCommandHandler(["rmanga", "rml"],
                                                      removemangalist)
コード例 #19
0
        return temp

    reply = f"*Current weather for {cityname}, {country_name} is*:\n\n*Temperature:* `{celsius(curtemp)}°C ({fahr(curtemp)}ºF), feels like {celsius(feels_like)}°C ({fahr(feels_like)}ºF) \n`*Condition:* `{condmain}, {conddet}` {icon}\n*Humidity:* `{humidity}%`\n*Wind:* `{kmph[0]} km/h`\n"
    del_msg = update.effective_message.reply_text(
        "{}".format(reply),
        parse_mode=ParseMode.MARKDOWN,
        disable_web_page_preview=True)
    time.sleep(30)
    try:
        del_msg.delete()
        update.effective_message.delete()
    except BadRequest as err:
        if (err.message == "Message to delete not found") or (
                err.message == "Message can't be deleted"):
            return


__help__ = """
Weather module:

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

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

__mod_name__ = "Weather"

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

dispatcher.add_handler(WEATHER_HANDLER)
コード例 #20
0
INVITE_HANDLER = CommandHandler(["invitelink"], invite)
CHAT_PIC_HANDLER = CommandHandler("setgpic", setchatpic, filters=Filters.group)
DEL_CHAT_PIC_HANDLER = CommandHandler("delgpic", rmchatpic, filters=Filters.group)
SETCHAT_TITLE_HANDLER = CommandHandler(
    "setgtitle", setchat_title, filters=Filters.group
)
SETSTICKET_HANDLER = CommandHandler("setsticker", set_sticker, filters=Filters.group)
SETDESC_HANDLER = CommandHandler(["setdescription", "setdes"], set_desc, filters=Filters.group)

PROMOTE_HANDLER = CommandHandler(
    "promote", promote, pass_args=True, filters=Filters.group
)
DEMOTE_HANDLER = CommandHandler("demote", demote, pass_args=True, filters=Filters.group)

SET_TITLE_HANDLER = DisableAbleCommandHandler("settitle", set_title, pass_args=True)
ADMINLIST_HANDLER = DisableAbleCommandHandler(
    ["adminlist", "admins"], adminlist, filters=Filters.group
)

ADMIN_REFRESH_HANDLER = CommandHandler(
    "admincache", refresh_admin, filters=Filters.group)

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(SET_TITLE_HANDLER)
dispatcher.add_handler(CHAT_PIC_HANDLER)
コード例 #21
0
WARN_HANDLER = CommandHandler("warn",
                              warn_user,
                              pass_args=True,
                              filters=Filters.group)
RESET_WARN_HANDLER = CommandHandler(["resetwarn", "resetwarns"],
                                    reset_warns,
                                    pass_args=True,
                                    filters=Filters.group)
REMOVE_WARNS_HANDLER = CommandHandler(["rmwarn", "unwarn"],
                                      remove_warns,
                                      pass_args=True,
                                      filters=Filters.group)
CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"rm_warn")
MYWARNS_HANDLER = DisableAbleCommandHandler("warns",
                                            warns,
                                            pass_args=True,
                                            filters=Filters.group)
ADD_WARN_HANDLER = CommandHandler("addwarn",
                                  add_warn_filter,
                                  filters=Filters.group)
RM_WARN_HANDLER = CommandHandler(["nowarn", "stopwarn"],
                                 remove_warn_filter,
                                 filters=Filters.group)
LIST_WARN_HANDLER = DisableAbleCommandHandler(["warnlist", "warnfilters"],
                                              list_warn_filters,
                                              filters=Filters.group,
                                              admin_ok=True)
WARN_FILTER_HANDLER = MessageHandler(CustomFilters.has_text & Filters.group,
                                     reply_filter)
WARN_LIMIT_HANDLER = CommandHandler("warnlimit",
                                    set_warn_limit,
コード例 #22
0
"""

__mod_name__ = "Bans"

BAN_HANDLER = CommandHandler("ban", ban, pass_args=True, filters=Filters.group)
TEMPBAN_HANDLER = CommandHandler(["tban", "tempban"],
                                 temp_ban,
                                 pass_args=True,
                                 filters=Filters.group)
KICK_HANDLER = CommandHandler("kick",
                              kick,
                              pass_args=True,
                              filters=Filters.group)
UNBAN_HANDLER = CommandHandler("unban",
                               unban,
                               pass_args=True,
                               filters=Filters.group)
KICKME_HANDLER = DisableAbleCommandHandler("kickme",
                                           kickme,
                                           filters=Filters.group)
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)
コード例 #23
0
ファイル: cleaner.py プロジェクト: annihilatorrrr/utahbot
			if conn:
				text = tl(update.effective_message, "Penghapus pesan biru telah di *non-aktifka*n di *{}*.").format(chat_name)
			else:
				text = tl(update.effective_message, "Penghapus pesan biru telah di *non-aktifkan*.")
			send_message(update.effective_message, text, parse_mode="markdown")

		elif val == "yes" or val == "ya" or val == "on":
			sql.set_cleanbt(chat_id, True)
			if conn:
				text = tl(update.effective_message, "Penghapus pesan biru telah di *aktifkan* di *{}*.").format(chat_name)
			else:
				text = tl(update.effective_message, "Penghapus pesan biru telah di *aktifkan*.")
			send_message(update.effective_message, text, parse_mode="markdown")

		else:
			send_message(update.effective_message, tl(update.effective_message, "Argumen tidak dikenal - harap gunakan 'yes', atau 'no'."))
	else:
		send_message(update.effective_message, tl(update.effective_message, "Pengaturan untuk penghapus pesan biru saat ini di {}: *{}*").format(chat_name, "Enabled" if sql.is_enable(chat_id) else "Disabled"), parse_mode="markdown")


__help__ = "cleaner_help"

__mod_name__ = "Cleaner"

SET_CLEAN_BLUE_TEXT_HANDLER = DisableAbleCommandHandler("cleanbluetext", set_blue_text_must_click, pass_args=True)
CLEAN_BLUE_TEXT_HANDLER = MessageHandler(Filters.command & Filters.group, clean_blue_text_must_click)


dispatcher.add_handler(SET_CLEAN_BLUE_TEXT_HANDLER)
dispatcher.add_handler(CLEAN_BLUE_TEXT_HANDLER, 15)