Skip to content

Commit

Permalink
Merge pull request #425 from The-4th-Hokage/deepsource-transform-e37b…
Browse files Browse the repository at this point in the history
…6e8e

Format code with black, yapf, autopep8 and isort
  • Loading branch information
Dhruvacube authored Jan 15, 2022
2 parents e755d8b + 19c23f1 commit e2057a4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
19 changes: 13 additions & 6 deletions minato_namikaze/bot_files/cogs/moderation/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,16 @@ async def setdelay(self, ctx, seconds: int):
@commands.bot_has_permissions(kick_members=True)
@commands.guild_only()
@commands.has_guild_permissions(kick_members=True)
async def kick(self, ctx, member: Optional[Union[discord.Member, MemberID]], *, reason=None):
async def kick(self,
ctx,
member: Optional[Union[discord.Member, MemberID]],
*,
reason=None):
"""A command which kicks a given user"""
await ctx.guild.kick(user=member, reason=reason)

embed = discord.Embed(title=f"{ctx.author.name} kicked: {member.name}", description=reason)
embed = discord.Embed(title=f"{ctx.author.name} kicked: {member.name}",
description=reason)
await ctx.send(embed=embed)

# ban
Expand All @@ -83,7 +88,8 @@ async def ban(
description="You **can't ban yourself**!"))
return
try:
await ctx.guild.ban(user=member, reason=ActionReason().convert(ctx, reason))
await ctx.guild.ban(user=member,
reason=ActionReason().convert(ctx, reason))
except:
await ctx.send(
embed=ErrorEmbed(
Expand All @@ -93,7 +99,8 @@ async def ban(
)
return

embed = ErrorEmbed(title=f"{ctx.author.name} banned: {member.name}",description=reason)
embed = ErrorEmbed(title=f"{ctx.author.name} banned: {member.name}",
description=reason)
await ctx.send(embed=embed)

# banlist
Expand Down Expand Up @@ -238,8 +245,8 @@ async def softban(self,
if reason is None:
reason = f"Action done by {ctx.author} (ID: {ctx.author.id})"

await ctx.guild.ban(member, reason=ActionReason(ctx,reason))
await ctx.guild.unban(member, reason=ActionReason(ctx,reason))
await ctx.guild.ban(member, reason=ActionReason(ctx, reason))
await ctx.guild.unban(member, reason=ActionReason(ctx, reason))
await ctx.send("\N{OK HAND SIGN}")

# Unban
Expand Down
3 changes: 2 additions & 1 deletion minato_namikaze/bot_files/lib/classes/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ async def convert(self, ctx, argument):
"This member has not been banned before.") from None

ban_list = await ctx.guild.bans()
entity = discord.utils.find(lambda u: str(u.user) == argument,ban_list)
entity = discord.utils.find(lambda u: str(u.user) == argument,
ban_list)

if entity is None:
raise commands.BadArgument(
Expand Down
8 changes: 5 additions & 3 deletions minato_namikaze/bot_files/lib/util/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import TenGiphPy
from discord.ext import commands

from .vars import ChannelAndMessageId, SetupVars, Tokens, MemberID
from .vars import ChannelAndMessageId, MemberID, SetupVars, Tokens


class ConfirmationView(discord.ui.View):
Expand Down Expand Up @@ -233,12 +233,14 @@ def get_roles(self, role: Union[int, discord.Role]):
role = discord.utils.get(self.guild.roles, id=role)
return role

def get_emoji(self, emoji: Union[int, discord.Emoji, discord.PartialEmoji]):
def get_emoji(self, emoji: Union[int, discord.Emoji,
discord.PartialEmoji]):
if isinstance(emoji, int):
emoji = discord.utils.get(self.guild.emojis, id=role)
return emoji

def get_guild(self, guild: Union[int, discord.Guild, discord.PartialInviteGuild]):
def get_guild(self, guild: Union[int, discord.Guild,
discord.PartialInviteGuild]):
if isinstance(guild, int):
guild = self.bot.get_guild(guild)
return guild
Expand Down

0 comments on commit e2057a4

Please sign in to comment.