Example #1
0
 def __init__(self, bot, **kwargs):
     OngoingReactionMenu.__init__(self, bot, **kwargs)
     # Setup
     defaults = {"suer": None, "suee": None, "reason": ""}
     self.innocentlist = []
     self.guiltylist = []
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #2
0
    def __init__(self, bot, **kwargs):
        Rerollable.__init__(self, bot, **kwargs)
        self.q, ratio = basics.subcommands(
            self.context,
            self.q,
            [r"yes|yeah|ya|yeh|ye|yup|y|no|nah|nope|n|(\d)(?:\||\/|;|:)(\d)"],
            riggedaliases=[{
                "regex": r"8?(yes|yeah|ya|yeh|ye|yup|y)",
                "slot": 0,
                "value": "y"
            }, {
                "regex": r"8?(no|nah|nope|n)",
                "slot": 0,
                "value": "n"
            }])

        if ratio:
            if ratio.group(1).startswith("y"):
                y = 1
                n = 0
            elif ratio.group(1).startswith("n"):
                y = 0
                n = 1
            else:
                y = int(ratio.group(2))
                n = int(ratio.group(3))
        else:
            y = 1
            n = 1
        defaults = {"q": self.q, "yesratio": y, "noratio": n}
        kwargs["q"] = self.q
        DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #3
0
    def __init__(self, bot, **kwargs):
        Rerollable.__init__(self, bot, **kwargs)
        # Setup
        options = []
        totalrate = 0
        title = None
        for x in self.q.split(";"):
            rate = 1
            forced = False
            x, sub = basics.subcommands(self.context, x, [r"\d+|\+|-|t"])

            if sub != None:
                sub = sub.group(1)
                if sub == "t":
                    title = x
                    continue
                elif sub == "-":
                    rate = 0
                elif sub == "+":
                    forced = True
                else:
                    rate = int(sub)

            options.append({"s": x, "chance": rate, "forced": forced})
            totalrate += rate
        defaults = {"options": options, "totalrate": totalrate, "title": title}
        DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #4
0
    def __init__(self, bot, **kwargs):
        SingleButton.__init__(self, bot, **kwargs)

        defaults = {"otheremojis": [], "info": "", "collected": set()}
        self.userids = []

        DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #5
0
 def __init__(self, bot, **kwargs):
     Rerollable.__init__(self, bot, **kwargs)
     # Setup
     self.q, eo = basics.subcommands(self.context, self.q,
                                     [r"equaloutcome|eo"])
     defaults = {"die": [6], "outcomes": [], "eo": eo}
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #6
0
 def __init__(self, bot, **kwargs):
     InputMenu.__init__(self, bot, **kwargs)
     # Setup
     defaults = {}
     self.reactions = {}
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
     self.adddict[-1] = self.reactionadded
Example #7
0
 def __init__(self,bot,**kwargs):
     OngoingReactionMenu.__init__(self,bot,**kwargs)
     # Setup
     defaults = {
         "collectors": set()
     }
     self.obamasilver = utility.get_emoji(bot, ":obamasilverpile:349449386692050944")
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #8
0
 def __init__(self, bot, **kwargs):
     OngoingReactionMenu.__init__(self, bot, **kwargs)
     # Setup
     defaults = {
         "pages": ["­"],
     }
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
     self.pageindex = 0
Example #9
0
 def __init__(self, bot, **kwargs):
     OngoingReactionMenu.__init__(self, bot, **kwargs)
     # Setup
     defaults = {
         "differentchannel":
         self.bot.epicord.get_channel(488516474735034389)
         if self.context.message.guild.id == self.bot.epicord.id else None
     }
     self.userids = [self.context.message.author.id]
     self.personpicked = None
     self.bot.sdailylast[self.context.message.guild.id][str(
         self.context.message.author.id)] = str(datetime.utcnow().date())
     basics.save(self.bot, "sdailylast")
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
    def __init__(self, bot, **kwargs):
        OngoingReactionMenu.__init__(self, bot, **kwargs)

        async def default(self, payload):
            pass

        async def defaultnopayload(self):
            pass

        defaults = {
            "anyscript": default,
            "singlescript": default,
            "doublescript": default,
            "timeoutscript": default,
            "startscript": defaultnopayload
        }
        self.userids = [self.context.message.author.id]
        DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #11
0
    def __init__(self, bot, **kwargs):
        OngoingReactionMenu.__init__(self, bot, **kwargs)

        async def default(self, payload):
            pass

        defaults = {
            "anyscript": default,
            "singlescript": default,
            "doublescript": default,
            "timeoutscript": default,
            "startscript": default,
            "emoji": utility.get_emoji(bot, "628461134999191568"),
            "currentreactors": set(),
            "messagecount": 0,
        }
        self.userids = [self.context.message.author.id]
        DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #12
0
    def __init__(self, bot, **kwargs):
        OngoingReactionMenu.__init__(self, bot, **kwargs)
        # Setup
        defaults = {
            "emoji": "<a:rolling:393641477068029953>",
            "q": "­",
            "lit": False
        }
        DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
        self.pageindex = 0

        self.words = "**" + self.q + "**"
        self.names = ""
        self.idlist = []  # For achievements
        self.idlistnoremove = []  # For achievements
        self.header = "\nPetition started by " + self.context.message.author.mention + ".\n\n"
        self.signtut = f"Hit {self.emoji} to sign.\n"
        self.footer = "Total signatures: "
        self.poweredup = False
Example #13
0
    def __init__(self, bot, **kwargs):
        OngoingReactionMenu.__init__(self, bot, **kwargs)

        # Setup
        if random.randint(1, 100) == 1:
            btn_yes = utility.get_emoji(bot, "<:upstinky:288858540888686602>")
            btn_no = utility.get_emoji(bot, "<:downstinky:288858539332599808>")
        else:
            btn_yes = utility.get_emoji(bot, "<:bn_yes:331164192864206848>")
            btn_no = utility.get_emoji(bot, "<:bn_no:331164190284972034>")

        async def default(self):
            pass

        async def defaultno(self):
            self.message = 'THEN DIE'

        defaults = {
            "message": "Hit YES to confirm. Hit NO to uh, die.",
            "yesscript": default,
            "noscipt": defaultno,
            "timeoutscript": default,
            "btn_yes": btn_yes,
            "btn_no": btn_no,
            "cost": 0
        }
        self.userids = [self.context.message.author.id]
        DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])

        # Remove if broke
        ots = ot.otedit(self.bot,
                        self.context.message.author,
                        0,
                        False,
                        channel=self.context.message.channel)
        if ots < self.cost:
            self.message = f"You need {ccc.pluralstr('Obama Token', self.cost)} to do this, but you only have {ots}."
            asyncio.ensure_future(self.end())
            return
Example #14
0
 def __init__(
         self, bot, **kwargs
 ):  #validfor,adddict,removedict,messagecount,context,userids):
     # Setup
     defaults = {
         "validfor": datetime.utcnow() + timedelta(minutes=10),
         "adddict": {},
         "removedict": {},
         "messagecount": 1,
         "messages": [],
         "foreignmessages": [],
         "userids": [],
         "context": None,
         "id": None,
         "differentchannel": None,
         "disableinputs": False,
         "ended": False  # Used to make sure this only finishes once
     }
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
     self.bot = bot
     # Other stuff
     self.endtime = datetime.utcnow() + kwargs["validfor"]
     asyncio.ensure_future(self.start())
Example #15
0
 def __init__(self, bot, **kwargs):
     InputMenu.__init__(self, bot, **kwargs)
     # Setup
     defaults = {"map": {}, "position": []}
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #16
0
 def __init__(self, bot, **kwargs):
     OngoingReactionMenu.__init__(self, bot, **kwargs)
     DictSavable.__init__(self, {}, kwargs, exclude=["validfor"])
Example #17
0
 def __init__(self, bot, **kwargs):
     InputMenu.__init__(self, bot, **kwargs)
     # Setup
     defaults = {"show": ""}
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #18
0
 def __init__(self, bot, **kwargs):
     OngoingReactionMenu.__init__(self, bot, **kwargs)
     # Setup
     defaults = {"rerolls": 0, "message": "", "rerolllist": [], "q": ""}
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #19
0
 def __init__(self, bot, **kwargs):
     OngoingReactionMenu.__init__(self, bot, **kwargs)
     # Setup
     defaults = {"disrespectcount": {}, "delayed": False}
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #20
0
    def __init__(self, bot, **kwargs):
        InputMenu.__init__(self, bot, **kwargs)
        # Setup
        defaults = {}
        self.reactions = {}
        DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])

        for x in [
                328724374540779522, 328724374498836500, 328724374465282049,
                328062456905728002
        ]:
            self.adddict[x] = self.movecursor

        if self.context.message.author.id == self.bot.rnl.id:
            self.adddict[331164192776126464] = self.removeachievement

        # Add to dict if needed
        if len(self.context.message.mentions) != 0:
            self.u = self.context.message.mentions[0]
            self.title = "{}'s Achievements, viewed by {}".format(
                ccc.repuser(self.bot, self.u),
                ccc.repuser(self.bot, self.context.message.author))
        else:
            self.u = self.context.message.author
            self.title = "{}'s Achievements ".format(
                ccc.repuser(self.bot, self.u))

        u = self.u
        title = self.title

        AchievementBrowser.establishbaseline(bot, u.id,
                                             self.context.message.guild.id)
        achievements = self.getachievements()
        """if self.u.id not in self.bot.ach_tracking.keys():
            self.bot.ach_tracking[u.id] = {}
        for n,x in enumerate(achievements):
            # Add achivement to tracking if missing
            if n not in self.bot.ach_tracking[u.id].keys():
                self.bot.ach_tracking[u.id][n] = []
                for x in range(0, len(x["check"])):
                    self.bot.ach_tracking[u.id][n].append(False)"""

        # Set up grid
        self.width = 9
        self.numberofachs = 0
        typeallowed = json.load(open("json/achievements_allowed.json"))
        for name in json.load(open("json/achievement_order.json")):
            for n, x in enumerate(achievements):
                server = "global" if achievements[n][
                    "global"] else self.context.message.guild.id
                f**k = False
                for y in x["check"]:
                    if y[0] not in typeallowed:
                        f**k = True
                        break
                if f**k:
                    continue
                if (False not in self.bot.ach_tracking[server][u.id][n] or x["special"] == False) and \
                        x["name"] == name:
                    self.numberofachs += 1
        self.height = math.ceil(self.numberofachs / self.width)

        self.grid = []
        for x in range(self.width):
            self.grid.append([])
            for y in range(math.ceil(self.numberofachs / self.width)):
                self.grid[x].append(None)
        x = 0
        y = 0
        for name in json.load(open("json/achievement_order.json")):
            for n, xx in enumerate(achievements):

                server = "global" if achievements[n][
                    "global"] else self.context.message.guild.id

                f**k = False
                for yy in xx["check"]:
                    if yy[0] not in typeallowed:
                        f**k = True
                        break
                if f**k:
                    continue

                if (False not in self.bot.ach_tracking[server][u.id][n] or xx["special"] == False) and \
                        xx["name"] == name:
                    self.grid[x][y] = n
                    x += 1
                    if x == self.width:
                        x = 0
                        y += 1
        self.cursor = [0, 0]
 def __init__(self, bot, **kwargs):
     Rerollable.__init__(self, bot, **kwargs)
     defaults = {"q": self.q}
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
Example #22
0
 def __init__(self, bot, **kwargs):
     OngoingReactionMenu.__init__(self, bot, **kwargs)
     # Setup
     defaults = {"sl": []}
     DictSavable.__init__(self, defaults, kwargs, exclude=["validfor"])
     self.step = 0