diff --git a/db.py b/db.py
index a5627e05..3b9742a5 100644
--- a/db.py
+++ b/db.py
@@ -7,7 +7,7 @@ from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy import Column, BigInteger, Integer, String, DateTime, ForeignKey, Float, Enum, create_engine, \
- UniqueConstraint, PrimaryKeyConstraint, Boolean, LargeBinary, Text, Date
+ UniqueConstraint, PrimaryKeyConstraint, Boolean, LargeBinary, Text, Date, func
import requests
from errors import NotFoundError, AlreadyExistingError, PrivateError
import re
diff --git a/templates/minis/halloween.html b/templates/minis/halloween.html
index 66e4dcd4..d3a85320 100644
--- a/templates/minis/halloween.html
+++ b/templates/minis/halloween.html
@@ -4,7 +4,7 @@
{{ record.royal.username }}
- Lune ottenute
+ Lune ottenute ad Halloween 2018
{% for index in range(7) %}
diff --git a/webserver.py b/webserver.py
index 18ac86d3..a77e5a54 100644
--- a/webserver.py
+++ b/webserver.py
@@ -7,6 +7,7 @@ import bcrypt
import configparser
import markdown2
import datetime
+# noinspection PyPackageRequirements
import telegram
import query_discord_music
import random
@@ -187,7 +188,8 @@ def page_editprofile():
profile_data.royal.fiorygi += 1
try:
telegram_bot.send_message(config["Telegram"]["main_group"],
- f'⭐️ {profile_data.royal.username} ha configurato la sua bio su Royalnet e ha ottenuto un fioryg!',
+ f'⭐️ {profile_data.royal.username} ha configurato la sua bio su Royalnet'
+ f' e ha ottenuto un fioryg!',
parse_mode="HTML", disable_web_page_preview=True, disable_notification=True)
except Exception:
pass
@@ -236,7 +238,7 @@ def page_game(name: str):
elif name == "discord":
game_name = "Discord"
query = [dict(row) for row in db_session.execute(query_discord_music.all_query)]
- elif name == "halloween":
+ elif name == "halloween2018":
game_name = "Rituale di Halloween"
query = db_session.query(db.Halloween).all()
else:
@@ -267,12 +269,17 @@ def page_wiki(key: str):
# Embed YouTube videos
converted_md = markdown2.markdown(wiki_page.content.replace("<", "<"),
extras=["spoiler", "tables", "smarty-pants", "fenced-code-blocks"])
- converted_md = re.sub(r"{https?:\/\/(?:www\.)?(?:youtube\.com\/watch\?.*?&?v=|youtu.be\/)([0-9A-Za-z-]+).*?}",
- r'
'
- r' '
- r'
', converted_md)
- converted_md = re.sub(r"{https?:\/\/clyp.it\/([a-z0-9]+)}",
+ converted_md = re.sub(r"{https?://(?:www\.)?(?:youtube\.com/watch\?.*?&?v=|youtu.be/)([0-9A-Za-z-]+).*?}",
+ r'
'
+ r' '
+ r'
', converted_md)
+ converted_md = re.sub(r"{https?://clyp.it/([a-z0-9]+)}",
r'
'
r'
'
@@ -309,14 +316,15 @@ def page_wiki(key: str):
new_log = db.WikiLog(editor=user, edited_key=key, timestamp=datetime.datetime.now(), reason=edit_reason)
db_session.add(new_log)
db_session.commit()
+ message = f'ℹ️ La pagina wiki
{key} è stata' \
+ f' modificata da' \
+ f'
{user.username}' \
+ f' {"(" + edit_reason + ")" if edit_reason else ""}' \
+ f' [{"+" if difference > 0 else ""}{difference}]\n'
+ if fioryg_roll > fioryg_chance:
+ message += f"⭐️ {user.username} è stato premiato con 1 fioryg per la modifica!"
try:
- telegram_bot.send_message(config["Telegram"]["main_group"],
- f'ℹ️ La pagina wiki
{key} è stata'
- f' modificata da'
- f'
{user.username}'
- f' {"(" + edit_reason + ")" if edit_reason else ""}'
- f' [{"+" if difference > 0 else ""}{difference}]\n'
- f' {user.username + " è stato premiato con 1 fioryg!" if fioryg_roll > fioryg_chance else ""}',
+ telegram_bot.send_message(config["Telegram"]["main_group"], message,
parse_mode="HTML", disable_web_page_preview=True, disable_notification=True)
except Exception:
pass
@@ -416,7 +424,8 @@ def hooks_github():
message = f"🐙 Nuovi aggiornamenti a Royalnet:\n"
for commit in j.get("commits", []):
if commit["distinct"]:
- message += f'
{commit["message"]} di
{commit["author"].get("username", "anonimo")}\n'
+ message += f'
{commit["message"]}' \
+ f' di
{commit["author"].get("username", "anonimo")}\n'
telegram_bot.send_message(config["Telegram"]["main_group"], message,
parse_mode="HTML", disable_web_page_preview=True, disable_notification=True)
return "Done."