1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Add lol mini, more stuff

This commit is contained in:
Steffo 2018-06-04 22:54:12 +02:00
parent f9626b8826
commit 3bfac377f5
8 changed files with 135 additions and 3 deletions

BIN
static/beaufortlol.woff Normal file

Binary file not shown.

View file

@ -43,7 +43,7 @@ input[type="text"], input[type="password"] {
.game-grid { .game-grid {
display: grid; display: grid;
width: 400px; width: 360px;
height: 100px; height: 100px;
border-radius: 10px; border-radius: 10px;
margin: 4px; margin: 4px;
@ -202,7 +202,7 @@ input[type="text"], input[type="password"] {
padding: 15px; padding: 15px;
border: 3px solid #000000; border: 3px solid #000000;
grid-row-gap: 5px; grid-row-gap: 5px;
grid-template-columns: 20% 80%; grid-template-columns: 25% 75%;
background-image: linear-gradient(to bottom, #440b0b, #631013); background-image: linear-gradient(to bottom, #440b0b, #631013);
color: #ffffff; color: #ffffff;
@ -270,3 +270,63 @@ input[type="text"], input[type="password"] {
} }
} }
} }
.lol {
font-family: "BeaufortLoL", "Times New Roman", serif;
padding: 15px;
color: #c9aa71;
border: 3px solid #463714;
background-color: #010a13;
grid-row-gap: 5px;
.player {
grid-row: 1;
grid-column-start: 1;
grid-column-end: 4;
font-size: large;
a {
text-decoration: none;
}
.player-image {
width: 32px;
height: 32px;
vertical-align: middle;
border-radius: 16px;
}
}
.level {
grid-column: 1;
font-size: x-large;
}
.soloq {
grid-column: 2;
}
.flexq {
grid-column: 3;
}
.twtrq {
grid-column: 4;
}
.title {
grid-row: 2;
font-size: x-small;
text-align: center;
}
.value {
grid-row: 3;
text-align: center;
margin: auto;
}
.rank {
height: 40px;
}
}

View file

@ -391,6 +391,18 @@ def cmd_ship(bot: Bot, update: Update):
f" {mixed.capitalize()}") f" {mixed.capitalize()}")
def cmd_profile(bot: Bot, update: Update):
session = db.Session()
user = session.query(db.Telegram).filter_by(telegram_id=update.message.from_user.id).join(db.Royal).one_or_none()
session.close()
if user is None:
bot.send_message(update.message.chat.id, "⚠ Non sei connesso a Royalnet!\n"
"Per registrarti, utilizza il comando /register.")
return
bot.send_message(update.message.chat.id, "👤 [Profilo di {user.royals.username}]"
"(https://ryg.steffo.eu/profile/{user.royals.username})")
def process(arg_discord_connection): def process(arg_discord_connection):
print("Telegrambot starting...") print("Telegrambot starting...")
if arg_discord_connection is not None: if arg_discord_connection is not None:
@ -411,6 +423,7 @@ def process(arg_discord_connection):
u.dispatcher.add_handler(CommandHandler("ban", cmd_ban)) u.dispatcher.add_handler(CommandHandler("ban", cmd_ban))
u.dispatcher.add_handler(CommandHandler("eat", cmd_eat)) u.dispatcher.add_handler(CommandHandler("eat", cmd_eat))
u.dispatcher.add_handler(CommandHandler("ship", cmd_ship)) u.dispatcher.add_handler(CommandHandler("ship", cmd_ship))
u.dispatcher.add_handler(CommandHandler("profile", cmd_profile))
u.dispatcher.add_handler(CallbackQueryHandler(on_callback_query)) u.dispatcher.add_handler(CallbackQueryHandler(on_callback_query))
u.bot.send_message(config["Telegram"]["main_group"], u.bot.send_message(config["Telegram"]["main_group"],
f" Royal Bot avviato e pronto a ricevere comandi!\n" f" Royal Bot avviato e pronto a ricevere comandi!\n"

View file

@ -2,6 +2,7 @@
<html lang="it"> <html lang="it">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>{% block pagetitle %}{% endblock %} - Royal Games</title> <title>{% block pagetitle %}{% endblock %} - Royal Games</title>
{% block prehead %}{% endblock %} {% block prehead %}{% endblock %}
<link href="{{ url_for('static', filename='nryg.less') }}" rel="stylesheet/less" type="text/css"> <link href="{{ url_for('static', filename='nryg.less') }}" rel="stylesheet/less" type="text/css">

50
templates/minis/lol.html Normal file
View file

@ -0,0 +1,50 @@
<style>
@font-face {
font-family: "BeaufortLoL";
src: url("{{ url_for('static', filename='beaufortlol.woff') }}") format('woff');
}
</style>
<div class="game-panel">
<div class="game-grid lol">
<div class="player">
<img src="http://avatar.leagueoflegends.com/EUW1/{{ lol.summoner_name }}.png" class="player-image">
<span class="player-name">{{ lol.summoner_name }}</span>
</div>
<div class="title level">
LIVELLO
</div>
<div class="value level">
<span>{{ lol.level }}</span>
</div>
<div class="title soloq">
SOLO/DUO
</div>
<div class="value soloq">
{% if lol.solo_division is none %}
<img src="{{ url_for('static', filename='lol-rank-icons/provisional.png') }}" title="Non classificato" class="rank">
{% else %}
<img src="{{ url_for('static', filename='lol-rank-icons/' + lol.solo_division.name|lower + "_" + lol.solo_rank.name|lower + ".png") }}" class="rank" title="{{ lol.solo_division.name|capitalize }} {{ lol.solo_rank.name }}">
{% endif %}
</div>
<div class="title flexq">
FLEX
</div>
<div class="value flexq">
{% if lol.flex_division is none %}
<img src="{{ url_for('static', filename='lol-rank-icons/provisional.png') }}" title="Non classificato" class="rank">
{% else %}
<img src="{{ url_for('static', filename='lol-rank-icons/' + lol.flex_division.name|lower + "_" + lol.flex_rank.name|lower + ".png") }}" class="rank" title="{{ lol.flex_division.name|capitalize }} {{ lol.flex_rank.name }}">
{% endif %}
</div>
<div class="title twtrq">
3V3
</div>
<div class="value twtrq">
{% if lol.twtr_division is none %}
<img src="{{ url_for('static', filename='lol-rank-icons/provisional.png') }}" title="Non classificato" class="rank">
{% else %}
<img src="{{ url_for('static', filename='lol-rank-icons/' + lol.twtr_division.name|lower + "_" + lol.twtr_rank.name|lower + ".png") }}" class="rank" title="{{ lol.twtr_division.name|capitalize }} {{ lol.twtr_rank.name }}">
{% endif %}
</div>
</div>
</div>

View file

@ -1,3 +1,6 @@
<style>
@import url('https://fonts.googleapis.com/css?family=Exo+2');
</style>
<div class="game-panel"> <div class="game-panel">
<div class="game-grid rl"> <div class="game-grid rl">
<div class="player"> <div class="player">

View file

@ -17,4 +17,7 @@
{% if dota %} {% if dota %}
{% include "minis/dota.html" %} {% include "minis/dota.html" %}
{% endif %} {% endif %}
{% if lol %}
{% include "minis/lol.html" %}
{% endif %}
{% endblock %} {% endblock %}

View file

@ -35,7 +35,9 @@ def page_profile(name: str):
osu = db_session.query(db.Osu).filter_by(royal=user).one_or_none() osu = db_session.query(db.Osu).filter_by(royal=user).one_or_none()
rl = db_session.query(db.RocketLeague).join(db.Steam).filter_by(royal=user).one_or_none() rl = db_session.query(db.RocketLeague).join(db.Steam).filter_by(royal=user).one_or_none()
dota = db_session.query(db.Dota).join(db.Steam).filter_by(royal=user).one_or_none() dota = db_session.query(db.Dota).join(db.Steam).filter_by(royal=user).one_or_none()
return render_template("profile.html", royal=user, osu=osu, rl=rl, dota=dota) lol = db_session.query(db.LeagueOfLegends).filter_by(royal=user).one_or_none()
db_session.close()
return render_template("profile.html", royal=user, osu=osu, rl=rl, dota=dota, lol=lol)
@app.route("/login") @app.route("/login")