예제 #1
0
def emote_package(
        ctx, given_emote, users
):  #takes the list of users and gives each of them the given_emote
    num_thru = 0
    em_data = dm.search_emotes('emote_id', str(given_emote.id))
    if (em_data[0] != ''):
        return (
            '{ping} Oh dear... it appears that no such emote exists, {petname}... Be sure you got the correct emote name! You can find which you have using the p!myemotes command!'
        )
    else:
        for user in users:
            if dm.search_user(user.id)[0] == '':
                dm.add_user(user.id)
            user_data = dm.search_user(user.id)
            try:
                if (check_for_emote(user.id, given_emote.id)):
                    lvl_up_emote(user.id, given_emote.id)
                else:
                    add_users_pull(user.id, given_emote.id)
                num_thru += 1
            except:
                return (
                    'Welp! I was only about to get through the first {num} users on that list... Sorry about that... Make sure the formatting is all correct!'
                    .format(num=num_thru))
        return ('Allllrightly! I gave **{em_name}** {em} to {num} account(s))!'
                .format(em_name=em_data[1], em=str(given_emote), num=num_thru))
예제 #2
0
async def base_setup(ctx):
    if (dm.search_user(ctx.author.id)[0] == ''):
        dm.add_user(ctx.author.id)
    global calling_name, start_ping
    start_ping = '[' + nm.compile_name(
        ctx.author.id) + ']'  #ping at the start of each message to alert users
    calling_name = nm.set_calling_name(ctx.author,
                                       bot)  #customizable name used
    return (ctx.author != bot.user)
예제 #3
0
def register_page_post():
    new_user_obj = request.form.to_dict()
    hashed_password = util_password.generate_hash_password(
        request.form.get("password"))
    new_user_obj['password'] = hashed_password
    if database_manager.add_user(new_user_obj) is False:
        flash('Username already exists, please choose another one!')
        return redirect(url_for("register_page"))

    database_manager.add_user(new_user_obj)
    flash("Successful registration. Log in to continue.")
    return redirect(url_for('login_page'))
예제 #4
0
def taxation(ctx,given_coins,users): #takes the list of users and deposits 'coins' about of coins into their account
    num_thru = 0
    for user in users:
        if dm.search_user(user.id)[0] == '':
            dm.add_user(user.id)
        user_data = dm.search_user(user.id)
        try:
            coins, new_coins = add_coins(user_data,ctx,user,given_coins * -1)
            num_thru += 1
        except:
            return ('Welp! I was only about to get through the first {num} users on that list... Sorry about that... Make sure the formatting is all correct!'.format(num = num_thru))
    return ('Removed **{coin_num} Blue Coins <:bluecoin:711090808148721694>** from {num} account(s) (**{coin_num2}** to Superstars). Be more careful with your coin-adding next time!'.format(coin_num = given_coins, num = num_thru, coin_num2 = given_coins * 2))
예제 #5
0
def coin_package(ctx,given_coins,users): #takes the list of users and deposits 'given_coins' coins into their account
    num_thru = 0
    for user in users:
        if dm.search_user(user.id)[0] == '':
            dm.add_user(user.id)
        user_data = dm.search_user(user.id)
        try:
            coins, new_coins = add_coins(user_data,ctx,user,given_coins)
            num_thru += 1
        except:
            return ('Welp! I was only about to get through the first {num} users on that list... Sorry about that... Make sure the formatting is all correct!'.format(num = num_thru))
    return ('Allllrightly! I added **{coin_num} Blue Coins <:bluecoin:711090808148721694>** to {num} account(s) (**{coin_num2}** to Superstars)!'.format(coin_num = given_coins, num = num_thru, coin_num2 = given_coins * 2))
예제 #6
0
파일: server.py 프로젝트: derdesz/ask-mate
def registration():
    if request.method == "POST":
        user_id = database_manager.get_max_user_id() + 1
        username = request.form['username']
        password = password_hash.hash_password(request.form['password'])
        time_stample = time.time()
        registration_date = datetime.fromtimestamp(time_stample)
        database_manager.add_user(user_id, username, password,
                                  registration_date, 0)

        return redirect(url_for('hello'))
    else:
        return render_template('registration.html')
예제 #7
0
파일: app.py 프로젝트: szandala/SO2
def add():
    # print(request.form, flush=True)
    if request.method == "GET":
        return """
        <form method="POST">
            <input name="username"/>
            <button type="submit">Zapisz</button>
        </form>
        """

    if request.method == "POST":
        dm.add_user(request.form.get("username"))

        # print(form_data)
        # return render_template("data.html",form_data = form_data)
        return redirect(url_for("add"))