Ejemplo n.º 1
0
        data = message.reply_to_message.text

    elif len(args) >= 1:
        data = message.text.split(None, 1)[1]
    else:
        message.reply_text("What am I supposed to do with this?")
        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'Nekofied to *Nekobin* : {url}'
    message.reply_text(reply_text,
                       parse_mode=ParseMode.MARKDOWN,
                       disable_web_page_preview=True)


__help__ = """
-> `/paste`
Do a paste at `neko.bin`
"""

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

__mod_name__ = "Paste"
__command_list__ = ["paste"]
__handlers__ = [PASTE_HANDLER]
Ejemplo n.º 2
0
 - /getcas: Gets the current CAS settings
 - /setban <on/off/true/false>: Enables/disables autoban on CAS banned user detected.
 - /setdefense <on/off/true/false>: Turns on defense mode, will kick any new user automatically.
 - /getdefense: gets the current defense setting
 - /kicktime: gets the auto-kick time setting
 - /setkicktime: sets new auto-kick time value (between 30 and 900 seconds)
 - /cas: Info about CAS. (What is CAS?)
"""

__mod_name__ = "CAS"

SETCAS_HANDLER = CommandHandler("setcas", setcas, filters=Filters.group)
GETCAS_HANDLER = CommandHandler("getcas",
                                get_current_setting,
                                filters=Filters.group)
GETVER_HANDLER = DisableAbleCommandHandler("casver", get_version)
CASCHECK_HANDLER = CommandHandler("cascheck", caschecker, pass_args=True)
CASQUERY_HANDLER = CommandHandler("casquery",
                                  casquery,
                                  pass_args=True,
                                  filters=CustomFilters.sudo_filter)
SETBAN_HANDLER = CommandHandler("setban", setban, filters=Filters.group)
GBANCHAT_HANDLER = CommandHandler("blchat",
                                  gbanChat,
                                  pass_args=True,
                                  filters=CustomFilters.sudo_filter)
UNGBANCHAT_HANDLER = CommandHandler("unblchat",
                                    ungbanChat,
                                    pass_args=True,
                                    filters=CustomFilters.sudo_filter)
DEFENSE_HANDLER = CommandHandler("setdefense", setDefense, pass_args=True)
Ejemplo n.º 3
0
Some memes command, find it all out yourself!
- /owo: OWO de text
- /stretch: STRETCH de text
- /vapor: owo vapor dis
- /mock: mocks a spongebob image with text
- /shout: Write anything that u want it to should
- /zalgofy: reply to a message to g̫̞l̼̦i̎͡tͫ͢c̘ͭh̛̗ it out!
- /kan: reply a text to kannafy.
- /changemymind: reply a text to stickerize.
- /trumptweet: reply a text for trump tweet.
- /eightball: shakes 8ball.
"""

__mod_name__ = "Memes and etc."

OWO_HANDLER = DisableAbleCommandHandler("owo", owo, admin_ok=True)
STRETCH_HANDLER = DisableAbleCommandHandler("stretch", stretch)
VAPOR_HANDLER = DisableAbleCommandHandler("vapor",
                                          vapor,
                                          pass_args=True,
                                          admin_ok=True)
ZALGO_HANDLER = DisableAbleCommandHandler("zalgofy", zalgotext)
DEEPFRY_HANDLER = DisableAbleCommandHandler("deepfry",
                                            deepfryer,
                                            admin_ok=True)
SHOUT_HANDLER = DisableAbleCommandHandler("shout", shout, pass_args=True)
KAN_HANDLER = DisableAbleCommandHandler("kan", kan)
CHANGEMYMIND_HANDLER = DisableAbleCommandHandler("changemymind", changemymind)
TRUMPTWEET_HANDLER = DisableAbleCommandHandler("trumptweet", trumptweet)
EIGHTBALL_HANDLER = DisableAbleCommandHandler("eightball", eightball)
Ejemplo n.º 4
0
            rep += f"🎧  <code>{artist} - {song}</code> (♥️, loved)"
        if image:
            rep += f"<a href='{image}'>\u200c</a>"
    else:
        tracks = res.json().get("recenttracks").get("track")
        track_dict = {
            tracks[i].get("artist").get("name"): tracks[i].get("name")
            for i in range(3)
        }
        rep = f"{user} was listening to:\n"
        for artist, song in track_dict.items():
            rep += f"🎧  <code>{artist} - {song}</code>\n"
        last_user = (requests.get(
            f"{base_url}?method=user.getinfo&user={username}&api_key={LASTFM_API_KEY}&format=json"
        ).json().get("user"))
        scrobbles = last_user.get("playcount")
        rep += f"\n(<code>{scrobbles}</code> scrobbles so far)"

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


__mod_name__ = "Last.FM"

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

dispatcher.add_handler(SET_USER_HANDLER)
dispatcher.add_handler(CLEAR_USER_HANDLER)
dispatcher.add_handler(LASTFM_HANDLER)
Ejemplo n.º 5
0
 - /rmblacklist <triggers>: Same as above.

Blacklist sticker is used to stop certain stickers. Whenever a sticker is sent, the message will be deleted immediately.
*NOTE:* Blacklist stickers do not affect the group admin.
 - /blsticker: See current blacklisted sticker.
*Only admin:*
 - /addblsticker <sticker link>: Add the sticker trigger to the black list. Can be added via reply sticker.
 - /unblsticker <sticker link>: Remove triggers from blacklist. The same newline logic applies here, so you can delete multiple triggers at once.
 - /rmblsticker <sticker link>: Same as above.
 - /blstickermode ban/tban/mute/tmute .
Note:
 - `<sticker link>` can be `https://t.me/addstickers/<sticker>` or just `<sticker>` or reply to the sticker message.
"""

BLACKLIST_HANDLER = DisableAbleCommandHandler("blacklist",
                                              blacklist,
                                              pass_args=True,
                                              admin_ok=True)
ADD_BLACKLIST_HANDLER = CommandHandler("addblacklist", add_blacklist)
UNBLACKLIST_HANDLER = CommandHandler(["unblacklist", "rmblacklist"],
                                     unblacklist)
BLACKLIST_DEL_HANDLER = MessageHandler(
    (Filters.text | Filters.command | Filters.sticker | Filters.photo)
    & Filters.group,
    del_blacklist,
    edited_updates=True)
dispatcher.add_handler(BLACKLIST_HANDLER)
dispatcher.add_handler(ADD_BLACKLIST_HANDLER)
dispatcher.add_handler(UNBLACKLIST_HANDLER)
dispatcher.add_handler(BLACKLIST_DEL_HANDLER, group=BLACKLIST_GROUP)

__mod_name__ = "Blacklists"
Ejemplo n.º 6
0
        dispatcher.bot.get_chat_member(chat_id, user_id).status in (
            "administrator", "creator"))


__help__ = """
 - /adminlist: list of admins in the chat
*Admin only:*
 - /pin: silently pins the message replied to - add 'loud' or 'notify' to give notifs to users.
 - /unpin: unpins the currently pinned message
 - /invitelink: gets invitelink
 - /promote: promotes the user replied to
 - /demote: demotes the user replied to
 - /settitle: sets a custom title for an admin that the bot promoted
"""

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

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

INVITE_HANDLER = DisableAbleCommandHandler("invitelink",
                                           invite,
                                           filters=Filters.group)

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

SET_TITLE_HANDLER = CommandHandler("settitle", set_title, pass_args=True)

dispatcher.add_handler(ADMINLIST_HANDLER)
dispatcher.add_handler(PIN_HANDLER)
Ejemplo n.º 7
0
 - /hug : hugs a user by a reply to the message
 - /weebify <text>: returns a weebified text
 - /police : *Sirens* Polize iz here
 - /moon : Cycles all the phases of the moon emojis.
 - /clock : Cycles all the phases of the clock emojis.
 - /owo: OWO de text
 - /stretch: STRETCH de text
 - /vapor: owo vapor dis
 - /mock: mocks a spongebob image with text
 - /shout: Write anything that u want it to should
 - /zalgofy: reply to a message to g̫̞l̼̦i̎͡tͫ͢c̘ͭh̛̗ it out!
 - /changemymind: reply a text to stickerize.
 - /trumptweet: reply a text for trump tweet.
 - /eightball: shakes 8ball.
"""
OWO_HANDLER = DisableAbleCommandHandler("owo", owo, admin_ok=True)
STRETCH_HANDLER = DisableAbleCommandHandler("stretch", stretch)
VAPOR_HANDLER = DisableAbleCommandHandler(
    "vapor", vapor, pass_args=True, admin_ok=True)
ZALGO_HANDLER = DisableAbleCommandHandler("zalgofy", zalgotext)
DEEPFRY_HANDLER = DisableAbleCommandHandler(
    "deepfry", deepfryer, admin_ok=True)
SHOUT_HANDLER = DisableAbleCommandHandler("shout", shout, pass_args=True)
CHANGEMYMIND_HANDLER = DisableAbleCommandHandler("changemymind", changemymind)
TRUMPTWEET_HANDLER = DisableAbleCommandHandler("trumptweet", trumptweet)
EIGHTBALL_HANDLER = DisableAbleCommandHandler("eightball", eightball)
POLICE_HANDLER = DisableAbleCommandHandler(["police"], police)
MOON_HANDLER = DisableAbleCommandHandler(["moon"], moon)
CLOCK_HANDLER = DisableAbleCommandHandler(["clock"], clock)
PAT_HANDLER = DisableAbleCommandHandler("pat", pat)
HUG_HANDLER = DisableAbleCommandHandler("hug", hug)
Ejemplo n.º 8
0
    message = update.effective_message
    if len(args) == 0:
        update.effective_message.reply_text(
            "That was a funny joke, but no really, put in a location")
    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("Open with: [Google Maps]({})".format(gm),
                                  parse_mode=ParseMode.MARKDOWN,
                                  disable_web_page_preview=True)
    except AttributeError:
        update.message.reply_text("I can't find that")


__help__ = """
- /gps: <location> Get gps location..
"""

__mod_name__ = "Gps"

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

dispatcher.add_handler(GPS_HANDLER)
Ejemplo n.º 9
0
from lynda import dispatcher
from telegram import ParseMode, Update, Bot
from lynda.modules.disable import DisableAbleCommandHandler
from telegram.ext import run_async


@run_async
def truth(bot: Bot, update: Update):
    update.effective_message.reply_text(
        random.choice(truth_and_dare_string.TRUTH))


@run_async
def dare(bot: Bot, update: Update):
    update.effective_message.reply_text(
        random.choice(truth_and_dare_string.DARE))


__help__ = """
 • `/truth`*:* for random truth
 • `/dare`*:* for random dare
"""

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

dispatcher.add_handler(TRUTH_HANDLER)
dispatcher.add_handler(DARE_HANDLER)

__mod_name__ = "Truth or Dare"
Ejemplo n.º 10
0
            status += "⛈� "
        elif status_now < 622:  # Snow
            status += "🌨� "
        elif status_now < 781:  # Atmosphere
            status += "🌪� "
        elif status_now < 800:  # Bright
            status += "🌤� "
        elif status_now < 801:  # A little cloudy
            status += "⛅� "
        elif status_now < 804:  # Cloudy
            status += "�� "
        status += theweather._detailed_status

        update.message.reply_text(
            "Today in {} is being {}, around {}°C.\n".format(
                thelocation, status, temperature))

    except pyowm.exceptions.api_response_error:
        update.effective_message.reply_text("Sorry, location not found.")


__help__ = """
 - /weather <city>: get weather info in a particular place
"""

__mod_name__ = "Weather"

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

dispatcher.add_handler(WEATHER_HANDLER)
Ejemplo n.º 11
0

def __chat_settings__(chat_id, _user_id):
    blacklisted = sql.num_stickers_chat_filters(chat_id)
    return "There are `{} `blacklisted stickers.".format(blacklisted)


def __stats__():
    return "{} blacklist stickers, across {} chats.".format(
        sql.num_stickers_filters(), sql.num_stickers_filter_chats())


__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)
Ejemplo n.º 12
0
list all active filters in this chat.

──「 *Admin only:* 」──
-> `/filter` <keyword> <reply message>
add a filter to this chat. The bot will now reply that message whenever 'keyword'\
is mentioned. If you reply to a sticker with a keyword, the bot will reply with that sticker. NOTE: all filter \
keywords are in lowercase. If you want your keyword to be a sentence, use quotes. eg: /filter "hey there" How you \
doin?
-> `/stop` <filter keyword>
stop that filter.
"""

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, 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)

__mod_name__ = "Filters"
__handlers__ = [
    FILTER_HANDLER,
    STOP_HANDLER,
    LIST_HANDLER,
    (CUST_FILTER_HANDLER, HANDLER_GROUP),
]
Ejemplo n.º 13
0
**Google Reverse Search: **
 - /reverse: Does a reverse image search of the media which it was replied to.

**Text-to-Speach**
 - /tts <sentence>:  Text to Speech!

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

**Playstore:**
 - /app <app name>: finds an app in playstore for you
"""
APP_HANDLER = DisableAbleCommandHandler("app", app)
UD_HANDLER = DisableAbleCommandHandler("ud", ud)
COVID_HANDLER = DisableAbleCommandHandler(["covid", "corona"], covid)
WALL_HANDLER = DisableAbleCommandHandler("wall", wall, pass_args=True)
CONVERTER_HANDLER = CommandHandler('cash', convert)
TIME_HANDLER = DisableAbleCommandHandler("time", gettime)
REVERSE_HANDLER = DisableAbleCommandHandler("reverse",
                                            reverse,
                                            pass_args=True,
                                            admin_ok=True)
TTS_HANDLER = DisableAbleCommandHandler('tts', tts, pass_args=True)

dispatcher.add_handler(APP_HANDLER)
dispatcher.add_handler(COVID_HANDLER)
dispatcher.add_handler(REVERSE_HANDLER)
dispatcher.add_handler(WALL_HANDLER)
Ejemplo n.º 14
0
    b = "=" * 14, " Uptime ", "=" * 13
    upt_header = "".join(b)
    f = int(uptime())
    pcuptime = seconds_to_str(f)
    up = "{}\n\nUptime: {}\n".format(upt_header, pcuptime)
    c = "=" * 15, " CPU ", "=" * 15
    cpu_header = "".join(c)
    cpumodel = cpuinfo.get_cpu_info()['brand']
    cpufreq = psutil.cpu_freq()
    cpu_info = "{}\n\n{}\nPhysical cores: {}\nTotal cores: {}\nMax Frequency: {:.2f} Mhz\nCurrent Frequency: {:.2f} Mhz\nCPU Usage: {}%\n".format(
        cpu_header, cpumodel, psutil.cpu_count(logical=False),
        psutil.cpu_count(logical=True), cpufreq.max, cpufreq.current,
        psutil.cpu_percent(percpu=False, interval=1))
    d = "=" * 15, " RAM ", "=" * 15
    ram_header = "".join(d)
    svmem = psutil.virtual_memory()
    ram_info = "{}\n\nTotal: {}\nAvailable: {} ({:.2f}%)\nUsed: {} ({:.2f}%)\n".format(
        ram_header, get_size(svmem.total), get_size(svmem.available),
        100 - svmem.percent, get_size(svmem.used), svmem.percent)
    server_status = "```\n{}\n{}\n{}\n{}\n```".format(sys_info, up, cpu_info,
                                                      ram_info)
    update.message.reply_text(server_status, parse_mode="Markdown")


# __help__ = """
#  **Dev Only!**
#  - /sysinfo - Gives information about bot hosted server.
# """
__mod_name__ = "System Info"
SYSINFO_HANDLER = DisableAbleCommandHandler("sysinfo", sysinfo)
dispatcher.add_handler(SYSINFO_HANDLER)
Ejemplo n.º 15
0
                    parse_mode=ParseMode.MARKDOWN)
            else:
                tekstr = trl.translate(text, dest=dest_lang, src=source_lang)
                message.reply_text("Translated from `{}` to `{}`:\n`{}`".format(source_lang, dest_lang, tekstr.text),
                                   parse_mode=ParseMode.MARKDOWN)

    except IndexError:
        update.effective_message.reply_text(
            "Reply to messages or write messages from other languages ​​for translating into the intended language\n\n"
            "Example: `/tr en ml` to translate from English to Malayalam\n"
            "Or use: `/tr ml` for automatic detection and translating it into Malayalam.\n"
            "See [List of Language Codes](t.me/OnePunchSupport/12823) for a list of language codes.",
            parse_mode="markdown", disable_web_page_preview=True)
    except ValueError:
        update.effective_message.reply_text("The intended language is not found!")
    else:
        return


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

TRANSLATE_HANDLER = DisableAbleCommandHandler("tr", totranslate)

dispatcher.add_handler(TRANSLATE_HANDLER)

__mod_name__ = "Translator"
__command_list__ = ["tr"]
__handlers__ = [TRANSLATE_HANDLER]
Ejemplo n.º 16
0
        f"Finding timezone info for <b>{query}</b>", parse_mode=ParseMode.HTML)

    query_timezone = query.lower()
    if len(query_timezone) == 2:
        result = generate_time(query_timezone, ["countryCode"])
    else:
        result = generate_time(query_timezone, ["zoneName", "countryName"])

    if not result:
        send_message.edit_text(
            f"Timezone info not available for <b>{query}</b>",
            parse_mode=ParseMode.HTML)
        return

    send_message.edit_text(result, parse_mode=ParseMode.HTML)


__help__ = """
 - /time <query> : Gives information about a timezone.

Available queries : Country Code/Country Name/Timezone Name
"""

TIME_HANDLER = DisableAbleCommandHandler("time", gettime)

dispatcher.add_handler(TIME_HANDLER)

__mod_name__ = "Time"
__command_list__ = ["time"]
__handlers__ = [TIME_HANDLER]
Ejemplo n.º 17
0
__help__ = """
-> `/kickme`: kicks the user who issued the command

──「 *Admin only:* 」──
-> `/ban` <userhandle>
bans a user. (via handle, or reply)
-> `/tban` <userhandle> x(m/h/d)
bans a user for x time. (via handle, or reply). m = minutes, h = hours, d = days.
-> `/unban` <userhandle>
unbans a user. (via handle, or reply)
-> `/kick` <userhandle>
kickes a user out of the group, (via handle, or reply)
"""

BANME_HANDLER = DisableAbleCommandHandler("banme",
                                          banme,
                                          filters=Filters.group)
BAN_HANDLER = CommandHandler("ban", ban, pass_args=True)
TEMPBAN_HANDLER = CommandHandler(["tban", "tempban"], temp_ban, pass_args=True)
KICK_HANDLER = CommandHandler("kick", kick, pass_args=True)
UNBAN_HANDLER = CommandHandler("unban", unban, pass_args=True)
ROAR_HANDLER = CommandHandler("roar", selfunban, pass_args=True)
KICKME_HANDLER = DisableAbleCommandHandler("kickme",
                                           kickme,
                                           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(ROAR_HANDLER)
Ejemplo n.º 18
0
                 "<b>Time taken:</b> <code>{}</code>\n"
                 "<b>Service uptime:</b> <code>{}</code>".format(
                     telegram_ping, uptime))

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


@run_async
def pingall(bot: Bot, update: Update):
    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)
PINGALL_HANDLER = DisableAbleCommandHandler("pingall", pingall)

dispatcher.add_handler(PING_HANDLER)
dispatcher.add_handler(PINGALL_HANDLER)
__command_list__ = ["ping", "pingall"]
__handlers__ = [PING_HANDLER, PINGALL_HANDLER]
Ejemplo n.º 19
0
-> `/slap`
slap a user, or get slapped if not a reply.
-> `/shrug`
get shrug XD.
-> `/table`
get flip/unflip :v.
-> `/insult`
Insults the retar
-> `/pat`
pats a user by a reply to the message
-> `/hug`
hugs a user by a reply to the message
"""


PAT_HANDLER = DisableAbleCommandHandler("pat", pat)
HUG_HANDLER = DisableAbleCommandHandler("hug", hug)
SLAP_HANDLER = DisableAbleCommandHandler("slap", slap, pass_args=True)
SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug)
TABLE_HANDLER = DisableAbleCommandHandler("table", table)
INSULT_HANDLER = DisableAbleCommandHandler("insult", insult)

dispatcher.add_handler(SLAP_HANDLER)
dispatcher.add_handler(SHRUG_HANDLER)
dispatcher.add_handler(TABLE_HANDLER)
dispatcher.add_handler(INSULT_HANDLER)
dispatcher.add_handler(PAT_HANDLER)
dispatcher.add_handler(HUG_HANDLER)

__mod_name__ = "Fun"
Ejemplo n.º 20
0
    "Dance naked on a couple of HT wires.",
    "Active Volcano is the best swimming pool for you.",
    "You should try hot bath in a volcano.",
    "Try to spend one day in a coffin and it will be yours forever.",
    "Hit Uranium with a slow moving neutron in your presence. It will be a worthwhile experience.",
    "You can be the first person to step on sun. Have a try.",
    "🤭.",
)


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


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

__mod_name__ = "Insults"

INSULT_HANDLER = DisableAbleCommandHandler("insult", insult)

dispatcher.add_handler(INSULT_HANDLER)
Ejemplo n.º 21
0
from typing import Optional, List
from telegram import Update
from telegram.ext import CallbackContext
from lynda import dispatcher
from lynda.modules.disable import DisableAbleCommandHandler
import wikipedia


def wiki(update: Update, context: CallbackContext):
    args = context.args
    reply = " ".join(args)
    summary = '{} {}'
    update.message.reply_text(
        summary.format(wikipedia.summary(reply, sentences=3),
                       wikipedia.page(reply).url))


__help__ = """
-> `/wiki` text
Returns search from wikipedia for the input text
"""
__mod_name__ = "Wikipedia"
WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki, pass_args=True)
dispatcher.add_handler(WIKI_HANDLER)
Ejemplo n.º 22
0
            if song.lyrics:
                reply = song.format()
            else:
                reply = "Couldn't find any lyrics for that song!"
        else:
            reply = "Song not found!"
        if len(reply) > 4090:
            with open("lyrics.txt", 'w') as f:
                f.write(f"{reply}\n\n\nOwO UwU OmO")
            with open("lyrics.txt", 'rb') as f:
                msg.reply_document(
                    document=f,
                    caption=
                    "Message length exceeded max limit! Sending as a text file."
                )
        else:
            msg.reply_text(reply)


__help__ = """
Want to get the lyrics of your favorite songs straight from the app? This module is perfect for that!
*Available commands:*
 - /lyrics <song>: returns the lyrics of that song.
 You can either enter just the song name or both the artist and song name.
"""

__mod_name__ = "Lyrics"

LYRICS_HANDLER = DisableAbleCommandHandler("lyrics", lyrics, pass_args=True)

dispatcher.add_handler(LYRICS_HANDLER)
Ejemplo n.º 23
0
──「 *Admin only:*  」──
-> `/lock` <type>
lock items of a certain type (not available in private)
-> `/unlock` <type>
unlock items of a certain type (not available in private)
-> `/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 which haven't been whitelisted, locking stickers will delete all \
stickers, etc.
Locking bots will stop non-admins from adding bots to the chat.
"""

LOCKTYPES_HANDLER = DisableAbleCommandHandler("locktypes", locktypes)
LOCK_HANDLER = CommandHandler("lock", lock, pass_args=True)
UNLOCK_HANDLER = CommandHandler("unlock", unlock, pass_args=True)
LOCKED_HANDLER = CommandHandler("locks", list_locks)
LOCKABLE_HANDLER = MessageHandler(Filters.all & Filters.group, del_lockables)
RESTRICTION_HANDLER = MessageHandler(Filters.all & Filters.group, rest_handler)

dispatcher.add_handler(LOCK_HANDLER)
dispatcher.add_handler(UNLOCK_HANDLER)
dispatcher.add_handler(LOCKTYPES_HANDLER)
dispatcher.add_handler(LOCKED_HANDLER)
dispatcher.add_handler(LOCKABLE_HANDLER, PERM_GROUP)
dispatcher.add_handler(RESTRICTION_HANDLER, REST_GROUP)

__mod_name__ = "Locks"
__handlers__ = [
Ejemplo n.º 24
0
 - /strongwarn <on/yes/off/no>: If set to on, exceeding the warn limit will result in a ban. Else, will just punch.
"""

__mod_name__ = "Warnings"

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)
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,
Ejemplo n.º 25
0
@run_async
def clock(bot: Bot, update: Update):
    message = update.effective_message.reply_text('/moon')

    animation_chars = [
        "🕙🕘🕖🕕🕔🕓🕒🕑🕐🕛", "🕘🕗🕕🕔🕓🕒🕑🕐🕛🕙", "🕗🕕🕔🕓🕒🕑🕐🕛🕙🕘", "🕕🕔🕓🕒🕑🕐🕛🕙🕘🕗", "🕔🕓🕒🕑🕐🕛🕙🕘🕗🕕",
        "🕓🕒🕑🕐🕛🕙🕘🕗🕕🕔", "🕒🕑🕐🕛🕙🕘🕗🕕🕔🕓", "🕑🕐🕛🕙🕘🕗🕕🕔🕓🕒", "*tick-tock*"
    ]
    for i in animation_chars:
        message.edit_text(i)
        sleep(0.5)


__help__ = """
 - /police : *Sirens* Polize iz here
 - /moon : Cycles all the phases of the moon emojis.
 - /clock : Cycles all the phases of the clock emojis.
"""

POLICE_HANDLER = DisableAbleCommandHandler(["police"], police)
MOON_HANDLER = DisableAbleCommandHandler(["moon"], moon)
CLOCK_HANDLER = DisableAbleCommandHandler(["clock"], clock)

dispatcher.add_handler(POLICE_HANDLER)
dispatcher.add_handler(MOON_HANDLER)
dispatcher.add_handler(CLOCK_HANDLER)

__mod_name__ = "Parser"
__command_list__ = ["police", "moon", "clock"]
__handlers__ = [POLICE_HANDLER, MOON_HANDLER, CLOCK_HANDLER]
Ejemplo n.º 26
0
    site_search(bot, update, "kayo")


__help__ = """
Get information about anime, manga or characters from [MyAnimeList](https://myanimelist.net).
*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.
 - /kaizoku <anime>: search an anime on animekaizoku.com
 - /kayo <anime>: search an anime on animekayo.com
 """

ANIME_HANDLER = DisableAbleCommandHandler("anime", anime)
CHARACTER_HANDLER = DisableAbleCommandHandler("character", character)
MANGA_HANDLER = DisableAbleCommandHandler("manga", manga)
USER_HANDLER = DisableAbleCommandHandler("user", user)
UPCOMING_HANDLER = DisableAbleCommandHandler("upcoming", upcoming)
KAIZOKU_SEARCH_HANDLER = DisableAbleCommandHandler("kaizoku", kaizoku)
KAYO_SEARCH_HANDLER = DisableAbleCommandHandler("kayo", kayo)
BUTTON_HANDLER = CallbackQueryHandler(button, pattern='anime_.*')

dispatcher.add_handler(BUTTON_HANDLER)
dispatcher.add_handler(ANIME_HANDLER)
dispatcher.add_handler(CHARACTER_HANDLER)
dispatcher.add_handler(MANGA_HANDLER)
dispatcher.add_handler(USER_HANDLER)
dispatcher.add_handler(KAIZOKU_SEARCH_HANDLER)
dispatcher.add_handler(KAYO_SEARCH_HANDLER)
Ejemplo n.º 27
0
    elif bio:
        return f"\n<b>What others say:</b>\n{bio}\n"
    elif me:
        return f"\n<b>About user:</b>\n{me}\n"
    else:
        return "\n"


__help__ = """
 - /setbio <text>: while replying, will save another user's bio
 - /bio: will get your or another user's bio. This cannot be set by yourself.
 - /setme <text>: will set your info
 - /me: will get your or another user's info
"""

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)

__mod_name__ = "Bios and Abouts"
__command_list__ = ["setbio", "bio", "setme", "me"]
__handlers__ = [
    SET_BIO_HANDLER, GET_BIO_HANDLER, SET_ABOUT_HANDLER, GET_ABOUT_HANDLER
]
Ejemplo n.º 28
0
        speed.download()
        speed.upload()
        replymsg = 'SpeedTest Results:'

        if query.data == 'speedtest_image':
            speedtest_image = speed.results.share()
            update.effective_message.reply_photo(photo=speedtest_image,
                                                 caption=replymsg)
            msg.delete()

        elif query.data == 'speedtest_text':
            result = speed.results.dict()
            replymsg += f"\nDownload: `{convert(result['download'])}Mb/s`\nUpload: `{convert(result['upload'])}Mb/s`\nPing: `{result['ping']}`"
            update.effective_message.edit_text(replymsg,
                                               parse_mode=ParseMode.MARKDOWN)
    else:
        query.answer(
            "You are required to join Eagle Union to use this command.")


SPEED_TEST_HANDLER = DisableAbleCommandHandler("speedtest", speedtestxyz)
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]
Ejemplo n.º 29
0
    stats = "Current stats:\n" + "\n".join(mod.__stats__() for mod in STATS)
    result = re.sub(r'(\d+)', r'<code>\1</code>', stats)
    r = requests.get("https://api.waa.ai/v2/links/Lynda").json()
    result += f"\nClicks on Repository: {r['data']['clicks']}"
    update.effective_message.reply_text(result, parse_mode=ParseMode.HTML)


__help__ = """
 - /id: get the current group id. If used by replying to a message, gets that user's id.
 - /gifid: reply to a gif to me to tell you its file ID.
 - /info: get information about a user.
 - /markdownhelp: quick summary of how markdown works in telegram - can only be called in private chats.
 - /karma - Coming soon
"""

ID_HANDLER = DisableAbleCommandHandler("id", get_id, pass_args=True)
GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid)
INFO_HANDLER = DisableAbleCommandHandler("info", info, pass_args=True)
ECHO_HANDLER = DisableAbleCommandHandler("echo", echo, filters=Filters.group)
MD_HELP_HANDLER = CommandHandler("markdownhelp",
                                 markdown_help,
                                 filters=Filters.private)
STATS_HANDLER = CommandHandler("stats", stats)

dispatcher.add_handler(ID_HANDLER)
dispatcher.add_handler(GIFID_HANDLER)
dispatcher.add_handler(INFO_HANDLER)
dispatcher.add_handler(ECHO_HANDLER)
dispatcher.add_handler(MD_HELP_HANDLER)
dispatcher.add_handler(STATS_HANDLER)
Ejemplo n.º 30
0
        update.effective_message.reply_text(bdaymessage + username)


__help__ = """
*Owner only:*
- /banall: Ban all members from a chat
*Sudo only:*
- /snipe *chatid* *string*: Make me send a message to a specific chat.
*Admin only:*
- /birthday *@username*: Spam user with birthday wishes.
"""

__mod_name__ = "Special"

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

dispatcher.add_handler(SNIPE_HANDLER)
dispatcher.add_handler(BANALL_HANDLER)
dispatcher.add_handler(BIRTHDAY_HANDLER)