1 Commits

Author SHA1 Message Date
215146f369 ⬆️ Update py-cord dependency to allow for newer versions 2025-04-17 00:51:11 +02:00
9 changed files with 290 additions and 738 deletions

View File

@@ -9,15 +9,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: pypi environment: pypi
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: "Install uv" - name: "Install uv"
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
- name: "Set up Python" - name: "Set up Python"
uses: actions/setup-python@v6 uses: actions/setup-python@v5
with: with:
python-version-file: "pyproject.toml" python-version-file: "pyproject.toml"

View File

@@ -9,9 +9,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Setup Copywrite - name: Setup Copywrite
uses: hashicorp/setup-copywrite@32f9f1c86f661b8a51100768976a06f1b281a035 uses: hashicorp/setup-copywrite@5e3e8a26d7b9f8a508848ad0a069dfd2f7aa5339
- name: Check Header Compliance - name: Check Header Compliance
run: copywrite headers --plan --config .copywrite.hcl run: copywrite headers --plan --config .copywrite.hcl
@@ -35,15 +35,15 @@ jobs:
name: ${{ matrix.name }} name: ${{ matrix.name }}
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: "Install uv" - name: "Install uv"
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v5
with: with:
enable-cache: true enable-cache: true
- name: "Set up Python" - name: "Set up Python"
uses: actions/setup-python@v6 uses: actions/setup-python@v5
with: with:
python-version-file: "pyproject.toml" python-version-file: "pyproject.toml"

View File

@@ -7,7 +7,7 @@ ci:
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0 rev: v5.0.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
exclude: \.(po|pot|yml|yaml)$ exclude: \.(po|pot|yml|yaml)$
@@ -21,7 +21,7 @@ repos:
exclude: \.(po|pot|yml|yaml)$ exclude: \.(po|pot|yml|yaml)$
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version. # Ruff version.
rev: v0.14.10 rev: v0.11.5
hooks: hooks:
# Run the linter. # Run the linter.
- id: ruff - id: ruff
@@ -29,6 +29,6 @@ repos:
# Run the formatter. # Run the formatter.
- id: ruff-format - id: ruff-format
- repo: https://github.com/bhundven/copywrite # waiting for https://github.com/hashicorp/copywrite/pull/120 to be merged - repo: https://github.com/bhundven/copywrite # waiting for https://github.com/hashicorp/copywrite/pull/120 to be merged
rev: 9d021bf61a094a5eac6ae3084ceed2dda4700a73 rev: 937f17f09c46992447dfa8977bb96eda512588c4
hooks: hooks:
- id: add-headers - id: add-headers

View File

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

View File

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

View File

@@ -10,7 +10,7 @@ authors = [
{ name = "Paillat-dev", email = "me@paillat.dev" } { name = "Paillat-dev", email = "me@paillat.dev" }
] ]
license = "MIT" license = "MIT"
requires-python = ">=3.12, <4.0" requires-python = "==3.12.*"
classifiers = [ classifiers = [
"Development Status :: 3 - Alpha", "Development Status :: 3 - Alpha",
"Intended Audience :: Developers", "Intended Audience :: Developers",
@@ -24,7 +24,7 @@ keywords = ["discord", "bot", "rest", "pycord"]
dependencies = [ dependencies = [
"fastapi>=0.115.11", "fastapi>=0.115.11",
"orjson>=3.10.15", "orjson>=3.10.15",
"py-cord>=2.7.0rc1", "py-cord>=2.6.1",
"pynacl>=1.5.0", "pynacl>=1.5.0",
"uvicorn>=0.34.0", "uvicorn>=0.34.0",
] ]
@@ -98,7 +98,7 @@ reportUnusedCallResult = false
reportAny = false reportAny = false
executionEnvironments = [ executionEnvironments = [
{ root = "src/pycord_rest/_version.py", reportDeprecated = false }, { root = "src/pycord_rest/_version.py", reportDeprecated = false },
{ root = "examples", reportExplicitAny = false, reportUnknownMemberType = false, reportUnusedParameter = false, reportImplicitOverride = false, reportAttributeAccessIssue = false, reportUnknownVariableType = false }, { root = "examples", reportExplicitAny = false, reportUnknownMemberType = false, reportUnusedParameter = false, reportImplicitOverride = false }
] ]
[tool.ruff] [tool.ruff]

View File

@@ -1,13 +1,25 @@
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json", "$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [ "extends": ["config:recommended"],
"local>nicebots-xyz/renovate-config", "baseBranches": ["main"],
":semanticPrefixFixDepsChoreOthers", "labels": ["deps"],
":dependencyDashboard" "ignorePaths": ["requirements.txt"],
], "commitMessagePrefix": "⬆️",
"forkProcessing": "enabled", "commitMessageAction": "Upgrade",
"baseBranchPatterns": ["main"], "packageRules": [
"lockFileMaintenance": { {
"enabled": true "matchUpdateTypes": ["pin"],
} "commitMessagePrefix": "📌",
"commitMessageAction": "Pin"
},
{
"matchUpdateTypes": ["rollback"],
"commitMessagePrefix": "⬇️",
"commitMessageAction": "Downgrade"
},
{
"matchDatasources": ["pypi"],
"addLabels": ["pypi"]
}
]
} }

View File

@@ -1,7 +1,6 @@
# Copyright (c) Paillat-dev # Copyright (c) Paillat-dev
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
import base64
import functools import functools
import logging import logging
import warnings import warnings
@@ -81,23 +80,23 @@ class App(discord.Bot):
self._connection._view_store._ViewStore__verify_integrity() # noqa: SLF001 # pyright: ignore [reportUnknownMemberType, reportAttributeAccessIssue, reportPrivateUsage] self._connection._view_store._ViewStore__verify_integrity() # noqa: SLF001 # pyright: ignore [reportUnknownMemberType, reportAttributeAccessIssue, reportPrivateUsage]
message_id: int | None = interaction.message and interaction.message.id message_id: int | None = interaction.message and interaction.message.id
key = (component_type, message_id, custom_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 [reportPrivateUsage] # noqa: SLF001 value = self._connection._view_store._views.get(key) or self._connection._view_store._views.get( # pyright: ignore [reportUnknownVariableType, reportUnknownMemberType, reportPrivateUsage] # noqa: SLF001
(component_type, None, custom_id) (component_type, None, custom_id)
) )
if value is None: if value is None:
return return
view, item = value view, item = value # pyright: ignore [reportUnknownVariableType]
item.refresh_state(interaction) item.refresh_state(interaction)
# Code taken from View._dispatch_item # Code taken from View._dispatch_item
if view._stopped.done(): # noqa: SLF001 # pyright: ignore [reportPrivateUsage] if view._View__stopped.done(): # noqa: SLF001 # pyright: ignore [reportAttributeAccessIssue, reportUnknownMemberType]
return return
if interaction.message: if interaction.message:
view.message = interaction.message view.message = interaction.message
await view._scheduled_task(item, interaction) # noqa: SLF001 # pyright: ignore [reportPrivateUsage] await view._scheduled_task(item, interaction) # noqa: SLF001 # pyright: ignore [reportPrivateUsage, reportUnknownMemberType]
async def _verify_request(self, request: Request) -> None: async def _verify_request(self, request: Request) -> None:
signature = request.headers["X-Signature-Ed25519"] signature = request.headers["X-Signature-Ed25519"]
@@ -271,7 +270,6 @@ class App(discord.Bot):
uvicorn_options["server_header"] = uvicorn_options.get("server_header", False) uvicorn_options["server_header"] = uvicorn_options.get("server_header", False)
config = self._UvicornConfig(self._app, **uvicorn_options) config = self._UvicornConfig(self._app, **uvicorn_options)
server = self._UvicornServer(config) server = self._UvicornServer(config)
self._connection.application_id = int(base64.b64decode(token.split(".")[0] + "==").decode("utf-8"))
try: try:
self.dispatch("connect") self.dispatch("connect")
await server.serve() await server.serve()

950
uv.lock generated

File diff suppressed because it is too large Load Diff