Skip to content

Commit

Permalink
added invite to messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Timpe Hoerig authored and Timpe Hoerig committed Jul 10, 2023
1 parent 8c9f7aa commit 655a0fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
18 changes: 6 additions & 12 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ async def forward_support_request(
async def on_accept(
accept_interaction: Interaction,
):
await accept_interaction.user.guild.create_voice_channel(
channel = await accept_interaction.user.guild.create_voice_channel(
name=f"{request_interaction.user.nick}'s support",
overwrites={
utils.get(
Expand Down Expand Up @@ -565,19 +565,13 @@ async def on_accept(
)
embed = accept_interaction.message.embeds[0]
embed = embed.set_footer(text=f"Accepted by {accept_interaction.user.nick}")
member_req = utils.get(accept_interaction.guild.members, name=request_interaction.user.name)
member_acc = utils.get(accept_interaction.guild.members, name=accept_interaction.user.name)
if member_acc.is_connected():
await member_acc.move_to(channel)
if member_req.is_connected():
await member_req.move_to(channel)
else:
await request_interaction.user.send(
support_request_accepted(request_interaction.user.nick)
)
invite = channel.create_invite(max_age=120, max_uses=2)
await request_interaction.user.send(
support_request_accepted(request_interaction.user.nick, invite)
)
await accept_interaction.message.edit(embed=embed, view=None)
await send_decaying_response_message(
accept_interaction.response, accept_support_send
accept_interaction.response, accept_support_send(invite)
)

async def on_decline(
Expand Down
6 changes: 3 additions & 3 deletions src/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ async def offtopic_channel_request_decline_modal(modal_interaction: Interaction)

support_request_send = "Request sent successfully"
support_request_accepted = (
lambda nick: f"A moderator is now ready to help you in the {nick}'s support channel."
lambda nick, invite: f"A moderator is now ready to help you in the {nick}'s support channel. {invite}"
)


Expand Down Expand Up @@ -395,8 +395,8 @@ class SupportRequestInput(Modal, title="Support request"):

## #accept support #############################################################################

accept_support_send = "Accepted channel request"
decline_support_send = "Declined channel request"
accept_support_send = lambda invite: f"Accepted support request {invite}"
decline_support_send = "Declined support request"

accept_support_request_send = "Request submitted"

Expand Down

0 comments on commit 655a0fd

Please sign in to comment.