Пример #1
0
    async def getlayout(self, index, *, final=False):
        i = ""
        g = ""
        for x in self.innocentlist:
            i += basics.useremoji(
                self.bot,
                utility.get_member_or_user(self.bot, self.messages[0].guild,
                                           x))
        for x in self.guiltylist:
            g += basics.useremoji(
                self.bot,
                utility.get_member_or_user(self.bot, self.messages[0].guild,
                                           x))

        return f"""{self.suer.mention} is attempting to sue {self.suee.mention}!
Пример #2
0
    async def getlayout(self, index, *, final=False):
        bot = self.bot
        m = self.context.message
        s = f"[<a:hippovortex:395505717374877696>]({self.foreignmessages[0].jump_url})"
        mfrom = await self.foreignmessages[0].channel.get_message(
            self.foreignmessages[0].id)
        reactdict = {}
        userlist = []
        for r in mfrom.reactions:
            e = await utility.hasemoji(bot, r.emoji)
            reactdict[e] = []
            async for u in r.users():
                ae = basics.useremoji(bot, u, guild=m.guild)
                reactdict[e].append(ae)
                userlist.append(ae)

        userlist = utility.nodups(userlist)
        s += "".join(userlist)
        for k, i in reactdict.items():
            s += f"\n{k}"
            for u in userlist:
                s += ["▪", "⭕"][u in i]

        return discord.Embed(
            type="rich",
            description=s + [
                "",
                "\nThis chart has timed out. You'll need to create another one."
            ][final])
Пример #3
0
async def replystring(context,string=None,channel=None, silent=False,user=None):
    import modules.basics as basics

    if user==None:
        user = context.message.author

    if (channel == None or channel.id == context.message.channel.id)\
            and user.id in context.bot.disablereplyping:
        silent=True

    tosay = basics.useremoji(context.bot,user)+" "
    if silent:
        tosay += basics.truename(context.bot,user)
    else:
        tosay += user.mention

    if string is not None and string.startswith("asked"):
        tosay += " "
    else:
        tosay += ": "

    if string is not None:
        tosay += string

    return tosay
Пример #4
0
    async def start(self):
        emojis = {}  # People to emojis

        peoplemedium = utility.getcoolpeople(self.bot,
                                             self.context.message.guild,
                                             priority="medium")
        random.shuffle(peoplemedium)
        for x in list(peoplemedium):
            if x.bot:
                peoplemedium.remove(x)
            elif basics.useremoji(self.bot, x, default="aes",
                                  actualemoji=True) in emojis.values():
                peoplemedium.remove(x)
            else:
                emojis[x.id] = basics.useremoji(self.bot,
                                                x,
                                                default="aes",
                                                actualemoji=True)

        peoplelow = utility.getcoolpeople(self.bot,
                                          self.context.message.guild,
                                          priority="low")
        random.shuffle(peoplelow)
        for x in list(peoplelow):
            if x.bot:
                peoplelow.remove(x)
            elif basics.useremoji(self.bot, x, default="aes",
                                  actualemoji=True) in emojis.values():
                peoplelow.remove(x)
            else:
                emojis[x.id] = basics.useremoji(self.bot,
                                                x,
                                                default="aes",
                                                actualemoji=True)

        self.people = [peoplelow[0], peoplemedium[0], peoplemedium[1]]
        random.shuffle(self.people)

        await OngoingReactionMenu.start(self)

        self.edict = {}  # Emoji IDs to people
        for x in self.people:
            asyncio.ensure_future(self.messages[0].add_reaction(emojis[x.id]))
            self.edict[emojis[x.id].id] = x
            self.adddict[emojis[x.id].id] = self.givetoken
        print(self.adddict.keys())
Пример #5
0
async def replyedit(context,message,string=None,embed=None,viaspoilerbot=False):
    import modules.basics as basics

    prefix=": "
    if string==None:
        return await edit(context,message,basics.useremoji(context.bot,context.message.author)+" "+context.message.author.mention+prefix,embed=embed)
    else:
        if string.startswith("asked"):
            prefix=" "
        return await edit(context,message,context.message.author.mention+prefix+string,embed=embed,viaspoilerbot=viaspoilerbot)
Пример #6
0
 async def specificroll(self):
     u = random.choice(
         utility.getcoolpeople(self.bot,
                               self.context.message.guild,
                               priority="medium"))
     self.rerolllist.append(
         basics.useremoji(self.bot, u, guild=self.context.message.guild))
     self.message = await talking.replystring(
         self.context,
         f"asked {basics.spitback(self.q)}, I respond: {ccc.repuser(self.bot, u)}"
     )
Пример #7
0
    async def getuser(self, context):
        """Mentions a mentioned user in an embed.

        This is intended for use in conjunction with a silent mention so that you don't need to find people in the member list. When somebody is mentioned in an embed, they aren't pinged, but the mention is still clickable."""
        if len(context.message.mentions) == 0:
            await talking.reply(
                context,
                "Please silently mention someone! Or mention them normally if you want to be super redundant."
            )
        else:
            embed = discord.Embed(
                description=basics.useremoji(self.bot,
                                             context.message.mentions[0],
                                             guild=context.message.guild) +
                context.message.mentions[0].mention)
            await talking.say(context, "", embed=embed, nowebhook=True)
Пример #8
0
    async def getlayout(self, index, *, final=False):
        ul = set()

        def getallusersandotherstuff(d, maxlevel, currentlevel):
            if maxlevel < currentlevel:
                maxlevel = currentlevel
            for i in d.values():
                print(i["subreactions"])
                ul.update(i["users"])
                maxlevel = getallusersandotherstuff(i["subreactions"],
                                                    maxlevel, currentlevel + 1)
                # for u in i["subreactions"]:
                #     getallusers(u)
            return maxlevel

        maxlevels = getallusersandotherstuff(self.reactions, 0, 0)
        s = f"[<a:hippovortex:395505717374877696>]({self.foreignmessages[0].jump_url}){'▪'*(maxlevels-1)}│"

        for u in ul:
            print(u)
            s += basics.useremoji(
                self.bot,
                utility.get_member_or_user(self.bot,
                                           self.bot.get_guild(self.guildid),
                                           u))

        def displayreactions(s, d, level, maxlevels):
            for k, i in d.items():
                s += f"\n{arrow_r*level}{k}{'▪'*(maxlevels-level-1)}│"
                print(i["users"])
                for u in ul:
                    s += "⭕" if u in i["users"] else "▪"
                s = displayreactions(s, i["subreactions"], level + 1,
                                     maxlevels)
            return s

        s = displayreactions(s, self.reactions, 0, maxlevels)
        embed = discord.Embed(type="rich",
                              description=f"ID: {self.id}\n{s}"[:2048])
        return embed
Пример #9
0
async def detailsaystring(context,string,*,disableaes=False):
    import modules.basics as basics

    # string=string.replace("O","OwO")
    # string=string.replace("o","OwO")
    
    #string=re.sub("<@!?[0-9]{18}>","<@113852329832218627>",string)
    
    #if context.command!=None and context.command.name!="drop" and (context.command.name=="8ball" and context.message.author.id=="113457314106740736")==False:
    #    string=string.replace(f"`{' '.join(contentq(context.message.content))}­`","^that").replace(f"`­{' '.join(contentq(context.message.content))}`","^that").replace(f"`{' '.join(contentq(context.message.content))}`","^that").replace(f"`­{' '.join(contentq(context.message.content))}­`","^that")#.replace("``^that``",f"```­{contentq(context.message.content)}```")
    
    string=string.replace("@everyone","@­everyone")
    #string=re.sub("<a?:([A-Za-z0-9_]{2,32}):[0-9]{18}>",detailsaystring_cleanemoji,string)
    
    # split=string.split(" ")
    # string=""
    # for x in split:
        # string+=x
        # if re.sub('[^a-z]*', '', x.lower()) in ["p**n","horny","sexy","did","asshole","butthole","hole","moist","do","dirty","f**k","piss","shit","dick","penis","v****a","pussy","touch","press","compress","hit","punch","whip","foot","feet","eat","stuff","vore","girl","boy","loli","kid","child","trample","tread","heavy","weight","fat","pull","ass","butt","rock","eat","lick","tongue","hair","hill","ball","balls","round"]:
            # string+="<a:hipposeductive:397622396401745932>"
        # string+=" "
    if context.message.guild!=None and not disableaes:
        for x in re.findall("<@!?[0-9]{18}>", string):
            id=x.replace("<","").replace(">","").replace("@","").replace("!","")
            dude = context.bot.get_user(int(id))
            if dude == None:
                dude = await context.bot.fetch_user(int(id))
            emoji = basics.useremoji(context.bot, dude, guild=context.message.guild)
            string=string.replace(emoji+x,x)
            string=string.replace(emoji+" "+x,x)
            string=string.replace(x,emoji+" "+x)
        """if context.bot.admin[context.message.server.id]["avataremojiserver"]!=None:
            for k in context.bot.admin[context.message.server.id]["avataremojiserver"][1].keys():
                m1=f"<@{k}>"
                m2=f"<@!{k}>"
                emoji = mf.emojiser(context.bot,context.bot.admin[context.message.server.id]["avataremojiserver"][1][k][0])
                string=string.replace(emoji+m1,m1)
                string=string.replace(emoji+" "+m1,m1)
                string=string.replace(emoji+m2,m2)
                string=string.replace(emoji+" "+m2,m2)
                string=string.replace(m1,emoji+" "+m1)
                string=string.replace(m2,emoji+" "+m2)"""
    for x in [
    ["112760669178241024","🌐"],
    ["288058913985789953","🎮"],
    ["249968792346558465","🎨"],
    ["122155380120748034","🖥"],
    ["160197704226439168","🤖"],
    ["134477188899536898","📺"],
    ["132423337019310081","🇯🇵"],
    ["331390333810376704","📌"],
    ["413152451345121280","⚔"],
    ["410596805445681162","🏰"],
    ["189898393705906177","⌨"],
    ["398661111869865985","😘"],
    ["265998010092093441","🎳"],
    ["312054608535224320","📽"],
    ["265617582126661642","🎼"],
    ["373335332436967424","🗣"],
    ["392141322863116319","😐"],
    ["191487489943404544","👅"],
    ["113414562417496064","🐦"],
    ["359903425074561024","💭"],
    ]:
        string=string.replace(f"<#{x[0]}>",f"{x[1]}<#{x[0]}>")
        
    #Re-Enable when custom hippos exist
    # userchids=[]
    # for u in context.bot.activecustomhippos.keys():
        # for slot in context.bot.activecustomhippos[u]:
            # if slot!=None:
                # for k,i in slot.items():
                    # userchids.append(i[0].id)
    # #Custom hippo
    # for k,i in context.bot.activecustomhippos[context.bot.me.id][0].items():
        # string=re.sub("(<a?:"+k+":[0-9]{18}(?<!("+"|".join(userchids)+"))>)",emojistr(context.bot,i[0]),string)
    
    return string#.replace(" ","👏")
Пример #10
0
    async def collect(self, payload):
        bot = self.bot
        context = self.context
        m = context.message
        u = m.guild.get_member(payload.user_id)
        tokeninfo = f"Spawn Message ID; {context.message.id}"
        if u.bot:
            return

        self.disrespectcount.setdefault(u.id, 0)
        if payload.emoji.is_unicode_emoji(
        ) or payload.emoji.id != 394587421687152640:
            self.disrespectcount[u.id] += 1
            return
        tokeninfo += f"\nDisrespect Count; {self.disrespectcount[u.id]}"
        self.disableinputs = True
        recentspeaker = False

        timestr = '%Y/%m/%d  %I:%M:%S %p'
        uh = datetime.utcnow() - timedelta(seconds=30)
        if m.created_at <= uh and m.author.id != u.id and not m.author.bot:
            recentspeaker = True
            tokeninfo += f"\nRecent Speaker Message ID; {m.id}\nRecent Speaker Message Timestamp; {m.created_at.strftime(timestr)}"
        else:
            async for msg in m.channel.history(limit=60,
                                               oldest_first=False,
                                               before=m):
                recentspeaker = False
                if msg.created_at <= uh:
                    break
                if msg.author.id != u.id and not msg.author.bot:
                    recentspeaker = True
                    tokeninfo += f"\nRecent Speaker Message ID; {m.id}\nRecent Speaker Message Timestamp; {m.created_at.strftime(timestr)}"
                    break
        tokeninfo += f"\nCollected At; {uh.strftime(timestr)}"

        self.bot.dripfeedmonth.setdefault(m.guild.id, "None")
        month = str(datetime.utcnow().strftime("%Y-%m"))
        try:
            dripfeed = self.bot.dripfeedmonth[
                m.guild.id] != month and not self.bot.ach_tracking[m.guild.id][
                    u.id][74][0]
        except:
            dripfeed = self.bot.dripfeedmonth[m.guild.id] != month
        if dripfeed:
            self.bot.dripfeedmonth[m.guild.id] = month
            basics.save(self.bot, "dripfeedmonth")

        tokens = ot.otedit(bot,
                           u,
                           1,
                           True,
                           channel=m.channel,
                           type="gold",
                           extras={
                               "disrespectcount": self.disrespectcount[u.id],
                               "recentspeaker": recentspeaker,
                               "delayed": self.delayed,
                               "dripfeed": dripfeed
                           })
        bot.preresiduecount.setdefault("gold", {})
        bot.preresiduecount["gold"].setdefault(u.id, 5)

        if bot.preresiduecount["gold"][u.id] > 0:
            bot.preresiduecount["gold"][u.id] -= 1
            await talking.say(
                context, "<:obamatoken:349037437827284992> " +
                await talking.replystring(
                    context,
                    "You got an Obama Token! You now have a total of {}. {}\n{} will be shown this message {} before it gets replaced with an Obama Residue."
                    .format(
                        tokens, aesthetic.hoveremoji(tokeninfo.replace(
                            ";", "")), basics.truename(bot, u),
                        ccc.pluralstr("more time",
                                      bot.preresiduecount["gold"][u.id])),
                    user=u))
            basics.save(bot, "preresiduecount")
        else:
            await utility.safelyclear(
                bot, context.message,
                [[utility.get_emoji(bot, "349037437827284992")]]
            )  # Prevents end() from removing the residue

            ObamaResidue(
                bot,
                validfor=timedelta(minutes=60),
                emoji=utility.get_emoji(bot, "653859091331940355"),
                otheremojis=[basics.useremoji(self.bot, u)] +
                utility.reactiontext(str(tokens)),
                info=
                f"{u.mention} got an Obama Token. They now have a total of {tokens}.\n>>> {tokeninfo.replace(';', ':').replace('  ',' ')}",
                context=context)

            await asyncio.sleep(1)  # Prevents end() from removing the residue

        asyncio.ensure_future(self.end())
Пример #11
0
    async def getlayout(self, index, *, final=False):
        width = self.width
        height = self.height
        title = self.title
        numberofachs = self.numberofachs
        grid = self.grid
        u = self.u
        context = self.context
        cursor = self.cursor
        achievements = self.getachievements()

        progress = [0, 0]  # 0/1
        s = ""
        n = 0
        added = 0
        secretsearned = 0
        for y in range(height):
            x = 0
            # for x in range(width+1):
            while x <= width and added <= numberofachs:
                # Secret?
                try:
                    secret = achievements[grid[x][y]]["secret"]
                except:
                    secret = False
                # Progress
                try:
                    server = "global" if achievements[
                        grid[x][y]]["global"] else context.message.guild.id
                    if False not in self.bot.ach_tracking[server][u.id][grid[x]
                                                                        [y]]:
                        if secret:
                            secretsearned += 1
                        else:
                            progress[0] += 1
                    if secret == False:
                        progress[1] += 1
                except:
                    pass
                # Skip when past what's needed
                if n > numberofachs:
                    x += 1
                    continue

                # Figure out what to highlight
                try:
                    server = "global" if achievements[
                        grid[x][y]]["global"] else context.message.guild.id
                except:
                    pass
                try:
                    serverm1 = "global" if achievements[grid[
                        x - 1][y]]["global"] else context.message.guild.id
                except:
                    pass

                left = True
                right = True
                # This stuff is from the edges
                if x == 0:
                    left = False
                if x == width:
                    right = False
                if n == numberofachs:
                    right = False
                # This stuff is for earned
                try:
                    if left == True:
                        if False in self.bot.ach_tracking[serverm1][u.id][grid[
                                x - 1][y]]:
                            left = False
                    if right == True:
                        if False in self.bot.ach_tracking[server][u.id][grid[x]
                                                                        [y]]:
                            right = False
                except:
                    pass
                # Set arrow thing
                arrowtype = 0  # No arrow
                if cursor == [x, y]:
                    arrowtype = 1  # Left
                if cursor == [x - 1, y]:
                    arrowtype = 2  # Right
                # Add highlight emojis
                if [left, right] == [True, True]:
                    s += [
                        "<a:__:406627625109422080>",
                        "<a:__:406627723621171200>",
                        "<a:__:406628574041473026>"
                    ][arrowtype]
                if [left, right] == [False, True]:
                    s += [
                        "<a:__:406629250825715723>",
                        "<a:__:406629695938101278>",
                        "<a:__:406631834043285514>"
                    ][arrowtype]
                if [left, right] == [True, False]:
                    s += [
                        "<a:__:406633397868298240>",
                        "<a:__:406633398069624832>",
                        "<a:__:406633397960835083>"
                    ][arrowtype]
                if [left, right] == [False, False]:
                    s += [
                        "<:__:406626779965685762>", "<:__:406627050959536129>",
                        "<:__:406627335471759371>"
                    ][arrowtype]
                # Add the achivement emoji, it'll fail if there isn't one
                try:
                    s += achievements[grid[x][y]]["icon"]
                    added += 1
                except:
                    pass
                n += 1
                x += 1
            s += "\n"
            n -= 1

        # Secret?
        server = "global" if achievements[
            self.getgridpos()]["global"] else context.message.guild.id

        secret = achievements[self.getgridpos()]["secret"]
        if context.message.guild == None and False not in self.bot.ach_tracking[
                server][u.id][self.getgridpos()]:
            secret = False

        # Who else has?
        others = []
        for uk in context.message.guild.members:
            uk = uk.id
            #try:
            if uk in self.bot.ach_tracking[server]:
                if self.getgridpos() in self.bot.ach_tracking[server][uk]:
                    m = context.message.guild.get_member(uk)
                    if False not in self.bot.ach_tracking[server][uk][
                            self.getgridpos()] and m != None:
                        others.append(
                            basics.useremoji(self.bot, m, default="aes"))
            #except:
            #pass

        # Make embed
        embed = discord.Embed(
            title=title
        )  # (round(fill)*"█")+(round(50-fill)*" ")+"­`­   {}%".format(round(fill/50*100),2)
        # description="{}/{} Achievements Earned.\n{}  {}%".format(progress[0],progress[1], "`­"+str(math.floor(progress[0]/progress[1]*50)*"█")+str((50-math.floor(progress[0]/progress[1]*50))*" ")+"­`" ,math.floor(progress[0]/progress[1]*100))

        pos = self.getgridpos()
        s3 = ""
        for n, x in enumerate(self.bot.ach_tracking[server][u.id][pos]):
            if x:
                s3 += ccc.bar(self.bot, 1, 1, kind="circle")
            else:

                history = "fuckyou"
                if server in self.bot.ach_tracking_history:
                    if u.id in self.bot.ach_tracking_history[server]:
                        if pos in self.bot.ach_tracking_history[server][u.id]:
                            history = self.bot.ach_tracking_history[server][
                                u.id][pos]

                self.bot.ach_tracking_count_hidden.setdefault(server, {})
                if len(achievements[pos]["check"][n]) == 3 and type(
                        achievements[pos]["check"][n][2]) == str:
                    try:
                        s3 += ccc.bar(self.bot,
                                      1,
                                      eval(achievements[pos]["check"][n][2]),
                                      kind="circle")
                    except:
                        s3 += ccc.bar(self.bot, 1, 0, kind="circle")
                elif achievements[self.getgridpos()][
                    "secret"] and u.id in self.bot.ach_tracking_count_hidden[server] and (pos, n) in \
                        self.bot.ach_tracking_count_hidden[server][
                            u.id].keys():  # Checks if secret, can't use secret variable because it'll reveal in DMs
                    s3 += ccc.bar(
                        self.bot,
                        1,
                        self.bot.ach_tracking_count_hidden[server][u.id][(pos,
                                                                          n)] /
                        achievements[pos]["check"][n][2],
                        kind="circle")
                elif achievements[self.getgridpos()][
                    "secret"] == False and u.id in self.bot.ach_tracking_count[server] and (pos, n) in \
                        self.bot.ach_tracking_count[server][u.id]:
                    s3 += ccc.bar(
                        self.bot,
                        1,
                        self.bot.ach_tracking_count[server][u.id][(pos, n)] /
                        achievements[pos]["check"][n][2],
                        kind="circle")
                else:
                    s3 += ccc.bar(self.bot, 1, 0, kind="circle")

        s2 = ""
        index = achievements[self.getgridpos()]
        user = u
        for x in index["reward"]:
            if x[0] == "clothing":
                s2 += "\n{}".format(
                    x[1])  #""\n{}".format(self.bot.chinfo[x[1]][2])
            if x[0] == "ot":
                s2 += "\n{} Obama Tokens".format(x[1])
            if x[0] == "en":
                s2 += "\nEvernick Character Discount"
        if s2 != "":
            s2 = "\n\nRewards:" + s2

        add = ""
        for n, x in enumerate(s.split("\n")[:-1]):
            add += x + "\n"
            if add.count("\n") == 1:
                embed.add_field(name="­", value=add, inline=False)
                add = ""
        if add != "":
            embed.add_field(name="­", value=add, inline=False)
        # embed.add_field(name="­", value=s, inline=False)

        propertiesstr = ""
        if index["global"]:
            propertiesstr += " " + aesthetic.hoveremoji("GLOBAL")
        if propertiesstr != "":
            propertiesstr = "       " + propertiesstr

        if secret:
            embed.add_field(name="{} __**{}**__".format(index["icon"], "???") +
                            propertiesstr,
                            value="???" + "\n\n" + "Progress:\n" + s3 + s2 +
                            "\n­",
                            inline=False)
        else:
            embed.add_field(
                name="{} __**{}**__".format(index["icon"], index["name"]) +
                propertiesstr,
                value=index["desc"] + "\n\n" + "Progress:\n" + s3 + s2 + "\n­",
                inline=False)

        # Progress

        # How many people have
        havestr = "{} people have this achievement.".format(len(others))
        if havestr == "1 people have this achievement.":
            havestr = "1 person has this achievement."
        if havestr == "0 people have this achievement.":
            havestr = "Nobody has this achievement."
        embed.add_field(name=havestr,
                        value="".join(others) + "­",
                        inline=False)
        if secretsearned == 0:
            secretstr = ""
        else:
            secretstr = f" (+{secretsearned})"  # "`­"+str(math.floor((progress[0]+secretsearned)/progress[1]*50)*"█")+str((50-math.floor((progress[0]+secretsearned)/progress[1]*50))*" ­")+"`"
        embed.add_field(
            name=" " * 15 + "­" + "You've earned {}/{}{} achievements.".format(
                progress[0], progress[1], secretstr),
            value="{}  {}%".format(
                ccc.bar(self.bot, 16,
                        (progress[0] + secretsearned) / progress[1]),
                math.floor((progress[0] + secretsearned) / progress[1] * 100)),
            inline=False)

        return embed
Пример #12
0
    async def kothnew(self, context):
        """Makes you king. Or whatever.

        The king of the hill will get an automatic crown reaction to their messages. You can also become the queen/loli/furry/cheese, based on what alias you use. Or whatever you type after the command. Use [bot] to make the bot take it. After that, you can put an emoji in brackets to get any emoji.
        You get an increasingly sexy secondary reaction as you hit 15 minutes, two hours, six hours, and 24 hours uninterupted.
        You can view the top 10 with [top], [high], or [score]. You can use [long] to view the top 500. You can view everyone's best scores with [best], [one], or [records].
        See who's currently king and for how long with [time].
        When taking the hill, whoever is already on it gets 5 seconds to say something and defend their title. If you try to take it from somebody you didn't want to take it from, if you say . before they defend, it gets canceled.
        The command has a starting cooldown of 15 seconds. When the hill is defended successfully, and the attacker isn't the king, that cooldown is increased by half a second for the next 10 minutes.
        Scores earned after koth's death have a skull next to them. You can hide all the death scores with [legacy]."""
        bot = self.bot
        m = context.message

        q = basics.contentq(context.message.content)
        q, specialemoji = basics.subcommands(context, q, ["EMOJI"])

        words = " ".join(q)
        legacy = "[legacy]" in words
        if "[bs]" in words and context.message.author.id == self.bot.rnl.id:
            self.bot.koth = copy.deepcopy(self.bot.kothlast)
            basics.save(bot,"koth")
            await talking.reply(context, "Cool.")
            return

        if "[time]" in words:
            secs = (datetime.utcnow() - self.bot.koth[4]).seconds + (
                        (datetime.utcnow() - self.bot.koth[4]).days * 24 * 60 * 60)
            mins = 0
            hours = 0
            while secs >= 60:
                mins += 1
                secs -= 60
            while mins >= 60:
                hours += 1
                mins -= 60
            await talking.reply(context,
                           "{} has been {} for the last {}, {}, and {}. If the hill was lost now, it would be worth {} pixels.".format(
                               self.bot.koth[1],
                               self.bot.koth[2],
                               ccc.pluralstr("hour", hours),
                               ccc.pluralstr("minute", mins),
                               ccc.pluralstr("second", secs),
                               koth.pixelcalc(self.bot.koth[4], datetime.utcnow()))
                           )
            return
        if "[top]" in words or "[high]" in words or "[score]" in words:
            embed = discord.Embed(title="King of the Hill Highscores", type="rich")
            high = self.bot.kothhigh[::-1][:10]
            numbers = "<:bn_1:327896448232325130> <:bn_2:327896448505217037> <:bn_3:327896452363976704> <:bn_4:327896452464508929> <:bn_5:327896454733627403> <:bn_6:327896456369274880> <:bn_7:327896458067968002> <:bn_8:327896459070537728> <:bn_9:327896459292704769> <:bn_10:327896459477385226>".split(
                " ")

            s = ""
            for x in range(0, len(high)):
                if legacy and high[x][4]:
                    continue
                u = self.bot.epicord.get_member(high[x][0])
                limit = 23
                if len(u.display_name) > limit:
                    name = u.display_name[:limit - 3] + "..."
                else:
                    name = "<@!" + high[x][0] + ">"
                if x <= 9:
                    s += numbers[x] + basics.useremoji(self.bot, high[x][0]) + name + "\n"
                else:
                    s += "`" + str(x + 1) + "`" + basics.useremoji(self.bot, high[x][0]) + name + "\n"
            embed.add_field(name="# User", value=s, inline=True)

            s = ""
            for x in high:
                if legacy and x[4]:
                    continue
                if x[2] == None:
                    emoji = "👑"
                elif len(x[2]) == 1:
                    emoji = x[2]
                else:
                    emoji = "<" + x[2] + ">"
                name = x[1]
                limit = 15
                if len(name) > limit:
                    name = name[:limit - 3] + "..."
                s += emoji + name + "\n"
            embed.add_field(name="Title", value=s, inline=True)

            s = ""
            for x in high:
                if legacy and x[4]:
                    continue
                seconds = x[3]
                emoji = "<:bl:230481089251115018>"
                if seconds > (60 * 60) * 24:
                    emoji = "<:tier4:348277627598929922>"
                elif seconds > (60 * 60) * 6:
                    emoji = "<:tier3:348279546765901826>"
                elif seconds > (60 * 60) * 2:
                    emoji = "<:tier2:348276583741521921>"
                elif seconds > 60 * 15:
                    emoji = "<:tier1:348266722526101505>"
                if x[4]:
                    emoji = "💀"
                minutes = 0
                while seconds >= 60:
                    seconds -= 60
                    minutes += 1
                hours = 0
                while minutes >= 60:
                    minutes -= 60
                    hours += 1
                minutes += round(seconds / 60, 2)
                s += emoji + str(hours) + " hours, " + str(minutes) + " min.\n"
            embed.add_field(name="Time", value=s, inline=True)

            s = "You don't have a score on this list."
            high = self.bot.kothhigh
            for x in range(0, len(high)):
                if high[x][0] == context.message.author.id:
                    s = "Your highest placement is {} out of {}.".format(len(high) - x, len(high))
            embed.set_footer(text=s)

            await mf.say(context, embed=embed)
            return
        # WOAH MAMA
        if "[long]" in words:
            numbers = "<:bn_1:327896448232325130> <:bn_2:327896448505217037> <:bn_3:327896452363976704> <:bn_4:327896452464508929> <:bn_5:327896454733627403> <:bn_6:327896456369274880> <:bn_7:327896458067968002> <:bn_8:327896459070537728> <:bn_9:327896459292704769> <:bn_10:327896459477385226>".split(
                " ")
            msg = await talking.say(context, "­")
            for n in numbers + [":bn_up:328724374540779522", ":bn_do:328724374498836500"]:
                asyncio.ensure_future(self.bot.add_reaction(msg, n.replace("<", "").replace(">", "")))
            page = 0
            while True:
                embed = discord.Embed(title="Extended King of the Hill Highscores (Page {})".format(page + 1),
                                      type="rich")
                place = 0
                names = ["# User", "Title", "Time"]
                for place in range(0 + (page * 5), 5 + (page * 5)):
                    # print("uh")
                    high = self.bot.kothhigh[::-1][(place * 10):10 + (place * 10)]
                    s = ""
                    for x in range(0, len(high)):
                        if legacy and high[x][4]:
                            continue
                        u = context.message.guild.get_member(high[x][0])
                        if u == None:
                            u = self.bot.epicord.get_member(high[x][0])
                        limit = 16
                        if len(u.display_name) > limit:
                            name = u.display_name[:limit - 3] + "…"
                        else:
                            name = "<@!" + high[x][0] + ">"
                        if x + (place * 10) <= 9:
                            s += numbers[x] + basics.useremoji(self.bot, high[x][0]) + name + "\n"
                        else:
                            s += "`" + str(x + 1 + (place * 10)) + ")`" + basics.useremoji(self.bot,
                                                                                       high[x][0]) + name + "\n"
                    embed.add_field(name=names[0], value=s, inline=True)

                    s = ""
                    for x in high:
                        if legacy and x[4]:
                            continue
                        if x[2] == None:
                            emoji = "👑"
                        elif len(x[2]) <= 10:
                            emoji = x[2]
                        else:
                            if utility.get_emoji(self.bot, x[2]) != None:
                                emoji = "<" + x[2] + ">"
                            else:
                                emoji = str(utility.get_emoji(self.bot, x[2].split(":")[1]))
                        name = x[1]
                        limit = 15
                        if len(name) > limit:
                            name = name[:limit - 3] + "…"
                        s += emoji + name + "\n"
                    embed.add_field(name=names[1], value=s, inline=True)

                    s = ""
                    for x in high:
                        if legacy and x[4]:
                            continue
                        seconds = x[3]
                        emoji = "<:bl:230481089251115018>"
                        if seconds > (60 * 60) * 24:
                            emoji = "<:tier4:348277627598929922>"
                        elif seconds > (60 * 60) * 6:
                            emoji = "<:tier3:348279546765901826>"
                        elif seconds > (60 * 60) * 2:
                            emoji = "<:tier2:348276583741521921>"
                        elif seconds > 60 * 15:
                            emoji = "<:tier1:348266722526101505>"
                        if x[4]:
                            emoji = "💀"
                        minutes = 0
                        while seconds >= 60:
                            seconds -= 60
                            minutes += 1
                        hours = 0
                        while minutes >= 60:
                            minutes -= 60
                            hours += 1
                        minutes += round(seconds / 60, 2)
                        s += emoji + str(hours) + "h, " + str(round(minutes, 2)) + "m\n"
                    embed.add_field(name=names[2], value=s, inline=True)

                    names = ["­", "­", "­"]

                s = "You don't have a score on this list."
                high = self.bot.kothhigh
                for x in range(0, len(high)):
                    if high[x][0] == context.message.author.id:
                        s = "Your highest placement is {} out of {}.".format(len(high) - x, len(high))
                embed.set_footer(text=s)

                msg = await talking.edit(context, msg, embed=embed)

                def tempcheck(reaction, user):
                    return user.id != self.bot.me.id

                rea = await self.bot.wait_for_reaction(self.bot.buttons, message=msg, check=tempcheck, timeout=120)
                if rea == None:
                    await self.bot.clear_reactions(msg)
                    break
                else:
                    await self.bot.remove_reaction(msg, rea[0].emoji, rea[1])
                    if rea[0].emoji.name == "bn_up":
                        page -= 1
                    elif rea[0].emoji.name == "bn_do":
                        page += 1
                    else:
                        page = int(rea[0].emoji.name.replace("bn_", "")) - 1
                    if page == -1:
                        page = 9
                    elif page == 10:
                        page = 0
            return
        # WOAH MAMA again
        if "[best]" in words or "[one]" in words or "[records]" in words:
            embed = discord.Embed(title="Top King of the Hill Scores For Each Player", type="rich")
            high = self.bot.kothhigh[::-1]
            numbers = "<:bn_1:327896448232325130> <:bn_2:327896448505217037> <:bn_3:327896452363976704> <:bn_4:327896452464508929> <:bn_5:327896454733627403> <:bn_6:327896456369274880> <:bn_7:327896458067968002> <:bn_8:327896459070537728> <:bn_9:327896459292704769> <:bn_10:327896459477385226>".split(
                " ")
            playersshown = []

            s = ""
            s2 = ""
            s3 = ""
            for x in range(0, len(high)):
                if legacy and high[x][4]:
                    continue
                if high[x][0] not in playersshown:
                    playersshown.append(high[x][0])
                    u = context.message.server.get_member(high[x][0])
                    if u == None:
                        u = self.bot.epicord.get_member(high[x][0])
                    limit = 16
                    name = "<@!" + high[x][0] + ">"
                    if u != None:
                        if len(u.display_name) > limit:
                            name = u.display_name[:limit - 3] + "…"
                        else:
                            name = "<@!" + high[x][0] + ">"
                    if x <= 9:
                        s += numbers[x] + basics.useremoji(self.bot, high[x][0]) + name + "\n"
                    else:
                        s += "`" + str(x + 1) + "`" + basics.useremoji(self.bot, high[x][0]) + name + "\n"

                    if high[x][2] == None:
                        emoji = "👑"
                    elif len(high[x][2]) == 1:
                        emoji = high[x][2]
                    else:
                        emoji = str(utility.get_emoji(self.bot, high[x][2].split(":")[1]))
                    name = high[x][1]
                    limit = 15
                    if len(name) > limit:
                        name = name[:limit - 3] + "…"
                    s2 += emoji + name + "\n"

                    seconds = high[x][3]
                    emoji = "<:bl:230481089251115018>"
                    if seconds > (60 * 60) * 24:
                        emoji = "<:tier4:348277627598929922>"
                    elif seconds > (60 * 60) * 6:
                        emoji = "<:tier3:348279546765901826>"
                    elif seconds > (60 * 60) * 2:
                        emoji = "<:tier2:348276583741521921>"
                    elif seconds > 60 * 15:
                        emoji = "<:tier1:348266722526101505>"
                    if high[x][4]:
                        emoji = "💀"
                    minutes = 0
                    while seconds >= 60:
                        seconds -= 60
                        minutes += 1
                    hours = 0
                    while minutes >= 60:
                        minutes -= 60
                        hours += 1
                    minutes += round(seconds / 60, 2)
                    s3 += emoji + str(hours) + " hours, " + str(minutes) + " min.\n"
            embed.add_field(name="# User", value=s[:1024], inline=True)
            embed.add_field(name="Title", value=s2[:1024], inline=True)
            embed.add_field(name="Time", value=s3[:1024], inline=True)

            s = "You don't have a score on this list."
            high = self.bot.kothhigh
            for x in range(0, len(high)):
                if high[x][0] == context.message.author.id:
                    s = "Your highest placement is {} out of {}.".format(len(high) - x, len(high))
            embed.set_footer(text=s)

            await talking.say(context, embed=embed)
            return

        if context.message.channel.id != "160197704226439168" and context.message.guild.id != self.bot.testserver.id:
            await talking.reply(context, "This only works in the bot channel.")
            return

        if context.message.author.bot:
            await talking.reply(context,
                           "Non-RSRB bots can't become king, because multiple people would be able to defend the hill.")
            return

        seconds = (datetime.utcnow() - self.bot.kothcooldown).seconds
        if m.guild.id not in self.bot.kothcooldowndict.keys():
            self.bot.kothcooldowndict[m.guild.id] = 15
        if seconds < self.bot.kothcooldowndict[m.guild.id]:
            if m.guild.id not in self.bot.kothcooldownnotovertolddict.keys():
                self.bot.kothcooldownnotovertolddict[m.guild.id] = []
            if m.author.id not in self.bot.kothcooldownnotovertolddict[m.guild.id]:
                await talking.reply(context, "Please wait, the cooldown's not over yet.")
                self.bot.kothcooldownnotovertolddict[m.guild.id].append(m.author.id)
            else:
                await self.bot.delete_message(m)
            return
        self.bot.kothcooldownnotovertolddict[m.guild.id] = []

        bot = False
        if words.startswith("[bot]"):
            bot = True
            words = words[5:]

        specialemoji = None
        if words.startswith("[") and words.count("]") != 0:
            words = words.split("]")
            specialemoji = words[0][1:].replace("<", "").replace(">", "").strip()
            errorspecialemoji = str(specialemoji)
            words = "]".join(words[1:])
            msg = await self.bot.send_message(self.bot.testserver.get_channel("329187094620667906"), "hi")
            try:
                await self.bot.add_reaction(msg, specialemoji)
            except:
                specialemoji = str(utility.get_emoji(self.bot, specialemoji)).replace("<", "").replace(">", "")
                try:
                    await self.bot.add_reaction(msg, specialemoji)
                except:
                    await talking.reply(context, "`{}` is not a valid emoji!".format(errorspecialemoji))
                    return
        if specialemoji != None:
            if "hippofrumplequest" in specialemoji:
                await talking.reply(context, "no")
                return
            if "obama" in specialemoji:
                await talking.reply(context, "no")
                return

        self.bot.kothcooldown = datetime.utcnow()

        if seconds < 15:
            await talking.reply(context, "Please wait, the cooldown's not over yet.")
            return

        seconds = (datetime.utcnow() - self.bot.kothcooldown).seconds

        u = self.bot.epicord.get_member(self.bot.koth[0])
        timestampmsg = await talking.say(context,
                                    u.mention + ": Quick! Fight off {} by saying something!\n{}: Say . if this was a mistake.".format(
                                        ccc.shownames(context.message.author), context.message.author.mention))
        statement = "doesn't defend the hill."
        if u.id != self.bot.me.id:
            def tempcheck(m):
                return m.author == u or (m.author == context.message.author and m.content == ".")

            reply = await self.bot.wait_for_message(timeout=15, author=None, channel=context.message.channel,
                                                    content=None, check=tempcheck)
            if reply != None and reply.author == context.message.author:
                await talking.reply(context, "Heh. Nice going, mate.")
                return
            statement = ""
            if reply == None:
                statement = "never defended the hill."
                # await mf.say(context,u.mention+", nice work. The hill is yours... for now.".format(mf.shownames(context.message.author)))
                # return
            else:
                seconds = (reply.timestamp - timestampmsg.timestamp).seconds
                if seconds <= 5:
                    await talking.say(context, u.mention + ", nice work. You've defended the hill with {} to spare.".format(
                        ccc.pluralstr("second", round(5 - seconds, 2))))
                    if context.message.author != u:
                        asyncio.ensure_future(mf.kothincreasecooldown(self.bot, m.guild.id))
                    return
                else:
                    statement = "attempted to defend the hill, but was late by {}.".format(
                        ccc.pluralstr("second", round(seconds - 5, 2)))

        self.bot.kothlast = copy.deepcopy(self.bot.koth)
        self.bot.kothcooldowndict[m.guild.id] = 15

        if self.bot.koth == "":
            self.bot.koth = [context.message.author.id, ccc.shownames(context.message.author), "king"]
            basics.save(bot,"koth")
        elif context.message.author.id == "238459957811478529" or context.message.author.id == "208304366719860737":
            await talking.reply(context, "F**K OFF!!!")
        elif context.message.guild != self.bot.epicord and context.message.guild != self.bot.testserver:
            await talking.reply(context, "You can't overthrow the {} in secret.".format(self.bot.koth[2]))
        else:
            if context.message.content[2] == "k":
                type = "king"
            if context.message.content[2] == "q":
                type = "queen"
            if context.message.content[2] == "l":
                type = "loli"
            if context.message.content[2] == "f":
                type = "furry"
            if context.message.content[2] == "c":
                type = "cheese"
            # if context.message.content[2]=="h":
            #    type = "hippo"
            if len(words) > 0:
                type = words.strip()

            if specialemoji != None:
                if ":markedforpinning:" in specialemoji:
                    await talking.reply(context, "F**K OFF!!!")
                    return

            # Save highscore stuff
            seconds = (datetime.utcnow() - self.bot.koth[4]).seconds
            seconds += (datetime.utcnow() - self.bot.koth[4]).days * 24 * 60 * 60
            add = [self.bot.koth[0], self.bot.koth[2], self.bot.koth[3], seconds, True]
            added = False
            rank = 0
            for x in range(0, len(self.bot.kothhigh)):
                if add[3] < self.bot.kothhigh[x][3]:
                    added = True
                    rank = x
                    self.bot.kothhigh.insert(x, add)
                    break
            if added == False:
                rank = len(self.bot.kothhigh)
                self.bot.kothhigh.append(add)
            basics.save(bot,"kothhigh")

            emoji = ""
            if seconds > (60 * 60) * 24:
                emoji = "<:tier4:348277627598929922>"
            elif seconds > (60 * 60) * 6:
                emoji = "<:tier3:348279546765901826>"
            elif seconds > (60 * 60) * 2:
                emoji = "<:tier2:348276583741521921>"
            elif seconds > 60 * 15:
                emoji = "<:tier1:348266722526101505>"
            minutes = 0
            while seconds >= 60:
                seconds -= 60
                minutes += 1
            hours = 0
            while minutes >= 60:
                minutes -= 60
                hours += 1
            minutes += round(seconds / 60, 2)
            highs = emoji + str(hours) + " hours and " + str(minutes) + " minutes"
            try:
                highs = "\n\n<@{}> lasted {}, ranking at #{}. They've earned {} pixels for a total of {}.".format(
                    self.bot.koth[0], highs, len(self.bot.kothhigh) - rank,
                    koth.pixelcalc(self.bot.koth[4], datetime.utcnow()),
                    mf.pixeledit(self.bot, self.bot.koth[0], mf.pixelcalc(self.bot.koth[4], datetime.utcnow())))
            except:
                pass

            previouskoth = list(self.bot.koth)
            if bot == False:
                await talking.reply(context,
                               "<@{}> {} As such, you've become {} of the hill, overthrowing the previous {}!".format(
                                   self.bot.koth[0], statement, type, self.bot.koth[2]) + highs)

                self.bot.koth = [context.message.author.id, ccc.shownames(context.message.author), type,
                                 specialemoji, datetime.utcnow()]
            else:
                await talking.reply(context,
                               "<@{}> {} As such, the bot has become {} of the hill, overthrowing the previous {}!".format(
                                   self.bot.koth[0], statement, type, self.bot.koth[2]) + highs)
                # await mf.reply(context,"The bot has become {} of the hill, overthrowing <@{}>, the previous {}!".format(type,self.bot.koth[0],self.bot.koth[2])+highs)
                self.bot.koth = [self.bot.me.id, ccc.shownames(context.message.guild.me), type, specialemoji,
                                 datetime.utcnow()]

            basics.save(bot,"koth")
Пример #13
0
    async def peeon(self, context):
        """Spray people.

        Shows a dickdick spraying various fluids on a mentioned user based on the alias used.

        Modifiers:
        cum|nut|j**z : Replace pee with cum.
        bleed|blood : Replace pee with blood.
        sweat : Replace pee with sweat.

        Rigged Aliases:
        cumon, nuton, jizzon : Replace pee with cum.
        bleedon : Replace pee with blood.
        sweaton : Replace pee with sweat."""

        bot = self.bot
        m = context.message
        q = basics.contentq(m.content, split=False)

        q, cum, bleed, sweat = basics.subcommands(context, q,
                                           [r"cum|nut|j**z", r"bleed|blood", r"sweat"],
                                           riggedaliases=[
                                               {
                                                   "regex": r"cumon|nuton|jizzon",
                                                   "slot": 0,
                                                   "value": "cum"
                                               },
                                               {
                                                   "regex": r"bleedon",
                                                   "slot": 1,
                                                   "value": "bleed"
                                               },
                                               {
                                                   "regex": r"sweaton",
                                                   "slot": 2,
                                                   "value": "sweat"
                                               }
                                           ])

        if len(context.message.mentions) == 0:
            await talking.reply(context, "You need to mention someone!")
            return

        s = "<:dickdicks1:275176074940252163><:dickdicks2:275176053947891714><:dickdicks3:275176078853537792>"
        emoji = basics.useremoji(bot, m.mentions[0])
        if cum:
            s += "<:liqMilk:273903113264693248>"
            fluid = "cum"
        elif bleed:
            s += "<:liqBlood:382341153699135488>"
            fluid = "blood"
        elif sweat:
            s += "💦"
            fluid = "sweat"
        else:
            s += "<:liqPee:273882459924594689>"
            fluid = "pee"

        msg = await talking.say(context, s + emoji)
        await AchievementBrowser.ach_check(bot, m.mentions[0], m.channel, "peetarget",
                           [fluid, context.message.author])
        await msg.add_reaction(basics.useremoji(bot, m.author)[1:-1])