From 09a1df1a5adb4fc53fc06b097f7ea7713ae32239 Mon Sep 17 00:00:00 2001 From: Mari Date: Thu, 6 Jul 2023 20:09:55 +0200 Subject: [PATCH] refactor --- src/auth.py | 4 +- src/bot.py | 161 ++++++++++++++++++++++++++++--------------- src/ui.py | 194 +++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 245 insertions(+), 114 deletions(-) diff --git a/src/auth.py b/src/auth.py index 1311f05..b0e51b6 100644 --- a/src/auth.py +++ b/src/auth.py @@ -70,9 +70,7 @@ async def remove_key(): "token": token, "sub": user["sub"], "name": user["name"], - "account_url": env.laurel_auth_url - + "?redirect=" - + str(request.url_for("auth_login")), + "account_url": env.laurel_auth_url, "logout_url": env.laurel_auth_url + "auth/logout?redirect=" + str(request.url_for("auth_login")), diff --git a/src/bot.py b/src/bot.py index bb8e31b..b4a7417 100644 --- a/src/bot.py +++ b/src/bot.py @@ -54,10 +54,11 @@ OffTopicChannelRequestInput, offtopic_request_button, create_offtopic_channel_request_accept_embed, + channel_request_accepted, OffTopicChannelRequestAcceptInput, OffTopicChannelRequestDeclineInput, accept_offtopic_channel_send, - decline_offtopic_channel_send + decline_offtopic_channel_send, ) from .env import env @@ -85,17 +86,19 @@ async def on_ready(self): async def about(self): # get about channel - message = await last_channel_message(channel_by_name(self, "about")) + message = await last_or_new_channel_message(channel_by_name(self, "about")) # update message await message.edit(content="", embed=about_embed) async def authenticate(self): # get authenticate channel - message = await last_channel_message(channel_by_name(self, "authenticate")) + message = await last_or_new_channel_message( + channel_by_name(self, "authenticate") + ) # try logging in on token input async def on_login(input: AuthTokenInput, interaction: Interaction): - await login(str(input.token), interaction) + await authorize_token(str(input.token), interaction) # opens the token modal async def auth_token_modal(interaction: Interaction): @@ -108,16 +111,16 @@ async def auth_token_modal(interaction: Interaction): await message.edit(content="", embed=auth_embed, view=auth_view()) async def account(self): - message = await last_channel_message(channel_by_name(self, "account")) + message = await last_or_new_channel_message(channel_by_name(self, "account")) - account_logout_button.callback = logout + account_logout_button.callback = disconnect_account # try logging out and in on token input async def on_update(input: AccountTokenInput, interaction: Interaction): - if await logout(interaction, message=False) and await login( - str(input.token), interaction, message=False - ): - await send_response_message( + if await disconnect_account( + interaction, message=False + ) and await authorize_token(str(input.token), interaction, message=False): + await send_decaying_response_message( interaction.response, account_update_success ) @@ -131,7 +134,7 @@ async def account_token_modal(interaction: Interaction): # renames the user on the server async def on_rename(input: AccountNameInput, interaction: Interaction): - await update_name(input.name.value, interaction) + await update_nickname(input.name.value, interaction) # opens name modal for new name async def account_name_modal(interaction: Interaction): @@ -145,22 +148,29 @@ async def account_name_modal(interaction: Interaction): async def channels(self): # get channels channel - message = await last_channel_message(channel_by_name(self, "channels")) + message = await last_or_new_channel_message(channel_by_name(self, "channels")) # opens the request modal async def channel_request_modal(interaction: Interaction): channel_request_input = ChannelRequestInput() - channel_request_input.on_submit = MethodType(on_request, channel_request_input) + channel_request_input.on_submit = MethodType( + on_request, channel_request_input + ) await interaction.response.send_modal(channel_request_input) - + # opens the offtopic request modal async def offtopic_channel_request_modal(interaction: Interaction): offtopic_channel_request_input = OffTopicChannelRequestInput() - offtopic_channel_request_input.on_submit = MethodType(on_request, offtopic_channel_request_input) + offtopic_channel_request_input.on_submit = MethodType( + on_request, offtopic_channel_request_input + ) await interaction.response.send_modal(offtopic_channel_request_input) # sends the rquest to admin channel - async def on_request(input: ChannelRequestInput | OffTopicChannelRequestInput, interaction: Interaction): + async def on_request( + input: ChannelRequestInput | OffTopicChannelRequestInput, + interaction: Interaction, + ): match input: case ChannelRequestInput(): await forward_channel_request(input, interaction) @@ -233,7 +243,7 @@ async def voice(self, member: Member, before: VoiceState, after: VoiceState): ## Functionality ######################################################################## -async def login(token: str, interaction: Interaction, message=True) -> bool: +async def authorize_token(token: str, interaction: Interaction, message=True) -> bool: # token is valid if token in state: # get user information @@ -261,17 +271,19 @@ async def login(token: str, interaction: Interaction, message=True) -> bool: # send success message if message: - await send_response_message(interaction.response, auth_login_success) + await send_decaying_response_message( + interaction.response, auth_login_success + ) return True # token is invalid else: # send failure message - await send_response_message(interaction.response, auth_login_failure) + await send_decaying_response_message(interaction.response, auth_login_failure) return False -async def logout(interaction: Interaction, message=True) -> bool: +async def disconnect_account(interaction: Interaction, message=True) -> bool: # get all roles to remove roles = list( filter( @@ -290,26 +302,32 @@ async def logout(interaction: Interaction, message=True) -> bool: pass if message: - await send_response_message(interaction.response, auth_logout_success) + await send_decaying_response_message(interaction.response, auth_logout_success) return True -async def update_name(name: str, interaction: Interaction): +async def update_nickname(name: str, interaction: Interaction): matches = re.findall(r"^\[[a-z0-9]+\]", str(interaction.user.nick)) if len(matches) != 1: - await send_response_message(interaction.response, account_name_invalid) + await send_decaying_response_message(interaction.response, account_name_invalid) else: try: await interaction.user.edit(nick=f"{matches[0]} {name}") except Forbidden: # user is server owner pass - await send_response_message(interaction.response, account_name_update_success) + await send_decaying_response_message( + interaction.response, account_name_update_success + ) -async def forward_channel_request(input: ChannelRequestInput, request_interaction: Interaction): - - async def on_accept(channel_request_accept_input: ChannelRequestAcceptInput, accept_interaction: Interaction): +async def forward_channel_request( + input: ChannelRequestInput, request_interaction: Interaction +): + async def on_accept( + channel_request_accept_input: ChannelRequestAcceptInput, + accept_interaction: Interaction, + ): await accept_interaction.user.guild.create_text_channel( name=channel_request_accept_input.name_of_channel.value, overwrites={ @@ -336,40 +354,58 @@ async def on_accept(channel_request_accept_input: ChannelRequestAcceptInput, acc use_application_commands=True, use_embedded_activities=True, use_external_emojis=True, - use_external_stickers=True - ) + use_external_stickers=True, + ), }, - category=utils.get(accept_interaction.user.guild.categories, name="channels"), - topic=f"**[{channel_request_accept_input.kind_of_lecture}]** {channel_request_accept_input.name_of_lecture}" + category=utils.get( + accept_interaction.user.guild.categories, name="channels" + ), + topic=f"**[{channel_request_accept_input.kind_of_lecture}]** {channel_request_accept_input.name_of_lecture}", ) - await request_interaction.user.send(f"Your channel request for {channel_request_accept_input.name_of_channel} is accepted") + await request_interaction.user.send( + channel_request_accepted(channel_request_accept_input.name_of_channel) + ) embed = accept_interaction.message.embeds[0] embed = embed.set_footer(text=f"Accepted by {accept_interaction.user.nick}") await accept_interaction.message.edit(embed=embed, view=None) - await send_response_message(accept_interaction.response, accept_channel_send) - - async def on_decline(channel_request_decline_input: ChannelRequestDeclineInput, decline_interaction: Interaction): + await send_decaying_response_message( + accept_interaction.response, accept_channel_send + ) + async def on_decline( + channel_request_decline_input: ChannelRequestDeclineInput, + decline_interaction: Interaction, + ): decline_message = channel_request_decline_input.declined_massage.value await request_interaction.user.send(decline_message) embed = decline_interaction.message.embeds[0] embed = embed.set_footer(text=f"Declined by {decline_interaction.user.nick}") await decline_interaction.message.edit(embed=embed, view=None) - await send_response_message(decline_interaction.response, decline_channel_send) + await send_decaying_response_message( + decline_interaction.response, decline_channel_send + ) - view, embed = create_channel_request_accept_embed(input, request_interaction, on_accept, on_decline) + view, embed = create_channel_request_accept_embed( + input, request_interaction, on_accept, on_decline + ) channel = utils.get(request_interaction.user.guild.channels, name="accept") await channel.send(embed=embed, view=view) - await send_response_message(request_interaction.response, accept_channel_request_send) + await send_decaying_response_message( + request_interaction.response, accept_channel_request_send + ) -async def forward_offtopic_channel_request(input: OffTopicChannelRequestInput, request_interaction: Interaction): - - async def on_accept(offtopic_channel_request_accept_input: OffTopicChannelRequestAcceptInput, accept_interaction: Interaction): +async def forward_offtopic_channel_request( + input: OffTopicChannelRequestInput, request_interaction: Interaction +): + async def on_accept( + offtopic_channel_request_accept_input: OffTopicChannelRequestAcceptInput, + accept_interaction: Interaction, + ): await accept_interaction.user.guild.create_text_channel( name=offtopic_channel_request_accept_input.name_of_channel.value, overwrites={ @@ -396,35 +432,52 @@ async def on_accept(offtopic_channel_request_accept_input: OffTopicChannelReques use_application_commands=True, use_embedded_activities=True, use_external_emojis=True, - use_external_stickers=True - ) + use_external_stickers=True, + ), }, - category=utils.get(accept_interaction.user.guild.categories, name="offtopic"), - topic=offtopic_channel_request_accept_input.description.value + category=utils.get( + accept_interaction.user.guild.categories, name="offtopic" + ), + topic=offtopic_channel_request_accept_input.description.value, ) - await request_interaction.user.send(f"Your channel request for {offtopic_channel_request_accept_input.name_of_channel} is accepted") + await request_interaction.user.send( + channel_request_accepted( + offtopic_channel_request_accept_input.name_of_channel + ) + ) embed = accept_interaction.message.embeds[0] embed = embed.set_footer(text=f"Accepted by {accept_interaction.user.nick}") await accept_interaction.message.edit(embed=embed, view=None) - await send_response_message(accept_interaction.response, accept_offtopic_channel_send) - - async def on_decline(channel_request_decline_input: OffTopicChannelRequestDeclineInput, decline_interaction: Interaction): + await send_decaying_response_message( + accept_interaction.response, accept_offtopic_channel_send + ) + async def on_decline( + channel_request_decline_input: OffTopicChannelRequestDeclineInput, + decline_interaction: Interaction, + ): decline_message = channel_request_decline_input.declined_massage.value await request_interaction.user.send(decline_message) embed = decline_interaction.message.embeds[0] embed = embed.set_footer(text=f"Declined by {decline_interaction.user.nick}") await decline_interaction.message.edit(embed=embed, view=None) - await send_response_message(decline_interaction.response, decline_offtopic_channel_send) + await send_decaying_response_message( + decline_interaction.response, decline_offtopic_channel_send + ) - view, embed = create_offtopic_channel_request_accept_embed(input, request_interaction, on_accept, on_decline) + view, embed = create_offtopic_channel_request_accept_embed( + input, request_interaction, on_accept, on_decline + ) channel = utils.get(request_interaction.user.guild.channels, name="accept") await channel.send(embed=embed, view=view) - await send_response_message(request_interaction.response, accept_channel_request_send) + await send_decaying_response_message( + request_interaction.response, accept_channel_request_send + ) + ## Utils ################################################################################ @@ -442,11 +495,11 @@ async def get_or_create_role(guild: Any, name: str) -> Role: return role -async def send_response_message(response: InteractionResponse, message: str): +async def send_decaying_response_message(response: InteractionResponse, message: str): await response.send_message(message, ephemeral=True, delete_after=10) -async def last_channel_message(channel: TextChannel) -> Message: +async def last_or_new_channel_message(channel: TextChannel) -> Message: try: message = await channel.fetch_message(channel.last_message_id) except NotFound: diff --git a/src/ui.py b/src/ui.py index 27da6de..6dcd1ce 100644 --- a/src/ui.py +++ b/src/ui.py @@ -120,29 +120,45 @@ class AccountNameInput(Modal, title="Change Nickname"): ## #channels ############################################################################# -channel_request_send="Request send successfully" +channel_request_send = "Request sent successfully" +channel_request_accepted = ( + lambda channel: f"Your channel request for {channel} was accepted." +) + -channels_embed_description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vehicula pulvinar urna quis hendrerit. In hendrerit odio ac molestie sagittis. In fermentum nulla ac fringilla finibus. Fusce non mi porta, cursus urna id, tempor nibh. Morbi vitae turpis iaculis, imperdiet ex vitae, rhoncus ex. Phasellus congue odio eget pellentesque sagittis. Donec metus enim, molestie sit amet rutrum quis, vehicula eget diam." +channels_embed_description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vehicula pulvinar urna quis hendrerit. In hendrerit odio ac molestie sagittis. In fermentum nulla ac fringilla finibus. Fusce non mi porta, cursus urna id, tempor nibh. Morbi vitae turpis iaculis, imperdiet ex vitae, rhoncus ex. Phasellus congue odio eget pellentesque sagittis. Donec metus enim, molestie sit amet rutrum quis, vehicula eget diam." -class ChannelRequestInput(Modal, title="Request a Text Channel"): +class ChannelRequestInput(Modal, title="Text Channel Request"): name_of_lecture = TextInput(label="Name of Lecture", placeholder="eg. SAT-Solving") - kind_of_lecture = TextInput(label="Kind of Lecture", placeholder="Lecture / Seminar / BOK / Lab / ...") - name_of_channel = TextInput(label="Suggested Name of Channel", placeholder="eg. SAT-Solving", required=False) + kind_of_lecture = TextInput( + label="Kind of Event", placeholder="Lecture / Seminar / BOK / Lab / ..." + ) + name_of_channel = TextInput( + label="Suggested Name of Channel", placeholder="eg. SAT-Solving", required=False + ) -class OffTopicChannelRequestInput(Modal, title="Request an offtopic Channel"): + +class OffTopicChannelRequestInput(Modal, title="Offtopic Channel Request"): name_of_channel = TextInput(label="Name of Channel", placeholder="Volleyball") - description = TextInput(label="Description", placeholder="A Channel to find people for playing volleyball") + description = TextInput( + label="Description", + placeholder="A Channel to find people for playing volleyball", + ) channels_request_button = Button(label="Request", style=ButtonStyle.danger) offtopic_request_button = Button(label="Offtopic", style=ButtonStyle.blurple) -channel_view = lambda: (View(timeout=None).add_item(channels_request_button).add_item(offtopic_request_button)) +channel_view = lambda: ( + View(timeout=None) + .add_item(channels_request_button) + .add_item(offtopic_request_button) +) channel_embed = Embed( type="rich", - title="Request a text channel", + title="Request a Text Channel", colour=Colour.blurple(), timestamp=datetime.now(), description=channels_embed_description, @@ -152,121 +168,185 @@ class OffTopicChannelRequestInput(Modal, title="Request an offtopic Channel"): ## #accept channels ############################################################################# -accept_channel_send="Accepted channel Request Successfully" -decline_channel_send="Declined channel Request Successfully" +accept_channel_send = "Accepted channel request successfully" +decline_channel_send = "Declined channel request successfully" + +accept_channel_request_send = "Request submitted successfully" -accept_channel_request_send="Requested successfully" -class ChannelRequestAcceptInput(Modal, title="Requested Text Channel"): +class ChannelRequestAcceptInput(Modal, title="Accept Text Channel Request"): name_of_lecture = TextInput(label="Name of Lecture") kind_of_lecture = TextInput(label="Kind of Lecture") name_of_channel = TextInput(label="Name of Channel") -class ChannelRequestDeclineInput(Modal, title="Declined Text Channel"): - declined_massage = TextInput(label="Declined because") +class ChannelRequestDeclineInput(Modal, title="Decline Text Channel Request"): + declined_massage = TextInput(label="Reason") -def create_channel_request_accept_embed(input: ChannelRequestInput, interaction: Interaction, on_accept: Callable[[ChannelRequestAcceptInput, Interaction], None], on_decline: Callable[[ChannelRequestDeclineInput, Interaction], None]) -> tuple[View, Embed]: +def create_channel_request_accept_embed( + input: ChannelRequestInput, + interaction: Interaction, + on_accept: Callable[[ChannelRequestAcceptInput, Interaction], None], + on_decline: Callable[[ChannelRequestDeclineInput, Interaction], None], +) -> tuple[View, Embed]: async def channel_request_accept_modal(modal_interaction: Interaction): channel_request_accept_input = ChannelRequestAcceptInput() - channel_request_accept_input.name_of_channel.default=input.name_of_channel.value - channel_request_accept_input.kind_of_lecture.default=input.kind_of_lecture.value - channel_request_accept_input.name_of_lecture.default=input.name_of_lecture.value + channel_request_accept_input.name_of_channel.default = ( + input.name_of_channel.value + ) + channel_request_accept_input.kind_of_lecture.default = ( + input.kind_of_lecture.value + ) + channel_request_accept_input.name_of_lecture.default = ( + input.name_of_lecture.value + ) - channel_request_accept_input.on_submit = MethodType(on_accept, channel_request_accept_input) + channel_request_accept_input.on_submit = MethodType( + on_accept, channel_request_accept_input + ) await modal_interaction.response.send_modal(channel_request_accept_input) - + async def channel_request_decline_modal(modal_interaction: Interaction): channel_request_decline_input = ChannelRequestDeclineInput() - channel_request_decline_input.declined_massage.default=f"Der Kanal zu {input.name_of_lecture.value} existiert bereits. Um den Kanal anzeigen zu lassen gehe zu 'Kanäle durchstöbern' -> 'channels' -> 'Anzeigen'." + channel_request_decline_input.declined_massage.default = ( + f"The channel '{input.name_of_channel.value}' already exists. [..]" + ) - channel_request_decline_input.on_submit = MethodType(on_decline, channel_request_decline_input) + channel_request_decline_input.on_submit = MethodType( + on_decline, channel_request_decline_input + ) await modal_interaction.response.send_modal(channel_request_decline_input) - accept_channel_request_button = Button(label="Accept", style=ButtonStyle.green) decline_channel_request_button = Button(label="Decline", style=ButtonStyle.danger) accept_channel_request_button.callback = channel_request_accept_modal decline_channel_request_button.callback = channel_request_decline_modal - accept_channel_request_view = (View(timeout=None) - .add_item(accept_channel_request_button) - .add_item(decline_channel_request_button)) + accept_channel_request_view = ( + View(timeout=None) + .add_item(accept_channel_request_button) + .add_item(decline_channel_request_button) + ) accept_channel_request_embed = Embed( type="rich", - title="Request a text channel", + title="Text Channel Request", colour=Colour.blurple(), timestamp=datetime.now(), - description=f"Requesting a Channel:\n\tName of the Lecture:\t{input.name_of_lecture.value}\n\tKind of Lecture:\t{input.kind_of_lecture.value}\n\tName of Channel:\t{input.name_of_channel.value}" ) - - accept_channel_request_embed.set_author(name=interaction.user.nick, icon_url=interaction.user.avatar.url) + accept_channel_request_embed.add_field( + "Name of Lecture", input.name_of_lecture.value + ) + accept_channel_request_embed.add_field( + "Kind of Lecture", input.kind_of_lecture.value + ) + accept_channel_request_embed.add_field( + "Name of Channel", input.name_of_channel.value + ) + accept_channel_request_embed.set_author( + name=interaction.user.nick, icon_url=interaction.user.avatar.url + ) return accept_channel_request_view, accept_channel_request_embed + # offtopic channel request ############################################################################# -accept_offtopic_channel_send="Accepted offtopic channel Request Successfully" -decline_offtopic_channel_send="Declined offtopic channel Request Successfully" +accept_offtopic_channel_send = "Accepted offtopic channel request successfully" +decline_offtopic_channel_send = "Declined offtopic channel request Successfully" -accept_channel_request_send="Requested successfully" +accept_channel_request_send = "Request sent successfully" -class OffTopicChannelRequestAcceptInput(Modal, title="Accept an offtopic Channel"): +class OffTopicChannelRequestAcceptInput(Modal, title="Accept Offtopic Channel Request"): name_of_channel = TextInput(label="Name of Channel") description = TextInput(label="Description") -class OffTopicChannelRequestDeclineInput(Modal, title="Decline an offtopic Channel"): - declined_massage = TextInput(label="Declined because") +class OffTopicChannelRequestDeclineInput(Modal, title="Decline Offtopic Channel Request"): + declined_massage = TextInput(label="Reason") -def create_offtopic_channel_request_accept_embed(input: OffTopicChannelRequestInput, interaction: Interaction, on_accept: Callable[[ChannelRequestAcceptInput, Interaction], None], on_decline: Callable[[ChannelRequestDeclineInput, Interaction], None]) -> tuple[View, Embed]: +def create_offtopic_channel_request_accept_embed( + input: OffTopicChannelRequestInput, + interaction: Interaction, + on_accept: Callable[[ChannelRequestAcceptInput, Interaction], None], + on_decline: Callable[[ChannelRequestDeclineInput, Interaction], None], +) -> tuple[View, Embed]: async def offtopic_channel_request_accept_modal(modal_interaction: Interaction): offtopic_channel_request_accept_input = OffTopicChannelRequestAcceptInput() - offtopic_channel_request_accept_input.name_of_channel.default=input.name_of_channel.value - offtopic_channel_request_accept_input.description.default=input.description.value + offtopic_channel_request_accept_input.name_of_channel.default = ( + input.name_of_channel.value + ) + offtopic_channel_request_accept_input.description.default = ( + input.description.value + ) - offtopic_channel_request_accept_input.on_submit = MethodType(on_accept, offtopic_channel_request_accept_input) + offtopic_channel_request_accept_input.on_submit = MethodType( + on_accept, offtopic_channel_request_accept_input + ) + + await modal_interaction.response.send_modal( + offtopic_channel_request_accept_input + ) - await modal_interaction.response.send_modal(offtopic_channel_request_accept_input) - async def offtopic_channel_request_decline_modal(modal_interaction: Interaction): offtopic_channel_request_decline_input = OffTopicChannelRequestDeclineInput() - offtopic_channel_request_decline_input.declined_massage.default=f"The channel '{input.name_of_channel.value}' already exists." - - offtopic_channel_request_decline_input.on_submit = MethodType(on_decline, offtopic_channel_request_decline_input) + offtopic_channel_request_decline_input.declined_massage.default = ( + f"The channel '{input.name_of_channel.value}' already exists. [..]" + ) - await modal_interaction.response.send_modal(offtopic_channel_request_decline_input) + offtopic_channel_request_decline_input.on_submit = MethodType( + on_decline, offtopic_channel_request_decline_input + ) + await modal_interaction.response.send_modal( + offtopic_channel_request_decline_input + ) - accept_offtopic_channel_request_button = Button(label="Accept", style=ButtonStyle.green) - decline_offtopic_channel_request_button = Button(label="Decline", style=ButtonStyle.danger) + accept_offtopic_channel_request_button = Button( + label="Accept", style=ButtonStyle.green + ) + decline_offtopic_channel_request_button = Button( + label="Decline", style=ButtonStyle.danger + ) - accept_offtopic_channel_request_button.callback = offtopic_channel_request_accept_modal - decline_offtopic_channel_request_button.callback = offtopic_channel_request_decline_modal + accept_offtopic_channel_request_button.callback = ( + offtopic_channel_request_accept_modal + ) + decline_offtopic_channel_request_button.callback = ( + offtopic_channel_request_decline_modal + ) - accept_offtopic_channel_request_view = (View(timeout=None) - .add_item(accept_offtopic_channel_request_button) - .add_item(decline_offtopic_channel_request_button)) + accept_offtopic_channel_request_view = ( + View(timeout=None) + .add_item(accept_offtopic_channel_request_button) + .add_item(decline_offtopic_channel_request_button) + ) accept_offtopic_channel_request_embed = Embed( type="rich", - title="Request an offtopic channel", + title="Offtopic Channel Request", colour=Colour.blurple(), timestamp=datetime.now(), - description=f"Requesting an offtopic Channel:\n\tName of the Channel:\t{input.name_of_channel.value}\n\tDescription:\t{input.description.value}" + ) + accept_offtopic_channel_request_embed.add_field( + "Name of Channel", input.name_of_channel.value + ) + accept_offtopic_channel_request_embed.add_field( + "Description", input.description.value ) - accept_offtopic_channel_request_embed.set_author(name=interaction.user.nick, icon_url=interaction.user.avatar.url) + accept_offtopic_channel_request_embed.set_author( + name=interaction.user.nick, icon_url=interaction.user.avatar.url + ) return accept_offtopic_channel_request_view, accept_offtopic_channel_request_embed