Example #1
0
    async def warn(self, ctx, member: discord.Member, *, reason):
        """
        Warns a member.
        Reason length is maximum of 200 characters.

        """
        if len(reason) > 200:
            await ctx.send(
                embed=failure("Please shorten the reason to 200 characters."),
                delete_after=3)
            return

        embed = infraction_embed(ctx, member, constants.Infraction.warning,
                                 reason)
        embed.add_field(
            name="**NOTE**",
            value=("If you are planning to repeat this again, "
                   "the mods may administer punishment for the action."))

        await self.deterrence_log_channel.send(f"{member.mention}",
                                               delete_after=0.5)
        await self.deterrence_log_channel.send(embed=embed)

        await self.bot.api_client.add_member_warning(ctx.author.id, member.id,
                                                     reason)

        await ctx.send(embed=success("Warning successfully applied.", ctx.me),
                       delete_after=5)

        await asyncio.sleep(5)
        await ctx.message.delete()
Example #2
0
    async def ban(self,
                  ctx,
                  member: discord.Member,
                  *,
                  reason="Reason not stated."):
        """
        Bans  member from the guild.

        """
        await member.ban(reason=reason)
        await ctx.send(embed=success(f"{member.name} successfully banned."),
                       delete_after=5)

        deterrence_embed = infraction_embed(ctx, member,
                                            constants.Infraction.ban, reason)
        deterrence_log_channel = self.bot.get_channel(
            constants.deterrence_log_channel_id)
        await deterrence_log_channel.send(embed=deterrence_embed)

        dm_embed = deterrence_embed
        dm_embed.add_field(
            name="Repeal",
            value="If this happened by a mistake contact moderators.")

        await member.send(embed=dm_embed)
Example #3
0
    async def ban(self, ctx, user: GetFetchUser, *, reason="Reason not stated."):
        """Bans  member from the guild."""
        await ctx.guild.ban(user=user, reason=reason)
        await ctx.send(embed=success(f"{user} successfully banned."), delete_after=5)
        deterrence_embed = infraction_embed(ctx, user, constants.Infraction.ban, reason)
        await self.deterrence_log_channel.send(embed=deterrence_embed)

        dm_embed = deterrence_embed
        dm_embed.add_field(
            name="Repeal",
            value="If this happened by a mistake contact moderators."
        )

        await user.send(embed=dm_embed)
Example #4
0
    async def kick(self, ctx, member: discord.Member, *, reason="No specific reason"):
        """Kicks  member from the guild."""
        await member.kick(reason=reason)
        await ctx.send(embed=success(f"{member.name} successfully kicked."), delete_after=5)

        deterrence_embed = infraction_embed(ctx, member, constants.Infraction.kick, reason)
        await self.deterrence_log_channel.send(embed=deterrence_embed)

        dm_embed = deterrence_embed
        dm_embed.add_field(
            name="Repeal",
            value="If this happened by a mistake contact moderators."
        )

        await member.send(embed=dm_embed)