1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00

Small bugfixes

This commit is contained in:
Steffo 2018-09-12 01:46:00 +02:00
parent 5f60c2eb17
commit 30838a6402
2 changed files with 7 additions and 3 deletions

View file

@ -14,3 +14,4 @@ pygments
markovify markovify
praw praw
dice dice
raven[flask]

View file

@ -8,8 +8,8 @@ import datetime
import telegram import telegram
import query_discord_music import query_discord_music
import random import random
import difflib
import re import re
from raven.contrib.flask import Sentry
app = Flask(__name__) app = Flask(__name__)
@ -23,6 +23,8 @@ app.secret_key = config["Flask"]["secret_key"]
telegram_bot = telegram.Bot(config["Telegram"]["bot_token"]) telegram_bot = telegram.Bot(config["Telegram"]["bot_token"])
sentry = Sentry(app, dsn=config["Sentry"]["token"])
@app.errorhandler(400) @app.errorhandler(400)
def error_400(_=None): def error_400(_=None):
@ -158,7 +160,7 @@ def page_password():
def page_editprofile(): def page_editprofile():
user_id = fl_session.get("user_id") user_id = fl_session.get("user_id")
db_session = db.Session() db_session = db.Session()
profile_data = db_session.query(db.ProfileData).filter_by(royal_id=user_id).one_or_none() profile_data = db_session.query(db.ProfileData).filter_by(royal_id=user_id).join(db.Royal).one_or_none()
if request.method == "GET": if request.method == "GET":
db_session.close() db_session.close()
if user_id is None: if user_id is None:
@ -175,6 +177,7 @@ def page_editprofile():
if profile_data is None: if profile_data is None:
profile_data = db.ProfileData(royal_id=user_id, css=css, bio=bio) profile_data = db.ProfileData(royal_id=user_id, css=css, bio=bio)
db_session.add(profile_data) db_session.add(profile_data)
db_session.flush()
profile_data.royal.fiorygi += 1 profile_data.royal.fiorygi += 1
try: try:
telegram_bot.send_message(config["Telegram"]["main_group"], telegram_bot.send_message(config["Telegram"]["main_group"],