Add new animated banner

pull/1/head
hikariatama 2022-09-20 06:33:49 +00:00
parent 18a83a748d
commit 039acb33db
1 changed files with 11 additions and 2 deletions

View File

@ -103,7 +103,7 @@ class HikkaInfoMod(loader.Module):
), ),
loader.ConfigValue( loader.ConfigValue(
"banner_url", "banner_url",
"https://github.com/hikariatama/assets/raw/master/hikka_banner.png", "https://github.com/hikariatama/assets/raw/master/hikka_banner.mp4",
lambda: self.strings("_cfg_banner"), lambda: self.strings("_cfg_banner"),
validator=loader.validators.Link(), validator=loader.validators.Link(),
), ),
@ -112,6 +112,15 @@ class HikkaInfoMod(loader.Module):
async def client_ready(self): async def client_ready(self):
self._me = await self._client.get_me() self._me = await self._client.get_me()
# Legacy migration
if (
self.config["banner_url"]
== "https://github.com/hikariatama/assets/raw/master/hikka_banner.png"
):
self.config[
"banner_url"
] = "https://github.com/hikariatama/assets/raw/master/hikka_banner.mp4"
def _render_info(self, inline: bool) -> str: def _render_info(self, inline: bool) -> str:
try: try:
repo = git.Repo(search_parent_directories=True) repo = git.Repo(search_parent_directories=True)
@ -212,7 +221,7 @@ class HikkaInfoMod(loader.Module):
if self.config["custom_button"]: if self.config["custom_button"]:
await self.inline.form( await self.inline.form(
message=message, message=message,
text=self._render_info(False), text=self._render_info(True),
reply_markup=self._get_mark(), reply_markup=self._get_mark(),
**( **(
{"photo": self.config["banner_url"]} {"photo": self.config["banner_url"]}