Ejemplo n.º 1
0
    async def registerallchannels(self, ctx, persistence: int):
        await self.bot.say(self.msg.REG_WAIT)
        count = 0
        for channel in ctx.message.server.channels:
            _channel = Channel(channel.id)

            if _channel.is_Registered:
                continue

            _channel.append_channel()
            _channel.set_persistence(persistence)
            count += 1

        if count == 0:
            await self.bot.say(self.msg.NO_CHANNEL_REG)
            return

        await self.bot.say(self.msg.REG_CHAN_SUCC.format(count))
Ejemplo n.º 2
0
    async def setpersistence(self,
                             ctx,
                             value: int,
                             channel: discord.Channel = None):
        if channel is None:
            channel = ctx.message.channel

        _channel = Channel(channel.id)

        if _channel.is_Registered is False:
            await self.bot.say(self.errors.CHANNEL_NOT_IN_DB)
            return

        rng = random.randint(100, 999)

        embed = discord.Embed(title=self.msg.E_VERIFY_TITLE,
                              description=self.msg.E_VERIFY_DESC.format(rng),
                              color=self.themes.MAIN_COL)
        embed.add_field(name=self.msg.E_VERIFY_BEFORE,
                        value=_channel.persistence,
                        inline=False)
        embed.add_field(name=self.msg.E_VERIFY_PERSIST,
                        value=value,
                        inline=False)
        embed.add_field(name=self.msg.E_VERIFY_CHANGING,
                        value=channel.name,
                        inline=False)

        await self.bot.say(embed=embed)

        msg = await self.bot.wait_for_message(author=ctx.message.author,
                                              content=str(rng),
                                              timeout=20.00)

        if msg is None:
            await self.bot.say("Confirmation timed out, please try again.")
            return

        _channel.set_persistence(value)

        await self.bot.say(self.msg.OPERATION_SUCCESSFUL)