13 Commits

Author SHA1 Message Date
Paillat
e886d494d9 ⬆️ Update py-cord dependency to paillcord version 2.7.0a3 (#28) 2025-07-21 19:39:34 +02:00
Paillat
ec1efb1fb4 Revert "⬆️ Upgrade Python to ==3.13.* (#21)" (#26) 2025-06-18 10:39:44 +02:00
renovate[bot]
ed5ff75af6 ⬆️ Upgrade Python to ==3.13.* (#21)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Paillat <paillat@pycord.dev>
2025-06-18 10:35:31 +02:00
renovate[bot]
844e557fc9 ⬆️ Upgrade hashicorp/setup-copywrite digest to 32f9f1c (#25)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-18 10:34:19 +02:00
Paillat
99a516b0f0 📝 Remove pre-release from README.md (#23) 2025-05-27 19:56:45 +02:00
pre-commit-ci[bot]
c356d0f74d 👷 pre-commit autoupdate (#19)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Paillat <me@paillat.dev>
2025-05-27 19:53:20 +02:00
renovate[bot]
8394b56afe ⬆️ Upgrade astral-sh/setup-uv action to v6 (#20)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-25 00:40:48 +02:00
e971ba5f19 ⬆️ Update py-cord dependency to allow for newer versions (#18) 2025-04-17 00:52:16 +02:00
fd45c0305e 📌 Update py-cord dependency to allow for newer versions (#17) 2025-04-17 00:40:12 +02:00
pre-commit-ci[bot]
57c6a3c4cd 👷 pre-commit autoupdate (#3)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Paillat <me@paillat.dev>
2025-04-15 22:04:51 +02:00
renovate[bot]
013e4aba14 ⬆️: migrate renovate config (#15)
* ⬆️: migrate config renovate.json

* 🎨 auto fixes from pre-commit.com hooks

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-03-24 17:14:14 +01:00
124ce383bb Disable uvicorn server_header (#14) 2025-03-17 08:28:17 +01:00
5827a2e98a Add path_prefix parameter to constructor for customizable router prefix (#13) 2025-03-13 14:11:59 +01:00
9 changed files with 31 additions and 33 deletions

View File

@@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- name: "Install uv"
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

View File

@@ -11,7 +11,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Copywrite
uses: hashicorp/setup-copywrite@5e3e8a26d7b9f8a508848ad0a069dfd2f7aa5339
uses: hashicorp/setup-copywrite@32f9f1c86f661b8a51100768976a06f1b281a035
- name: Check Header Compliance
run: copywrite headers --plan --config .copywrite.hcl
@@ -38,7 +38,7 @@ jobs:
- uses: actions/checkout@v4
- name: "Install uv"
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

View File

@@ -21,7 +21,7 @@ repos:
exclude: \.(po|pot|yml|yaml)$
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.10
rev: v0.11.11
hooks:
# Run the linter.
- id: ruff

View File

@@ -63,13 +63,9 @@ Built on:
## Installation
```bash
pip install pycord-rest-bot --prerelease=allow
pip install pycord-rest-bot
```
<!-- prettier-ignore -->
> [!NOTE]
> The package is currently in pre-release.
<!-- quick-start -->
## Quick Start

View File

@@ -21,7 +21,7 @@ class MyView(discord.ui.View):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self.add_item(
discord.ui.Button(
discord.ui.Button( # pyright: ignore[reportUnknownArgumentType]
style=discord.ButtonStyle.link, label="GitHub", url="https://github.com/Paillat-dev/pycord-rest"
)
)

View File

@@ -24,7 +24,7 @@ keywords = ["discord", "bot", "rest", "pycord"]
dependencies = [
"fastapi>=0.115.11",
"orjson>=3.10.15",
"py-cord==2.6.1",
"paillcord>=2.7.0a3",
"pynacl>=1.5.0",
"uvicorn>=0.34.0",
]

View File

@@ -8,12 +8,12 @@
"commitMessageAction": "Upgrade",
"packageRules": [
{
"updateTypes": ["pin"],
"matchUpdateTypes": ["pin"],
"commitMessagePrefix": "📌",
"commitMessageAction": "Pin"
},
{
"updateTypes": ["rollback"],
"matchUpdateTypes": ["rollback"],
"commitMessagePrefix": "⬇️",
"commitMessageAction": "Downgrade"
},

View File

@@ -57,10 +57,10 @@ class App(discord.Bot):
_FastAPI: type[FastAPI] = FastAPI
_APIRouter: type[APIRouter] = APIRouter
def __init__(self, *args: Any, **options: Any) -> None: # pyright: ignore [reportExplicitAny]
def __init__(self, *args: Any, path_prefix: str = "", **options: Any) -> None: # pyright: ignore [reportExplicitAny]
super().__init__(*args, **options) # pyright: ignore [reportUnknownMemberType]
self._app: FastAPI = self._FastAPI(openapi_url=None, docs_url=None, redoc_url=None)
self.router: APIRouter = self._APIRouter()
self.router: APIRouter = self._APIRouter(prefix=path_prefix)
self._public_key: str | None = None
@property
@@ -80,13 +80,13 @@ class App(discord.Bot):
self._connection._view_store._ViewStore__verify_integrity() # noqa: SLF001 # pyright: ignore [reportUnknownMemberType, reportAttributeAccessIssue, reportPrivateUsage]
message_id: int | None = interaction.message and interaction.message.id
key = (component_type, message_id, custom_id)
value = self._connection._view_store._views.get(key) or self._connection._view_store._views.get( # pyright: ignore [reportUnknownVariableType, reportUnknownMemberType, reportPrivateUsage] # noqa: SLF001
value = self._connection._view_store._views.get(key) or self._connection._view_store._views.get( # pyright: ignore [reportPrivateUsage] # noqa: SLF001
(component_type, None, custom_id)
)
if value is None:
return
view, item = value # pyright: ignore [reportUnknownVariableType]
view, item = value
item.refresh_state(interaction)
# Code taken from View._dispatch_item
@@ -96,7 +96,7 @@ class App(discord.Bot):
if interaction.message:
view.message = interaction.message
await view._scheduled_task(item, interaction) # noqa: SLF001 # pyright: ignore [reportPrivateUsage, reportUnknownMemberType]
await view._scheduled_task(item, interaction) # noqa: SLF001 # pyright: ignore [reportPrivateUsage]
async def _verify_request(self, request: Request) -> None:
signature = request.headers["X-Signature-Ed25519"]
@@ -267,6 +267,7 @@ class App(discord.Bot):
self._app.include_router(self.router)
uvicorn_options = uvicorn_options or {}
uvicorn_options["log_level"] = uvicorn_options.get("log_level", logging.root.level)
uvicorn_options["server_header"] = uvicorn_options.get("server_header", False)
config = self._UvicornConfig(self._app, **uvicorn_options)
server = self._UvicornServer(config)
try:

29
uv.lock generated
View File

@@ -260,6 +260,19 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/ed/eb/a85317ee1732d1034b92d56f89f1de4d7bf7904f5c8fb9dcdd5b1c83917f/orjson-3.10.15-cp312-cp312-win_amd64.whl", hash = "sha256:ef5b87e7aa9545ddadd2309efe6824bd3dd64ac101c15dae0f2f597911d46eaa", size = 133732 },
]
[[package]]
name = "paillcord"
version = "2.7.0a3"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "aiohttp" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/5f/23/ae29cedaa6822d85b553407f7287fb355cb85ad9fefa10454aee11b6c256/paillcord-2.7.0a3.tar.gz", hash = "sha256:32e46935a72ef4df1619f551b1464ba21c59db9b524dfe87177c8003510caec1", size = 974819 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/c4/da/da5f56051c68e4b749d7b54a6b27aa27b7968a6a4787ff9b49184a88f717/paillcord-2.7.0a3-py3-none-any.whl", hash = "sha256:76f553b48075ff633b7f6182e6238ff374bb7c55e512c9384dfea7bd546dd609", size = 1117883 },
]
[[package]]
name = "propcache"
version = "0.3.0"
@@ -285,25 +298,13 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/b5/35/6c4c6fc8774a9e3629cd750dc24a7a4fb090a25ccd5c3246d127b70f9e22/propcache-0.3.0-py3-none-any.whl", hash = "sha256:67dda3c7325691c2081510e92c561f465ba61b975f481735aefdfc845d2cd043", size = 12101 },
]
[[package]]
name = "py-cord"
version = "2.6.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "aiohttp" },
]
sdist = { url = "https://files.pythonhosted.org/packages/27/c7/c539d69d5cfa1ea5891d596212f73d619e40c7fc9f02ae906f4147993b94/py_cord-2.6.1.tar.gz", hash = "sha256:36064f225f2c7bbddfe542d5ed581f2a5744f618e039093cf7cd2659a58bc79b", size = 965087 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e7/90/2690ded84e34b15ca2619932a358c1b7dc6d28fe845dfbd01929fc33c9da/py_cord-2.6.1-py3-none-any.whl", hash = "sha256:e3d3b528c5e37b0e0825f5b884cbb9267860976c1e4878e28b55da8fd3af834b", size = 1089154 },
]
[[package]]
name = "pycord-rest-bot"
source = { editable = "." }
dependencies = [
{ name = "fastapi" },
{ name = "orjson" },
{ name = "py-cord" },
{ name = "paillcord" },
{ name = "pynacl" },
{ name = "uvicorn" },
]
@@ -319,7 +320,7 @@ dev = [
requires-dist = [
{ name = "fastapi", specifier = ">=0.115.11" },
{ name = "orjson", specifier = ">=3.10.15" },
{ name = "py-cord", specifier = "==2.6.1" },
{ name = "paillcord", specifier = ">=2.7.0a3" },
{ name = "pynacl", specifier = ">=1.5.0" },
{ name = "uvicorn", specifier = ">=0.34.0" },
]