Esempio n. 1
0
def createforthem():
    if request.method == "POST":
        name = request.form.get('name')
        url = request.form.get('url')
        key = request.form.get('key')
        if 'https://discord.com' in url and 'bot' in url:
            owo = database.get_link(url)
            if owo == "Not Found":
                uwu = database.make_new_link(name, url)
                if uwu == "Done!":
                    return redirect("/success")
                else:
                    return redirect('/success?error=error')
            else:
                return redirect('/success?error=taken')
        else:
            return redirect("/success?error=notdiscord")
    else:
        return render_template('register.html')
Esempio n. 2
0
def lock_delete(update, context):
    global lock

    if lock == 1:
        user_id = update.message.from_user.id
        chat_id = str(update.effective_chat.id)
        #status = context.bot.get_chat_member(chat_id, user_id)['status']

        status = get_link(chat_id=chat_id[1:], user_id=user_id, status=1)
        try:
            status = status[0][1]
        except:
            return 1

        if status == "member" or status == "restricted":
            update.message.delete()
        else:
            return 1
    else:
        return 0
Esempio n. 3
0
def set_(update, context):
    res = update.message.text.split(None, 2)
    if res[0] == "/bio":
        pass
    else:
        m = extract.sudocheck(update, context)
        if m == 2:
            return
        elif m == 1:
            n = extract.sudocheck(update, context, 0)
            if n == 0:
                update.message.reply_text("He got his own title boii !")
                return

    chat_id = chat_idd = ""
    try:
        chat_id = str(update.effective_chat.id)
        chat_idd = chat_id[1:]
        #user_id = update.effective_chat.username
        msg = update.message.reply_to_message
        user_id = msg.from_user.id
    except:
        return

    if res[0] == "/bio" or res[0] == "/about":
        k = get_link(chat_id=chat_idd, user_id=user_id, bio=1)
        name = msg.from_user.first_name
        d = ""

        try:
            txt = ("<b>Bio</b> - " + "<a href='tg://user?id=" + str(user_id) + "'>" + str(name) + "</a>" +
                   "\n\n<i>" + str(k[0][1]) + "</i>")

        except:
            txt = "<b>No Bio set</b> for " + "<a href='tg://user?id=" + \
                str(user_id) + "'>" + str(name) + "</a> !"

        update.message.reply_text(text=txt, parse_mode="HTML")
        return

    elif res[0] == "/setbio":
        cus_bio(update, context)
        return

    prev_message = update.message.reply_to_message

    if res[1] == "chatname" or res[1] == "name" or res[1] == "groupname" or res[1] == "grouptitle" or res[1] == "chattitle" or res[1] == "gname":
        try:
            context.bot.set_chat_title(chat_id=chat_id, title=res[2])
            text = "Chat name changed to '" + res[2] + "' !"
            update.message.reply_text(text)
        except:
            pass
    elif res[1] == "commands":

        context.bot.send_message(chat_id, text='Added Command !')
    elif res[1] == "des" or res[1] == "desc" or res[1] == "description":
        try:
            t = prev_message.tepxt
            context.bot.set_chat_description(chat_id, prev_message.text)
            context.bot.send_message(
                chat_id, text='Chat descirption updated !')
        except:
            if res[2] != None or res[2] != "":
                context.bot.set_chat_description(chat_id, res[2])
                context.bot.send_message(
                    chat_id, text='Chat descirption updated !')
            else:
                return

    elif res[1] == "nick" or res[1] == "title" or res[1] == "uname" or res[1] == "nickname" or res[1] == "admintitle" or res[1] == "status":
        try:
            msg = update.message.reply_to_message

            chat_id = update.effective_chat.id
            user_id = msg.from_user.id

            update.effective_chat.set_administrator_custom_title(
                user_id=user_id, custom_title=res[2])
            user_name = msg.from_user.username
            text = '"' + res[2]+'" set as the custom title for @' + user_name
            update.message.reply_text(text)
        except:
            pass
Esempio n. 4
0
def notfunny(linklol):
    k = database.get_link(linklol)
    if k == "Not Found":
        return render_template('notfound.html')
    else:
        return redirect(k)