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 #503

Merged
merged 1 commit into from
Feb 8, 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
20 changes: 13 additions & 7 deletions minato_namikaze/lib/util/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,47 @@


class ConfirmationView(discord.ui.View):
def __init__(self, *, timeout: float, author_id: int, ctx: Context, delete_after: bool) -> None:
def __init__(self, *, timeout: float, author_id: int, ctx: Context,
delete_after: bool) -> None:
super().__init__(timeout=timeout)
self.value: Optional[bool] = None
self.delete_after: bool = delete_after
self.author_id: int = author_id
self.ctx: Context = ctx
self.message: Optional[discord.Message] = None

async def interaction_check(self, interaction: discord.Interaction) -> bool:
async def interaction_check(self,
interaction: discord.Interaction) -> bool:
if interaction.user and interaction.user.id == self.author_id:
return True
else:
await interaction.response.send_message('This confirmation dialog is not for you.', ephemeral=True)
await interaction.response.send_message(
"This confirmation dialog is not for you.", ephemeral=True)
return False

async def on_timeout(self) -> None:
if self.delete_after and self.message:
await self.message.delete()

@discord.ui.button(label='Confirm', style=discord.ButtonStyle.green)
async def confirm(self, button: discord.ui.Button, interaction: discord.Interaction):
@discord.ui.button(label="Confirm", style=discord.ButtonStyle.green)
async def confirm(self, button: discord.ui.Button,
interaction: discord.Interaction):
self.value = True
await interaction.response.defer()
if self.delete_after:
await interaction.delete_original_message()
self.stop()

@discord.ui.button(label='Cancel', style=discord.ButtonStyle.red)
async def cancel(self, button: discord.ui.Button, interaction: discord.Interaction):
@discord.ui.button(label="Cancel", style=discord.ButtonStyle.red)
async def cancel(self, button: discord.ui.Button,
interaction: discord.Interaction):
self.value = False
await interaction.response.defer()
if self.delete_after:
await interaction.delete_original_message()
self.stop()


class Context(commands.Context):
async def entry_to_code(self, entries):
width = max(len(a) for a, b in entries)
Expand Down
3 changes: 1 addition & 2 deletions minato_namikaze/slash/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@


class Activities(
discord.SlashCommand,
):
discord.SlashCommand, ):
"""Get access to discord beta activities feature"""

activities: typing.Optional[typing.Literal[
Expand Down