Skip to content

Commit

Permalink
fix syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
dimoschi committed Apr 5, 2024
1 parent 6903721 commit 61eeeef
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/cmds/core/other.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import logging

from discord import ApplicationContext, Embed, Interaction, Message, WebhookMessage, slash_command, InputTextStyle
from discord.ui import InputText, Modal
from discord import ApplicationContext, Embed, InputTextStyle, Interaction, Message, WebhookMessage, slash_command
from discord.ext import commands
from discord.ui import InputText, Modal
from slack_sdk.webhook import WebhookClient

from src.bot import Bot
from src.core import settings

from slack_sdk.webhook import WebhookClient

logger = logging.getLogger(__name__)


Expand All @@ -18,14 +17,15 @@ def __init__(self, *args, **kwargs) -> None:

self.add_item(InputText(label="Title"))
self.add_item(InputText(label="Feedback", style=discord.InputTextStyle.long))

async def callback(self, interaction: discord.Interaction):

await interaction.response.send_message("Thank you, your feedback has been recorded.")

webhook = WebhookClient(settings.slack_webhook)

response = webhook.send(
text=f"{self.children[0].value} - {self.children[1].value}",
text=f"{self.children[0].value} - {self.children[1].value}",
blocks=[
{
"type": "section",
Expand All @@ -37,7 +37,7 @@ async def callback(self, interaction: discord.Interaction):
]
)
assert response.status_code == 200
assert response.body == "ok"`
assert response.body == "ok"

class OtherCog(commands.Cog):
"""Ban related commands."""
Expand All @@ -55,6 +55,7 @@ async def no_hints(
"Once the event is over you are more then welcome to share solutions/write-ups/etc and try them in the "
"After Party event."
)

@slash_command(guild_ids=settings.guild_ids, description="A simple reply proving a link to the support desk article on how to get support")
@commands.cooldown(1, 60, commands.BucketType.user)
async def support(
Expand All @@ -64,6 +65,7 @@ async def support(
return await ctx.respond(
"https://help.hackthebox.com/en/articles/5986762-contacting-htb-support"
)

@slash_command(guild_ids=settings.guild_ids, description="Add the URL which has spoiler link.")
async def spoiler(self, ctx: ApplicationContext, url: str) -> Interaction | WebhookMessage:
"""Add the URL which has spoiler link."""
Expand All @@ -76,15 +78,14 @@ async def spoiler(self, ctx: ApplicationContext, url: str) -> Interaction | Webh
channel = self.bot.get_channel(settings.channels.SPOILER)
await channel.send(embed=embed)
return await ctx.respond("Thanks for the reporting the spoiler.", ephemeral=True, delete_after=15)

@slash_command(guild_ids=settings.guild_ids, description="Provide feedback to HTB!")
@commands.cooldown(1, 60, commands.BucketType.user)
async def feedback(self, ctx: ApplicationContext) -> Message:
""" Provide Feedback to HTB """
modal = FeedbackModal(title="Feedback") # Send the Modal defined above in Feedback Modal, which handles the callback
await ctx.send_modal(modal)



def setup(bot: Bot) -> None:
"""Load the `ChannelManageCog` cog."""
Expand Down

0 comments on commit 61eeeef

Please sign in to comment.