Skip to content

Commit

Permalink
Merge branch 'main' into update-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dimoschi committed Apr 8, 2024
2 parents bfa8a53 + 76ce1b1 commit fef9b43
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.2
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG APP_NAME=hackster
ARG PYTHON_VERSION=3.11.2
ARG POETRY_VERSION=1.4.2
ARG POETRY_VERSION=1.8.2

# `python-base` sets up all our shared environment variables
FROM python:${PYTHON_VERSION}-slim as python-base
Expand Down
16 changes: 15 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ authors = [
"0xEmma <[email protected]>"
]
license = "MIT"
package-mode = false

[tool.poetry.dependencies]
python = "^3.11"
Expand Down
18 changes: 10 additions & 8 deletions src/cmds/core/other.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import logging

from discord import ApplicationContext, Embed, Interaction, Message, WebhookMessage, slash_command, InputTextStyle
from discord.ui import InputText, Modal
import discord
from discord import ApplicationContext, Embed, 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 +18,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 +38,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 +56,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 +66,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 +79,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 fef9b43

Please sign in to comment.