예제 #1
0
def pull(user_id, bot, num):
    user = dm.search_user(user_id)
    req_coins = coins_per * num
    if (user[2] < req_coins):
        return (
            '{{ping}} Terribly sorry, {{petname}}... You need **{{req}} Blue Coins <:bluecoin:711090808148721694>** in order to make a pull, while you only have **{have} Blue Coins <:bluecoin:711090808148721694>**. If you have not yet already, trying using `p!daily` for some coins!'
            .format(req=str(req_coins), have=str(user[2])))
    else:
        new_coins = user[2] - req_coins
        dm.update_value(user[0], 'coins', new_coins)
        returnage = '{{ping}} Congratulations, {{petname}}! Here are the results of your {pull_num}-pull! \n'.format(
            pull_num=num)
        for x in range(num):
            pulled_emote = choose_emote()
            if (pulled_emote[3] == 6):
                dm.update_value(user_id, 'num_spotlights', user[4] + 1)
            if (um.check_for_emote(user_id, pulled_emote[1])):
                um.lvl_up_emote(user_id, pulled_emote[1])
                returnage += '• **{emote_name}** {emote} [Rarity: **{rarity}**] [**Level {level}**]\n'.format(
                    emote_name=pulled_emote[2],
                    emote=str(em.id_to_emote(pulled_emote[1], bot)),
                    rarity=em.get_emote_rar(pulled_emote[3]),
                    level=str(dm.find_one_emote(user_id, pulled_emote[1])[1]))
            else:
                um.add_users_pull(user_id, pulled_emote[1])
                returnage += '• **{emote_name}** {emote} [Rarity: **{rarity}**] [**NEW**]\n'.format(
                    emote_name=pulled_emote[2],
                    emote=str(em.id_to_emote(pulled_emote[1], bot)),
                    rarity=em.get_emote_rar(pulled_emote[3]))
        returnage += 'This pull cost {req} Blue Coins <:bluecoin:711090808148721694>, so now you have **{new} Blue Coins <:bluecoin:711090808148721694>**!'.format(
            req=str(req_coins), new=str(new_coins))
        return (returnage)
예제 #2
0
def nickname_set(message, author):  #sets the author's nickname
    user_data = dm.search_user(author.id)
    nickname = limit_cont(message, nickname_limit)
    if nickname.strip() != '':
        if check_badwords(nickname.lower()):
            return ('WHAT? I cannot call you that, {}!'.format(
                compile_name(author.id)))
        else:
            dm.update_value(user_data[0], 'petname', nickname)
            return ('Alright! I got your nickname now, {}!'.format(nickname))
    else:
        dm.update_value(user_data[0], 'petname', '')
        return ("Alrighty, {}! I reset your petname.".format(
            compile_name(author.id)))


#def nickname_toggle(author): #toggles whether poochy bot will refer to the author by their nickname
#    user_data = user_data = dm.search_user(author.id)
#    if user_data[1] != '' or user_data[1] is None:
#        if user_data[2] == True:
#            dm.update_value(user_data[0],'referby',0)
#            return ('Alright, ' + compile_name(author.id) + ". I've turned your nickname off.")
#        else:
#            dm.update_value(user_data[0],'referby',1)
#            return ('Got it, ' + user_data[1] + '! Nickname back on!')
#    else:
#        return ('Wait, ' + calling_name + "! You don't even have a nickname!")
예제 #3
0
def add_coins(user_data,ctx,member,amount):
    multi = 1
    role = discord.utils.find(lambda r: r.name == 'Superstar', ctx.guild.roles)
    if role in member.roles:
        multi = 2
    else:
        multi = 1
    added_coins = amount * multi
    new_coins = int(user_data[2]) + added_coins
    if new_coins < 0:
        new_coins = 0
    dm.update_value(str(user_data[0]),'coins',int(new_coins))
    return added_coins, new_coins
예제 #4
0
def attach_emote(
        name, author,
        bot):  #Attaches the emote with the corresponding name to their profile
    emote_data = dm.search_emotes('emote_name', name)
    if (emote_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!'
        )
    if (check_for_emote(author.id, emote_data[0])):
        dm.update_value(author.id, 'att_emote', emote_data[0])
        return (
            '{{ping}} Alright {{petname}}! You now are wearing the prestigious **{em_name}** {em}! Wear it with pride!'
            .format(em_name=name, em=em.id_to_emote(emote_data[0], bot)))
    else:
        return (
            '{ping} Wait a second... seems like you have yet to pull that emote, {petname}... You can only attach emotes you have collected! You can find which you have using the p!myemotes command!'
        )
예제 #5
0
def detach_emote(author, bot):
    dm.update_value(author.id, 'att_emote', '')
    return ('{ping} Alright, {petname}! I have removed the attached emote.')