Exemplo n.º 1
0
 async def get_config(self, ctx, key: str):
     try:
         value = config_handler.get_config(ctx.message.guild.id, key)
     except config_errors.KeyNotFound:
         await ctx.channel.send("This key doesn't exist, baka!",
                                delete_after=config_handler.get_config(
                                    ctx.message.guild.id, "delt"))
         return
     await ctx.channel.send(f"The key **{key}** equals to **{value}**!",
                            delete_after=config_handler.get_config(
                                ctx.message.guild.id, "delt"))
Exemplo n.º 2
0
 async def set_config(self, ctx, key: str, *, value: str):
     try:
         config_handler.set_config(ctx.message.guild.id, key, value)
     except config_errors.KeyNotFound:
         await ctx.channel.send("This key doesn't exist, baka!",
                                delete_after=config_handler.get_config(
                                    ctx.message.guild.id, "delt"))
         return
     await ctx.channel.send(f"I changed **{key}** to **{value}**!",
                            delete_after=config_handler.get_config(
                                ctx.message.guild.id, "delt"))
Exemplo n.º 3
0
    async def serverinfo(self, ctx):
        guild = ctx.message.guild

        embed = discord.Embed(title='Server/Guild information',
                              description=guild.name)

        embed.set_author(name=self.bot.user.name,
                         icon_url=self.bot.user.avatar_url)

        embed.add_field(name='ID', value=guild.id)
        embed.add_field(name='Region', value=guild.region)
        embed.add_field(name='AFK timeout', value=guild.afk_timeout)
        embed.add_field(name='AFK channel', value=guild.afk_channel)
        embed.add_field(name='Max. presences', value=guild.max_presences)
        embed.add_field(name='Max. members', value=guild.max_members)
        embed.add_field(name='Description', value=guild.description)
        embed.add_field(name='2FA authorisation', value=guild.mfa_level)
        embed.add_field(name='Verification level',
                        value=guild.verification_level)
        embed.add_field(name='Explicit content filter',
                        value=guild.explicit_content_filter)
        embed.add_field(name='Notification settings',
                        value=guild.default_notifications)
        embed.add_field(name='Premium tier', value=guild.premium_tier)
        embed.add_field(name='Nitro boosters',
                        value=guild.premium_subscription_count)
        embed.add_field(name='Member count', value=guild.member_count)
        embed.add_field(name='Created at (UTC)', value=guild.created_at)
        await ctx.channel.send(embed=embed,
                               delete_after=config_handler.get_config(
                                   ctx.message.guild.id, "delt"))
Exemplo n.º 4
0
 async def ban(self,
               ctx,
               member: discord.Member,
               *,
               reason: typing.Optional[str] = None):
     await member.ban(reason=reason)
     if not reason:
         reason = "this member created an imbalance."
     await ctx.channel.send(
         f"I banned {member.nick} because {reason}. :wink:",
         delete_after=config_handler.get_config(ctx.message.guild.id,
                                                "delt"))
Exemplo n.º 5
0
 async def kick(self,
                ctx,
                member: discord.Member,
                *,
                reason: typing.Optional[str] = None):
     await member.kick(reason=reason)
     if not reason:
         reason = "I wanted it like this"
     await ctx.channel.send(
         f"I kicked {member.nick} because {reason}. I love kicking some, oh I can't say that anymore...",
         delete_after=config_handler.get_config(ctx.message.guild.id,
                                                "delt"))
Exemplo n.º 6
0
 async def unban(self,
                 ctx,
                 mention: str,
                 *,
                 reason: typing.Optional[str] = None):
     member = discord.Object(
         id=mention.replace('<', '').replace('>', '').replace('@', ''))
     await ctx.guild.unban(member, reason=reason)
     if not reason:
         reason = "I'm not a feelingless robot."
     await ctx.channel.send(
         f"I banned {member.nick} because {reason}. No need to fear!",
         delete_after=config_handler.get_config(ctx.message.guild.id,
                                                "delt"))
Exemplo n.º 7
0
    async def roleinfo(self, ctx, role: discord.Role):
        embed = discord.Embed(title='Role information',
                              colour=role.colour,
                              description=role.name)

        embed.set_author(name=self.bot.user.name,
                         icon_url=self.bot.user.avatar_url)

        embed.add_field(name='ID', value=role.id)
        embed.add_field(name='Permission value', value=role.permissions.value)
        embed.add_field(name='Hoist', value=role.hoist)
        embed.add_field(name='Position', value=role.position)
        embed.add_field(name='Managed', value=role.managed)
        await ctx.channel.send(embed=embed,
                               delete_after=config_handler.get_config(
                                   ctx.message.guild.id, "delt"))
Exemplo n.º 8
0
def get_prefix(bot, message):
    if not message.guild:
        return config_handler.get_default_config
    prefix = config_handler.get_config(message.guild.id, "prefix")
    return commands.when_mentioned_or(*prefix)(bot, message)
Exemplo n.º 9
0
 async def edit(self, ctx, member: discord.Member, key: str, *, value: str):
     await ctx.channel.send(
         f"I edited **{key}** on {member.mention} to **{value}**!",
         delete_after=config_handler.get_config(ctx.message.guild.id,
                                                "delt"))
     await member.edit(**{key: value})
Exemplo n.º 10
0
 async def purge(self, ctx, *, limit: int):
     await ctx.channel.purge(limit=limit)
     await ctx.channel.send(
         f"I purged {limit} messages! I LIKE BURNING THINGS OKAY?!!",
         delete_after=config_handler.get_config(ctx.message.guild.id,
                                                "delt"))