Exemplo n.º 1
0
def pingall(bot: BOT, message: Message):
    chat_members = bot.iter_chat_members(message.chat.id)
    tagable = [create_link(x) for x in chat_members if not x.user.is_bot]
    for i in range(math.ceil(len(tagable) / 10)):
        toTag = tagable[i * 10:(i + 1) * 10]
        bot.send_message(message.chat.id, " ".join(map(str, toTag)))
        sleep(1)
Exemplo n.º 2
0
def set_afk(bot: BOT, message: Message):
    db = sqlite3.connect(PYRO_DB)
    c = db.cursor()
    c.execute(GET_AFK.format(message.chat.id))
    res = c.fetchone()
    try:
        check = str(res[1])
        if check == "1":
            afk_text = "disabled"
            checker = 0
            db = sqlite3.connect(PYRO_DB)
            c = db.cursor()
            c.execute(REMOVE_AFKTEXT.format(message.chat.id))
            db.commit()
            db = sqlite3.connect(PYRO_DB)
            c = db.cursor()
            c.execute(SET_AFKOFF.format(escape(afk_text), checker))
            db.commit()
            #            message.edit(f"AFK switched off!\n", disable_web_page_preview=True)
            if checker == 0:
                bot.send_message(LOGGER_GROUP,
                                 f"AFK mode switched off",
                                 parse_mode="html")
    except:
        return
Exemplo n.º 3
0
def dice(bot: BOT, message: Message):
    max = int(message.command[1])
    dice = randint(1, max)
    message.delete()
    max = str(max)
    dice = str(dice)
    bot.send_message(message.chat.id,
                     "Deine Zahl aus 1 und " + max + " beträgt: " + dice)
Exemplo n.º 4
0
def extend_if_players_too_less_starlightwerewolf(bot: BOT, message: Message):
    global messageid
    global players
    global idplayers
    global match
    int(match)
    if match < 5:
        bot.send_message(message.chat.id, "/extend@blackwerewolfbot 60")
Exemplo n.º 5
0
def word_count(bot: BOT, message: Message):
    chat = message.chat.id
    check1 = str(message.command[0])
    check2 = str(message.command[-1])
    if message.chat.type == 'supergroup':
        channelname = str(message.chat.id)
        messageid = str(message.message_id)
        linkid = channelname.replace("-100", "")
        linkd = "https://t.me/c/" + linkid + "/" + messageid
        link = f"<a href='{linkd}'>{message.chat.title}</a>\n"
    elif message.chat.type == 'private':
        username = message.chat.id
        title = message.chat.first_name

        linkd = "tg://user?id=" + str(username)
        link = f"<a href='{linkd}'>{title}</a>\n"
    elif message.chat.type == 'bot':
        username = message.chat.id
        title = message.chat.first_name

        linkd = "tg://user?id=" + str(username)
        link = f"<a href='{linkd}'>{title}</a>\n"

    if check2 == COMMAND:
        bot.send_message(LOGGER_GROUP, "<b>Wrong input!</b>\nCorrect Syntax:\n.wc 100 20\nOut of <b>100</b> Posts back the Top<b>20</b>" )
        message.delete()
        return
    else:
        limit = int(message.command[1])
        message.delete()

    toplist = int(message.command[-1])
    words = custom()
    progress = bot.send_message(LOGGER_GROUP, "`processed 0 messages...`")
    total = 0

    for msg in bot.iter_history(chat, limit):
        total += 1
        if total % 200 == 0:
            progress.edit_text(f"`processed {total} messages...`")
        if msg.text:
            for word in msg.text.split():
                words[word.lower()] += 1
        if msg.caption:
            for word in msg.caption.split():
                words[word.lower()] += 1

    freq = sorted(words, key=words.get, reverse=True)
    out = f"Word counter from ({link}).\nOut of {limit} Posts the Top{toplist}:\n"

    for i in range(toplist):
        out += f"{i+1}. {words[freq[i]]}: {freq[i]}\n"

    progress.edit_text(out)
Exemplo n.º 6
0
def list_vids(bot: BOT, message: Message):
    db = sqlite3.connect(PYRO_DB)
    c = db.cursor()
    c.execute(LIST_NOTES)
    result = c.fetchall()
    res = [i[0] for i in result]
    notes = "**List of available Videnotes:**\n`.note [name]`\n"
    for note in sorted(res):
        notes += f"→ `{note}`\n"
    BOT.send_message("me", notes)
    message.edit("List of available Videonotes sent in Saved Mesages")
    sleep(2)
    message.delete()
Exemplo n.º 7
0
def all_welcome(bot: BOT, message: Message):
    db = sqlite3.connect(PYRO_DB)
    c = db.cursor()
    c.execute(ALL_WELCOME)
    res = c.fetchall()
    if res:
        welcome_messages = "**All Welcome Messages:**\n"
        for welcome in res:
            welcome_messages += f"\n👉 **{welcome[0]}**\n{unescape(welcome[1])}\n"
        BOT.send_message('me', welcome_messages, disable_web_page_preview=True)
        message.edit("Welcome messages sent in Saved Messages.")
        sleep(2)
        message.delete()
Exemplo n.º 8
0
def text_to_speech(bot: BOT, message: Message):
    if not len(message.command) > 1:
        message.edit("I need words to say...")
        sleep(2)
        message.delete()
        return

    if message.command[-1] not in gtts_langs:
        language = 'en'
        words_to_say = " ".join(message.command[1:])
    else:
        language = ''.join(message.command[-1])
        words_to_say = " ".join(message.command[1:-1])

    speech = gtts.gTTS(words_to_say, language)
    speech.save('text_to_speech.oog')
    try:
        BOT.send_voice(chat_id=message.chat.id,
                       voice='text_to_speech.oog',
                       reply_to_message_id=ReplyCheck(message))
    except errors.UnknownError as e:
        if e.x.error_message == 'CHAT_SEND_MEDIA_FORBIDDEN':
            message.edit(
                "Voice Messages aren't allowed here.\nCopy sent to Saved Messages."
            )
        else:
            message.edit(
                "Text-To-Speech couldn't be sent.\nCopy sent to Saved Messages."
            )
        BOT.send_message('me', ' '.join(message.command[1:]))
        BOT.send_voice('me', 'text_to_speech.oog')
        sleep(2)
    try:
        os.remove('text_to_speech.oog')
    except FileNotFoundError:
        pass
    message.delete()
Exemplo n.º 9
0
def answer_mentioned(bot: BOT, message: Message):
    chatid = str(message.chat.id).replace("-100", "")
    messageID = message.message_id
    username = message.from_user.first_name
    usertype = message.chat.type
    if usertype == 'private' or 'supergroup' or 'group':
        db = sqlite3.connect(PYRO_DB)
        c = db.cursor()
        c.execute(GET_AFK.format(message.chat.id))
        res = c.fetchone()
        try:
            mes = str(res[0])[1:]
            check = str(res[1])
            if check == "1":
                #                bot.send_message(message.chat.id, f"`Sorry, i'm away from Keyboard!\n{mes}`")
                bot.send_message(
                    chat_id=message.chat.id,
                    text=f"`Sorry, i'm away from Keyboard!\n{mes}`",
                    reply_to_message_id=messageID)
                if usertype == 'supergroup':
                    bot.send_message(
                        LOGGER_GROUP,
                        f"<b>Sent away message to <a href='t.me/c/{chatid}/{messageID}'>{username}</a> ({usertype})!</b>",
                        parse_mode="html")
                elif usertype == 'private' or 'group':
                    bot.send_message(
                        LOGGER_GROUP,
                        f"<b>Sent away message to {username} ({usertype})!</b>",
                        parse_mode="html")
                else:
                    bot.send_message(LOGGER_GROUP,
                                     f"<b>Sent away message to unknown!</b>",
                                     parse_mode="html")
        except:
            return
    else:
        return
Exemplo n.º 10
0
def notify_when_pingall_ready(bot: BOT, message: Message):
    sleep(600)
    bot.send_message(message.chat.id, "Pingall kann wieder verwendet werden!\nPingall can be used again!")
Exemplo n.º 11
0
def send_ot_link(bot: BOT, message: Message):
    bot.send_message(
        message.chat.id,
        "**Dieb-Stealrate:**\n\n100% Chance:\nWolfsmensch\nDorfbewohner\nUnglücksrabe\n\n75% Chance:\nMonarch\nAlchemist\nVerfluchter\nFreimaurer\nBetrunkener\nBürgermeister\nSchütze\nBeobachter\nVerräter\nAmor\nPrinz\nNarr\n\n50% Chance:\nSchutzengel\nKultist\nSchmied\nSandmann\nWerwolf\nZauberer\nLykan\Alibiwolf\nMärtyrer\nMagier\nEule\nDorfältester\nDetektiv\nSeherlehrling\nHure\nKultbeobachter\nPazifist\nOrakle\nLucifer\nWetterbendiger\nBetawolf\nPyromane\n\n25% Chance:\nKultjäger\nAlphawolf\nSerienmörder\nMarionettenmeister\n\n0% Chance:\nDoppelgänger\nLeichenschänder"
    )
Exemplo n.º 12
0
def send_ot_link(bot: BOT, message: Message):
    bot.send_message(
        message.chat.id,
        'Hier geht es zur Offtopic Gruppe: \n\n https://t.me/joinchat/ApybhxaNEmsRQhBu6i3sLw'
    )
Exemplo n.º 13
0
def LogMessage(logmsg):
    if LOGGER:
        BOT.send_message(
            chat_id=LOGGER_GROUP,
            text=logmsg)
Exemplo n.º 14
0
def pingtime_deutsch(bot: BOT, message: Message):
    sleep(600)
    bot.send_message(message.chat.id, "Pingtime kann wieder verwendet werden!")
Exemplo n.º 15
0
def pingtime_englisch(bot: BOT, message: Message):
    sleep(600)
    bot.send_message(message.chat.id, "You can use /pingtime again!")
Exemplo n.º 16
0
def person(bot: BOT, message: Message):
    person = Person()
    message.delete()
    bot.send_message(message.chat.id, person)