Skip to content

Commit

Permalink
🔖 version 0.13.4
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Feb 4, 2025
1 parent d03ee22 commit 7a5654e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
31 changes: 16 additions & 15 deletions nonebot/adapters/satori/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from pathlib import Path
from datetime import datetime
from typing_extensions import TypeAlias
from typing import IO, Any, Union, Generic, Literal, TypeVar, Optional
from typing import IO, Any, Union, Generic, Literal, TypeVar, ClassVar, Optional

from pydantic import Field, BaseModel
from nonebot.compat import PYDANTIC_V2, ConfigDict, model_dump

from .utils import log
from .compat import field_validator, model_validator


Expand All @@ -26,7 +27,7 @@ class Channel(BaseModel):
parent_id: Optional[str] = None

if PYDANTIC_V2:
model_config: ConfigDict = ConfigDict(extra="allow") # type: ignore
model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") # type: ignore

else:

Expand All @@ -40,7 +41,7 @@ class Guild(BaseModel):
avatar: Optional[str] = None

if PYDANTIC_V2:
model_config: ConfigDict = ConfigDict(extra="allow") # type: ignore
model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") # type: ignore

else:

Expand All @@ -56,7 +57,7 @@ class User(BaseModel):
is_bot: Optional[bool] = None

if PYDANTIC_V2:
model_config: ConfigDict = ConfigDict(extra="allow") # type: ignore
model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") # type: ignore

else:

Expand All @@ -83,7 +84,7 @@ def parse_joined_at(cls, v):
return datetime.fromtimestamp(timestamp / 1000)

if PYDANTIC_V2:
model_config: ConfigDict = ConfigDict(extra="allow") # type: ignore
model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") # type: ignore

else:

Expand All @@ -96,7 +97,7 @@ class Role(BaseModel):
name: Optional[str] = None

if PYDANTIC_V2:
model_config: ConfigDict = ConfigDict(extra="allow") # type: ignore
model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") # type: ignore

else:

Expand Down Expand Up @@ -132,7 +133,7 @@ def identity(self):
return f"{self.platform or 'satori'}:{self.user.id}"

if PYDANTIC_V2:
model_config: ConfigDict = ConfigDict(extra="allow") # type: ignore
model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") # type: ignore
else:

class Config:
Expand Down Expand Up @@ -265,7 +266,7 @@ def parse_updated_at(cls, v):
return datetime.fromtimestamp(timestamp / 1000)

if PYDANTIC_V2:
model_config: ConfigDict = ConfigDict(extra="allow") # type: ignore
model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") # type: ignore

else:

Expand Down Expand Up @@ -307,12 +308,12 @@ def parse_timestamp(cls, v):
def ensure_login(cls, values):
if isinstance(values, dict):
if "self_id" in values and "platform" in values:
# log(
# "WARNING",
# "received event with `self_id` and `platform`, "
# "this may be caused by Satori Server used protocol under version 1.2.",
# )
if "login" not in values:
log(
"WARNING",
"received event with `self_id` and `platform` but without `login`, "
"this may be caused by Satori Server used protocol under version 1.2.",
)
values["login"] = model_dump(
LoginOnline(
sn=0,
Expand All @@ -327,7 +328,7 @@ def ensure_login(cls, values):
return values

if PYDANTIC_V2:
model_config: ConfigDict = ConfigDict(extra="allow") # type: ignore
model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") # type: ignore

else:

Expand Down Expand Up @@ -355,7 +356,7 @@ class PageResult(BaseModel, Generic[T]):
data: list[T]
next: Optional[str] = None

model_config: ConfigDict = ConfigDict(extra="allow") # type: ignore
model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") # type: ignore

class PageDequeResult(PageResult[T]):
prev: Optional[str] = None
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "nonebot-adapter-satori"
version = "0.13.3"
version = "0.13.4"
description = "Satori Protocol Adapter for Nonebot2"
authors = [
{name = "RF-Tar-Railt",email = "[email protected]"},
Expand Down

0 comments on commit 7a5654e

Please sign in to comment.