Skip to content

Commit

Permalink
Format event description
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Nov 26, 2024
1 parent 435596e commit 75be26a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions genshin/models/genshin/chronicle/act_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import datetime
import typing

import pydantic

from genshin.models.model import Aliased, APIModel

__all__ = (
Expand Down Expand Up @@ -143,6 +145,10 @@ class Event(APIModel):
abyss_detail: typing.Optional[AbyssDetail] = Aliased("tower_detail", default=None)
theater_detail: typing.Optional[TheaterDetail] = Aliased("theater_detail", default=None)

@pydantic.field_validator("description", mode="after")
def __format_description(cls, v: str) -> str:
return v.replace("\\n", "\n")


class GenshinEventCalendar(APIModel):
"""Genshin event calendar."""
Expand Down
4 changes: 4 additions & 0 deletions genshin/models/starrail/chronicle/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ def __validate_status(cls, v: str) -> typing.Union[HSREventStatus, str]:
except ValueError:
return v

@pydantic.field_validator("description", mode="after")
def __format_description(cls, v: str) -> str:
return v.replace("\\n", "\n")


class HSRChallenge(HSRBaseEvent):
"""HSR challenge model."""
Expand Down

0 comments on commit 75be26a

Please sign in to comment.