예제 #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 return_my_emotes(
        author, bot, page_num
):  #Returns an embed of 15 of the user's emotes they have pulled
    if (dm.num_emotes(author.id) < 15):
        page_num = 1
    emotes = dm.find_users_emotes(author.id, page_num)
    embed = discord.Embed(
        title="{name}'s Pulled Emotes [Level {lvl}]".format(
            name=nm.set_embed_calling_name(author, bot),
            lvl=str(dm.search_user(author.id)[4])),
        description=
        "A list of your emotes, including the level of each in parentheses (how many times you have pulled it).\n**PAGE {num}** (Use `p!profile [page #]` to see more emotes)"
        .format(num=page_num),
        color=discord.Color.from_rgb(69, 72, 255),
        type='rich')
    embed.set_thumbnail(url=str(author.avatar_url_as(size=64)))
    if (len(emotes) != 0):
        column_size = int(math.ceil(len(emotes) / 3.0))
        if column_size > 5:
            column_size = 5
        value_cont = ''
        for emote_num in range(1, len(emotes) + 1):
            emote = emotes[emote_num - 1]
            value_cont += str(em.id_to_emote(
                emote[1], bot)) + ' **' + dm.search_emotes(
                    'emote_id', emote[1])[1] + '** *(' + str(emote[2]) + ')*\n'
            if (emote_num % column_size == 0 and emote_num != 0
                ) or emote_num == len(emotes) or column_size == 1:
                embed.add_field(name='\u200b', value=value_cont, inline=True)
                value_cont = ''
    else:
        embed.add_field(name='You have yet to pull any emotes.',
                        value='Use `p!pull` to get your first!',
                        inline=True)
    return (embed)
예제 #3
0
def set_embed_calling_name(
    author, bot
):  #checks whether or not the message.author should be called by a nickname
    user_data = dm.search_user(author.id)
    name = ' '
    if (user_data[1] is not None and user_data[1] != ''):
        name += user_data[1]
    else:
        name += author.name
    if (user_data[3] is not None and user_data[3] != ''):
        name += ' ' + str(em.id_to_emote(user_data[3], bot))
    return name
예제 #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 show_banner(client):  #creates an embed with the current banner data
    banner_data = dm.get_banner()
    embed = discord.Embed(
        title='*' + banner_data[2] + '* Banner',
        description='Active until: **' + banner_data[3].strftime("%a") + ', ' +
        banner_data[3].strftime("%B") + ' ' + banner_data[3].strftime("%d") +
        '**',
        color=discord.Color.from_rgb(255, 20, 20),
        type='rich')
    embed.set_image(url=str(banner_data[1]))
    spotlights = dm.get_rare_emotes(6)
    emb_cont = ''
    for emote in spotlights:
        emb_cont += em.id_to_emote(emote[1],
                                   client) + ' **' + dm.search_emotes(
                                       'emote_id', emote[1])[1] + '**\n'
    embed.add_field(name='**SPOTLIGHT EMOTES (6% CHANCE TO OBTAIN!)**',
                    value=emb_cont,
                    inline=True)
    return (embed)
예제 #6
0
def trade_for_gold(user_id, emote_name, bot):
    copies = 0
    og_emote_data = dm.search_emotes('emote_name', emote_name)
    if (og_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 (og_emote_data[2] == 9):
        return (
            "{ping} Quit being so cheeky, {petname}! That emote is already gold! What do you want, a Double Gold emote?"
        )
    user_emote_data = dm.find_one_emote(user_id, og_emote_data[0])
    if (og_emote_data[2] == 1
        ):  #12 emotes for common, 6 for super, and 3 for ultra/spotlight
        copies = 12
    elif (og_emote_data[2] == 2 or og_emote_data[2] == 3):
        copies = 6
    else:
        copies = 3
    if (user_emote_data[1] < copies):
        return (
            '{{ping}} Welp... Sorry, {{petname}}, but you need at least {copies} copies of **{emote_name}** to goldify it!'
            .format(copies=copies, emote_name=emote_name))
    else:
        gold_data = dm.search_emotes('emote_name', emote_name + ' [G]')
        if (gold_data[0] == ''):
            return (
                "{ping} Whoops, {petname}, that emote hasn't gotten a GOLD variation yet. Ask <@220390422441230346> to add one!"
            )
        if (check_for_emote(user_id, gold_data[0])):
            lvl_up_emote(user_id, gold_data[0])
        else:
            add_users_pull(user_id, gold_data[0])
        dm.down_emote_lvl(user_id, og_emote_data[0],
                          copies - 1)  #Keep at least one copy ultimately
        return (
            '{{ping}} Allllllllllrighty, {{petname}}! I turned {copies} copies of your **{emote_name}** emote into one extra special GOLDEN **{emote_name}** {emote_itself}!!!'
            .format(copies=copies - 1,
                    emote_name=emote_name,
                    emote_itself=str(em.id_to_emote(gold_data[0], bot))))
예제 #7
0
def post_emote(name, author, start_ping,
               bot):  #posts an emote with the corresponding name
    emote_data = dm.search_emotes('emote_name', name)
    embed = None
    if (emote_data[0] == ''):
        return "{ping} I can't find any emote of the sort, sorry...".format(
            ping=start_ping), True
    embed = discord.Embed(title='{name} sent a...'.format(name=author.name),
                          color=discord.Color.from_rgb(255, 218, 0),
                          type='rich')
    if (check_for_emote(author.id, emote_data[0])):
        if (em.id_to_emote(emote_data[0], bot).animated):
            embed.set_image(
                url='https://cdn.discordapp.com/emojis/{id}.gif'.format(
                    id=emote_data[0]))
        else:
            embed.set_image(
                url='https://cdn.discordapp.com/emojis/{id}.png'.format(
                    id=emote_data[0]))
        return embed, False
    else:
        return "{ping} Hold up, you don't have that emote! Check which ones you have in #robotic-operating-buddy with `p!myemotes`.".format(
            ping=start_ping), True