Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code with black, yapf, autopep8 and isort #425

Merged
merged 1 commit into from
Jan 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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