diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a54aaf6..c0aecb7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 diff --git a/Dockerfile.base b/Dockerfile.base index 400af54..83f30fa 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -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 diff --git a/poetry.lock b/poetry.lock index 2cf6154..954b431 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1961,6 +1961,20 @@ files = [ {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] +[[package]] +name = "slack-sdk" +version = "3.27.1" +description = "The Slack API Platform SDK for Python" +optional = false +python-versions = ">=3.6" +files = [ + {file = "slack_sdk-3.27.1-py2.py3-none-any.whl", hash = "sha256:c108e509160cf1324c5c8b1f47ca52fb5e287021b8caf9f4ec78ad737ab7b1d9"}, + {file = "slack_sdk-3.27.1.tar.gz", hash = "sha256:85d86b34d807c26c8bb33c1569ec0985876f06ae4a2692afba765b7a5490d28c"}, +] + +[package.extras] +optional = ["SQLAlchemy (>=1.4,<3)", "aiodns (>1.0)", "aiohttp (>=3.7.3,<4)", "boto3 (<=2)", "websocket-client (>=1,<2)", "websockets (>=10,<11)", "websockets (>=9.1,<10)"] + [[package]] name = "sniffio" version = "1.3.0" @@ -2316,4 +2330,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "fb98e07bafd4f104174f95575025b284ac6eb0ee480d76bf20cba57ae26fb30d" +content-hash = "4c28d106d010cef9d9972ab8f6810c81b495418134b5dcc2753ca541e43823d6" diff --git a/pyproject.toml b/pyproject.toml index 3e8f255..a6cb796 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,7 @@ authors = [ "0xEmma " ] license = "MIT" +package-mode = false [tool.poetry.dependencies] python = "^3.11" diff --git a/src/cmds/core/other.py b/src/cmds/core/other.py index e681ff7..cc59920 100644 --- a/src/cmds/core/other.py +++ b/src/cmds/core/other.py @@ -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__) @@ -18,6 +18,7 @@ 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.") @@ -25,7 +26,7 @@ async def callback(self, interaction: discord.Interaction): 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", @@ -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.""" @@ -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( @@ -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.""" @@ -76,7 +79,7 @@ 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: @@ -84,7 +87,6 @@ async def feedback(self, ctx: ApplicationContext) -> Message: 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."""