Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
lgc2333 committed Sep 5, 2023
1 parent cdb8200 commit 3f45471
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions nonebot_plugin_pjsk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ConfigModel(BaseModel):
"https://raw.githubusercontent.com/Agnes4m/nonebot_plugin_pjsk/main/",
]

pjsk_emoji_source: EmojiSource = EmojiSource.Apple
pjsk_emoji_source: str = "Apple"
pjsk_help_as_image: bool = True
pjsk_reply: bool = True
pjsk_sticker_format: str = "PNG"
Expand All @@ -44,9 +44,13 @@ def check(url: str) -> str:
@validator("pjsk_emoji_source", pre=True)
def check_emoji_source(cls, v): # noqa: N805
try:
return getattr(EmojiSource, v)
getattr(EmojiSource, v)
except AttributeError as e:
raise ValueError("Invalid emoji source") from e
return v

def get_emoji_source(self) -> EmojiSource:
return getattr(EmojiSource, self.pjsk_emoji_source)


config: ConfigModel = ConfigModel.parse_obj(get_driver().config.dict())
2 changes: 1 addition & 1 deletion nonebot_plugin_pjsk/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def ensure_font() -> Font:
if not FONT:
FONT = Font(
str(FONT_PATH),
emoji_options=EmojiOptions(source=config.pjsk_emoji_source),
emoji_options=EmojiOptions(source=config.get_emoji_source()),
)
return FONT

Expand Down

0 comments on commit 3f45471

Please sign in to comment.