Ejemplo n.º 1
0
    async def dos_requirement(self, membership):
        await self.ctx.send(_("How many days on server does this membership require?\n"
                              "*Note in global mode this will calculate based on when the user "
                              "account was created.*"))
        days = await self.ctx.bot.wait_for("message", timeout=25.0,
                                           check=MessagePredicate.positive(ctx=self.ctx))

        if self.mode == "create":
            membership['DOS'] = int(days.content)
            return

        async with self.coro() as membership_data:
            membership_data[membership]['DOS'] = int(days.content)
        await self.ctx.send(_('Time requirement set to {}.').format(days.content))
Ejemplo n.º 2
0
    async def set_reduction(self, membership):
        await self.ctx.send(_("What is the cooldown reduction of this membership?"))
        reduction = await self.ctx.bot.wait_for("message", timeout=25.0,
                                                check=MessagePredicate.positive(ctx=self.ctx))

        if reduction.content.lower() == self.cancel:
            raise ExitProcess()

        if self.mode == "create":
            membership['Reduction'] = int(reduction.content)
            return

        async with self.coro() as membership_data:
            membership_data[membership]['Reduction'] = int(reduction.content)
Ejemplo n.º 3
0
    async def set_access(self, membership):
        await self.ctx.send(_("What access level would you like to set?"))
        access = await self.ctx.bot.wait_for("message", timeout=25.0,
                                             check=MessagePredicate.positive(ctx=self.ctx))

        if access.content.lower() == self.cancel:
            raise ExitProcess()

        if self.mode == "create":
            membership['Access'] = int(access.content)
            return

        async with self.coro() as membership_data:
            membership_data[membership]['Access'] = int(access.content)

        await self.ctx.send(_('Access set to {}.').format(access.content.lower()))
Ejemplo n.º 4
0
    async def credits_requirement(self, membership):
        await self.ctx.send(_("How many credits does this membership require?"))

        amount = await self.ctx.bot.wait_for("message", timeout=25.0,
                                             check=MessagePredicate.positive(ctx=self.ctx))

        if amount.content.lower() == self.cancel:
            raise ExitProcess()

        if self.mode == "create":
            membership['Credits'] = int(amount.content)
            return

        async with self.coro() as membership_data:
            membership_data[membership]['Credits'] = int(amount.content)

        await self.ctx.send(_('Credits requirement set to {}.').format(amount.content))
Ejemplo n.º 5
0
 async def number_page(self, payload):
     prompt = await self.ctx.send(
         "Send a number of page that you wish to see")
     try:
         pred = MessagePredicate.positive(self.ctx)
         msg = await self.bot.wait_for(
             "message_without_command",
             check=pred,
             timeout=10.0,
         )
         if pred.result:
             jump_page = int(msg.content)
             if jump_page > self._source.get_max_pages():
                 jump_page = self._source.get_max_pages()
             await self.show_checked_page(jump_page - 1)
             if self.ctx.channel.permissions_for(
                     self.ctx.me).manage_messages:
                 with suppress(discord.HTTPException):
                     await msg.delete()
     except asyncio.TimeoutError:
         pass
     finally:
         with suppress(discord.HTTPException):
             await prompt.delete()