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

✨ 兼容 Pydantic V2 #34

Merged
merged 3 commits into from
Jun 21, 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
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
Loading