Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build requirements #54

Merged
merged 7 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
TOKEN=
DEBUG=
1 change: 0 additions & 1 deletion .github/deploy/production.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ job "blockbot" {
template {
data = <<EOF
TOKEN={{ key "blockbot/discord/token" }}
DEBUG=false
EOF
destination = "local/.env"
env = true
Expand Down
2 changes: 1 addition & 1 deletion .github/deploy/review.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ job "blockbot-[[.environment_slug]]" {
template {
data = <<EOF
TOKEN={{ key "blockbot-dev/discord/token" }}
DEBUG=false
DEBUG=true
EOF
destination = "local/.env"
env = true
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.7.3
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- id: ruff-format
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM python:3.10.13-alpine3.18
FROM python:3.12.7-alpine3.20

WORKDIR /app

COPY requirements.txt ./
COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ Blockbot is a Discord bot, written in Python, that is maintained by the [Redbric
## Documentation

Development documentation is hosted on the [Redbrick docs](https://docs.redbrick.dcu.ie/webgroup/blockbot/).

9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tool.ruff]
target-version = "py312"

[tool.ruff.format]
docstring-code-format = true
line-ending = "lf"

[tool.ruff.lint.pydocstyle]
convention = "numpy"
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fortune-python==1.1.1
hikari==2.1.0
hikari-arc==1.3.4
hikari-miru==4.1.1
python-dotenv==1.0.1
hikari-arc==1.4.0
hikari-miru==4.2.0
pyfiglet==1.0.2
fortune-python==1.1.1
python-dotenv==1.0.1
4 changes: 2 additions & 2 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ruff==0.6.9
pre-commit==4.0.0
ruff==0.7.3
pre-commit==4.0.1
4 changes: 3 additions & 1 deletion src/examples/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ async def hello(ctx: arc.GatewayContext) -> None:
await ctx.respond("Hello from hikari and hikari-arc!")


group = plugin.include_slash_group("base_group", "A base command group, with sub groups and sub commands.")
group = plugin.include_slash_group(
"base_group", "A base command group, with sub groups and sub commands."
)


@group.include
Expand Down
25 changes: 20 additions & 5 deletions src/examples/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,20 @@ async def click_button(self, ctx: miru.ViewContext, button: miru.Button) -> None
max_values=3,
options=[
miru.SelectOption(label=colour)
for colour in ["Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"]
for colour in [
"Red",
"Orange",
"Yellow",
"Green",
"Blue",
"Indigo",
"Violet",
]
],
)
async def colour_select(self, ctx: miru.ViewContext, select: miru.TextSelect) -> None:
async def colour_select(
self, ctx: miru.ViewContext, select: miru.TextSelect
) -> None:
await ctx.respond(f"Your favourite colours are: {', '.join(select.values)}!")

# Defining a custom view check: https://miru.hypergonial.com/guides/checks_timeout/#checks
Expand All @@ -35,7 +45,9 @@ async def view_check(self, ctx: miru.ViewContext) -> bool:
# user who originally ran the command.
# For every other user they will receive an error message.
if ctx.user.id != self.user_id:
await ctx.respond("You can't press this!", flags=hikari.MessageFlag.EPHEMERAL)
await ctx.respond(
"You can't press this!", flags=hikari.MessageFlag.EPHEMERAL
)
return False

return True
Expand All @@ -44,7 +56,8 @@ async def view_check(self, ctx: miru.ViewContext) -> bool:
# Editing view items: https://miru.hypergonial.com/guides/editing_items/
async def on_timeout(self) -> None:
message = self.message
assert message # Since the view is bound to a message, we can assert it's not None
# Since the view is bound to a message, we can assert it's not None
assert message

for item in self.children:
item.disabled = True
Expand All @@ -55,7 +68,9 @@ async def on_timeout(self) -> None:

@plugin.include
@arc.slash_command("components", "A command with components.")
async def components_cmd(ctx: arc.GatewayContext, miru_client: miru.Client = arc.inject()) -> None:
async def components_cmd(
ctx: arc.GatewayContext, miru_client: miru.Client = arc.inject()
) -> None:
view = View(ctx.user.id)
response = await ctx.respond("Here are some components...", components=view)

Expand Down
4 changes: 3 additions & 1 deletion src/examples/modals.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ async def callback(self, ctx: miru.ModalContext) -> None:

@plugin.include
@arc.slash_command("modal", "A command with a modal response.")
async def modal_command(ctx: arc.GatewayContext, miru_client: miru.Client = arc.inject()) -> None:
async def modal_command(
ctx: arc.GatewayContext, miru_client: miru.Client = arc.inject()
) -> None:
modal = MyModal()
builder = modal.build_response(miru_client)

Expand Down
24 changes: 19 additions & 5 deletions src/examples/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,33 @@
async def options(
ctx: arc.GatewayContext,
str_option: arc.Option[str, arc.StrParams("A string option.", name="string")],
int_option: arc.Option[int, arc.IntParams("An integer option.", name="integer", min=5, max=150)],
attachment_option: arc.Option[hikari.Attachment, arc.AttachmentParams("An attachment option.", name="attachment")],
int_option: arc.Option[
int, arc.IntParams("An integer option.", name="integer", min=5, max=150)
],
attachment_option: arc.Option[
hikari.Attachment,
arc.AttachmentParams("An attachment option.", name="attachment"),
],
channel_option: arc.Option[
hikari.TextableChannel | None, arc.ChannelParams("A textable channel option.", name="channel")
hikari.TextableChannel | None,
arc.ChannelParams("A textable channel option.", name="channel"),
] = None,
) -> None:
"""A command with lots of options."""
embed = hikari.Embed(title="There are a lot of options here", description="Maybe too many...", colour=0x5865F2)
embed = hikari.Embed(
title="There are a lot of options here",
description="Maybe too many...",
colour=0x5865F2,
)
embed.set_image(attachment_option)

embed.add_field("String option", str_option, inline=True)
embed.add_field("Integer option", str(int_option), inline=True)
embed.add_field("Channel option", f"<#{channel_option.id}>" if channel_option else "Not supplied", inline=True)
embed.add_field(
"Channel option",
f"<#{channel_option.id}>" if channel_option else "Not supplied",
inline=True,
)

await ctx.respond(embed=embed)

Expand Down