1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Add urls to some things

This commit is contained in:
Steffo 2020-04-11 02:20:47 +02:00
parent b35fa89671
commit badaee2e70
5 changed files with 23 additions and 18 deletions

8
poetry.lock generated
View file

@ -588,7 +588,7 @@ description = "A multipurpose bot and web framework"
name = "royalnet" name = "royalnet"
optional = false optional = false
python-versions = ">=3.8,<4.0" python-versions = ">=3.8,<4.0"
version = "5.7.4" version = "5.7.5"
[package.dependencies] [package.dependencies]
dateparser = ">=0.7.2,<0.8.0" dateparser = ">=0.7.2,<0.8.0"
@ -869,7 +869,7 @@ python-versions = "*"
version = "2020.3.24" version = "2020.3.24"
[metadata] [metadata]
content-hash = "5ac785ed6a80e09159e8535a5ba5f53f8411c7e40185d2d06caf467e87c6936c" content-hash = "06c91734690c9d27a1355db7d6de24bf0601896f7434c99558873f659e075c6a"
python-versions = "^3.8" python-versions = "^3.8"
[metadata.files] [metadata.files]
@ -1310,8 +1310,8 @@ riotwatcher = [
{file = "riotwatcher-2.7.1.tar.gz", hash = "sha256:5349271c7e00637b7619491a6070e66603705db60558ea2a690e7016f6e6d9a4"}, {file = "riotwatcher-2.7.1.tar.gz", hash = "sha256:5349271c7e00637b7619491a6070e66603705db60558ea2a690e7016f6e6d9a4"},
] ]
royalnet = [ royalnet = [
{file = "royalnet-5.7.4-py3-none-any.whl", hash = "sha256:45b43975098bef0319056dff5d46456cea7d5a88611b4a9f28b5eae88e0d99f5"}, {file = "royalnet-5.7.5-py3-none-any.whl", hash = "sha256:d85afa59524482f8fa72f984cb9ec24e5517a0dfd280812097e766073fb98529"},
{file = "royalnet-5.7.4.tar.gz", hash = "sha256:8957d4894c866f0384bfcc94dce7f1f047b1eaaf0ffe0e0ab83d29232493bb53"}, {file = "royalnet-5.7.5.tar.gz", hash = "sha256:785dad6a8b9afaf6517ec30f06441265a3a57acf033e199706f1bc3156cd843a"},
] ]
royalspells = [ royalspells = [
{file = "royalspells-3.2.tar.gz", hash = "sha256:2bd4a9a66514532e35c02c3907425af48c7cb292364c4843c795719a82b25dfe"}, {file = "royalspells-3.2.tar.gz", hash = "sha256:2bd4a9a66514532e35c02c3907425af48c7cb292364c4843c795719a82b25dfe"},

View file

@ -25,7 +25,7 @@
steam = "^0.9.1" steam = "^0.9.1"
[tool.poetry.dependencies.royalnet] [tool.poetry.dependencies.royalnet]
version = "^5.7.4" version = "^5.7.5"
# Maybe... there is a way to make these selectable? # Maybe... there is a way to make these selectable?
extras = [ extras = [
"telegram", "telegram",

View file

@ -33,7 +33,8 @@ class MatchmakingCommand(Command):
# Find all relevant MMEvents and run them # Find all relevant MMEvents and run them
session = self.alchemy.Session() session = self.alchemy.Session()
mmevents = ( mmevents = (
session.query(self.alchemy.get(MMEvent)) session
.query(self.alchemy.get(MMEvent))
.filter(self.alchemy.get(MMEvent).interface == self.interface.name, .filter(self.alchemy.get(MMEvent).interface == self.interface.name,
self.alchemy.get(MMEvent).datetime > datetime.datetime.now()) self.alchemy.get(MMEvent).datetime > datetime.datetime.now())
.all() .all()
@ -71,7 +72,7 @@ class MatchmakingCommand(Command):
data.session.add(mmevent) data.session.add(mmevent)
await data.session_commit() await data.session_commit()
self.loop.create_task(self._run_mmevent(mmevent.mmid)) self.loop.create_task(self._run_mmevent(mmevent.mmid))
await data.reply(f"Evento [b]{mmevent.title}[/b] creato!") await data.reply(f"Matchmaking creato!")
_mmchoice_values = { _mmchoice_values = {
MMChoice.YES: 4, MMChoice.YES: 4,
@ -92,7 +93,8 @@ class MatchmakingCommand(Command):
text += f"{response.choice.value} {response.user}\n" text += f"{response.choice.value} {response.user}\n"
return text return text
def _gen_telegram_keyboard(self, mmevent: MMEvent): @staticmethod
def _gen_telegram_keyboard(mmevent: MMEvent):
if mmevent.datetime <= datetime.datetime.now(): if mmevent.datetime <= datetime.datetime.now():
return None return None
return InKM([ return InKM([
@ -142,18 +144,20 @@ class MatchmakingCommand(Command):
mmresponse.choice = choice mmresponse.choice = choice
await data.session_commit() await data.session_commit()
await self._update_telegram_mm_message(client, mmevent) await self._update_telegram_mm_message(client, mmevent)
await data.reply(f" Messaggio ricevuto!") await data.reply(f"{choice.value} Messaggio ricevuto!")
return callback return callback
def _gen_event_start_message(self, mmevent: MMEvent): @staticmethod
def _gen_event_start_message(mmevent: MMEvent):
text = f"🚩 L'evento [b]{mmevent.title}[/b] è iniziato!\n\n" text = f"🚩 L'evento [b]{mmevent.title}[/b] è iniziato!\n\n"
for response in mmevent.responses: for response in mmevent.responses:
response: MMResponse response: MMResponse
text += f"{response.choice.value} {response.user}\n" text += f"{response.choice.value} {response.user}\n"
return text return text
def _gen_unauth_message(self, user: User): @staticmethod
def _gen_unauth_message(user: User):
return f"⚠️ Non sono autorizzato a mandare messaggi a [b]{user.username}[/b]!\n" \ return f"⚠️ Non sono autorizzato a mandare messaggi a [b]{user.username}[/b]!\n" \
f"{user.telegram.mention()}, apri una chat privata con me e mandami un messaggio!" f"{user.telegram.mention()}, apri una chat privata con me e mandami un messaggio!"

View file

@ -26,7 +26,7 @@ class UserinfoCommand(Command):
user = found user = found
r = [ r = [
f" [b]{user.username}[/b]", f" [url=https://ryg.steffo.eu/#/user/{user.uid}]{user.username}[/url]",
f"{user.role}", f"{user.role}",
"", "",
] ]
@ -53,13 +53,14 @@ class UserinfoCommand(Command):
r.append("") r.append("")
r.append(f"Ha creato [b]{len(user.diario_created)}[/b] righe di diario, e vi compare in" r.append(f"Ha creato [b]{len(user.diario_created)}[/b] righe di "
f"[url=https://ryg.steffo.eu/#/diario]Diario[/url], e vi compare in"
f" [b]{len(user.diario_quoted)}[/b] righe.") f" [b]{len(user.diario_quoted)}[/b] righe.")
r.append("") r.append("")
if user.trivia_score: if user.trivia_score:
r.append(f"Ha [b]{user.trivia_score.score:.0f}[/b] punti trivia, avendo risposto correttamente a" r.append(f"Ha [b]{user.trivia_score.score:.0f}[/b] punti Trivia, avendo risposto correttamente a"
f" [b]{user.trivia_score.correct_answers}[/b] domande su" f" [b]{user.trivia_score.correct_answers}[/b] domande su"
f" [b]{user.trivia_score.total_answers}[/b].") f" [b]{user.trivia_score.total_answers}[/b].")
r.append("") r.append("")

View file

@ -88,7 +88,7 @@ class Diario:
text += f" da {str(self.creator)}" text += f" da {str(self.creator)}"
text += f" il {self.timestamp.strftime('%Y-%m-%d %H:%M')}):\n" text += f" il {self.timestamp.strftime('%Y-%m-%d %H:%M')}):\n"
if self.media_url is not None: if self.media_url is not None:
text += f"{self.media_url}\n" text += f"[url={self.media_url}]Media[/url]\n"
if self.text is not None: if self.text is not None:
if self.spoiler: if self.spoiler:
hidden = re.sub(r"\w", "", self.text) hidden = re.sub(r"\w", "", self.text)