Skip to content

Commit

Permalink
✨ 兼容 Pydantic V2 (#34)
Browse files Browse the repository at this point in the history
* 💥 移除 python3.8 支持

* ✨ 兼容 Pydantic V2

* 🚨 auto fix by pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
shoucandanghehe and pre-commit-ci[bot] authored Jun 21, 2024
1 parent 6200e83 commit 1872615
Show file tree
Hide file tree
Showing 15 changed files with 458 additions and 450 deletions.
8 changes: 4 additions & 4 deletions nonebot/adapters/discord/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import contextlib
import json
import sys
from typing import Any, List, Optional, Tuple
from typing import Any, Optional
from typing_extensions import override

from nonebot.adapters import Adapter as BaseAdapter
Expand Down Expand Up @@ -41,7 +41,7 @@ class Adapter(BaseAdapter):
def __init__(self, driver: Driver, **kwargs: Any):
super().__init__(driver, **kwargs)
self.discord_config: Config = get_plugin_config(Config)
self.tasks: List[asyncio.Task] = []
self.tasks: list[asyncio.Task] = []
self.base_url: URL = URL(
f"https://discord.com/api/v{self.discord_config.discord_api_version}",
)
Expand Down Expand Up @@ -151,7 +151,7 @@ async def _forward_ws(
self,
bot_info: BotInfo,
ws_url: URL,
shard: Tuple[int, int],
shard: tuple[int, int],
) -> None:
log("DEBUG", f"Forwarding WebSocket Connection to {escape_tag(str(ws_url))}...")
headers = {"Authorization": self.get_authorization(bot_info)}
Expand Down Expand Up @@ -288,7 +288,7 @@ async def _heartbeat_task(self, ws: WebSocket, bot: Bot, heartbeat_interval: int
await self._heartbeat(ws, bot)
await asyncio.sleep(heartbeat_interval / 1000.0)

async def _authenticate(self, bot: Bot, ws: WebSocket, shard: Tuple[int, int]):
async def _authenticate(self, bot: Bot, ws: WebSocket, shard: tuple[int, int]):
"""鉴权连接"""
if not bot.ready:
payload = type_validate_python(
Expand Down
Loading

0 comments on commit 1872615

Please sign in to comment.