mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-14 18:11:23 +01:00
Remove discordio partnership and repurpose it to custom invite link field
This commit is contained in:
parent
ef7ef65a44
commit
8028813e0f
@ -19,7 +19,7 @@ class Guilds(Base):
|
||||
emojis = db.Column(db.Text().with_variant(db.Text(length=4294967295), 'mysql')) # Guild Emojis
|
||||
owner_id = db.Column(db.String(255)) # Snowflake of the owner
|
||||
icon = db.Column(db.String(255)) # The icon string, null if none
|
||||
discordio = db.Column(db.String(255)) # Custom Discord.io Invite Link
|
||||
invite_link = db.Column(db.String(255)) # Custom Discord Invite Link
|
||||
|
||||
def __init__(self, guild_id, name, roles, channels, webhooks, emojis, owner_id, icon):
|
||||
self.guild_id = guild_id
|
||||
|
@ -0,0 +1,28 @@
|
||||
"""Repurposed discordio column to generic invite_link
|
||||
|
||||
Revision ID: 0b7761d85555
|
||||
Revises: f146d173e028
|
||||
Create Date: 2018-01-13 18:13:51.542372
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0b7761d85555'
|
||||
down_revision = 'f146d173e028'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('guilds', 'discordio', new_column_name='invite_link')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('guilds', 'invite_link', new_column_name='discordio')
|
||||
# ### end Alembic commands ###
|
@ -178,7 +178,7 @@ def administrate_guild(guild_id):
|
||||
"mentions_limit": db_guild.mentions_limit,
|
||||
"unauth_captcha": db_guild.unauth_captcha,
|
||||
"icon": db_guild.icon,
|
||||
"discordio": db_guild.discordio if db_guild.discordio != None else "",
|
||||
"invite_link": db_guild.invite_link if db_guild.invite_link != None else "",
|
||||
"guest_icon": db_guild.guest_icon if db_guild.guest_icon != None else "",
|
||||
}
|
||||
return render_template("administrate_guild.html.j2", guild=dbguild_dict, members=users, permissions=permissions, cosmetics=cosmetics)
|
||||
@ -194,10 +194,10 @@ def update_administrate_guild(guild_id):
|
||||
db_guild.bracket_links = request.form.get("bracket_links", db_guild.bracket_links) in ["true", True]
|
||||
db_guild.mentions_limit = request.form.get("mentions_limit", db_guild.mentions_limit)
|
||||
db_guild.unauth_captcha = request.form.get("unauth_captcha", db_guild.unauth_captcha) in ["true", True]
|
||||
discordio = request.form.get("discordio", db_guild.discordio)
|
||||
if discordio != None and discordio.strip() == "":
|
||||
discordio = None
|
||||
db_guild.discordio = discordio
|
||||
invite_link = request.form.get("invite_link", db_guild.invite_link)
|
||||
if invite_link != None and invite_link.strip() == "":
|
||||
invite_link = None
|
||||
db_guild.invite_link = invite_link
|
||||
guest_icon = request.form.get("guest_icon", db_guild.guest_icon)
|
||||
if guest_icon != None and guest_icon.strip() == "":
|
||||
guest_icon = None
|
||||
@ -213,7 +213,7 @@ def update_administrate_guild(guild_id):
|
||||
chat_links=db_guild.chat_links,
|
||||
bracket_links=db_guild.bracket_links,
|
||||
mentions_limit=db_guild.mentions_limit,
|
||||
discordio=db_guild.discordio,
|
||||
invite_link=db_guild.invite_link,
|
||||
guest_icon=db_guild.guest_icon,
|
||||
unauth_captcha=db_guild.unauth_captcha,
|
||||
)
|
||||
|
@ -6,6 +6,7 @@ from titanembeds.database import db, Guilds, UserCSS, list_disabled_guilds
|
||||
from config import config
|
||||
import random
|
||||
import json
|
||||
from urllib.parse import urlparse
|
||||
|
||||
embed = Blueprint("embed", __name__)
|
||||
|
||||
@ -52,6 +53,12 @@ def parse_css_variable(css):
|
||||
return CSS_VARIABLES_TEMPLATE % variables
|
||||
return None
|
||||
|
||||
def parse_url_domain(url):
|
||||
parsed = urlparse(url)
|
||||
if parsed.netloc != "":
|
||||
return parsed.netloc
|
||||
return url
|
||||
|
||||
@embed.route("/<string:guild_id>")
|
||||
def guild_embed(guild_id):
|
||||
if check_guild_existance(guild_id):
|
||||
@ -61,7 +68,8 @@ def guild_embed(guild_id):
|
||||
"name": guild.name,
|
||||
"unauth_users": guild.unauth_users,
|
||||
"icon": guild.icon,
|
||||
"discordio": guild.discordio,
|
||||
"invite_link": guild.invite_link,
|
||||
"invite_domain": parse_url_domain(guild.invite_link),
|
||||
}
|
||||
customcss = get_custom_css()
|
||||
return render_template("embed.html.j2",
|
||||
|
@ -215,7 +215,7 @@ def administrate_guild(guild_id):
|
||||
"mentions_limit": db_guild.mentions_limit,
|
||||
"unauth_captcha": db_guild.unauth_captcha,
|
||||
"icon": db_guild.icon,
|
||||
"discordio": db_guild.discordio if db_guild.discordio != None else "",
|
||||
"invite_link": db_guild.invite_link if db_guild.invite_link != None else "",
|
||||
"guest_icon": db_guild.guest_icon if db_guild.guest_icon != None else "",
|
||||
}
|
||||
return render_template("administrate_guild.html.j2", guild=dbguild_dict, members=users, permissions=permissions, cosmetics=cosmetics, disabled=(guild_id in list_disabled_guilds()))
|
||||
@ -240,10 +240,10 @@ def update_administrate_guild(guild_id):
|
||||
db_guild.mentions_limit = request.form.get("mentions_limit", db_guild.mentions_limit)
|
||||
db_guild.unauth_captcha = request.form.get("unauth_captcha", db_guild.unauth_captcha) in ["true", True]
|
||||
|
||||
discordio = request.form.get("discordio", db_guild.discordio)
|
||||
if discordio != None and discordio.strip() == "":
|
||||
discordio = None
|
||||
db_guild.discordio = discordio
|
||||
invite_link = request.form.get("invite_link", db_guild.invite_link)
|
||||
if invite_link != None and invite_link.strip() == "":
|
||||
invite_link = None
|
||||
db_guild.invite_link = invite_link
|
||||
|
||||
guest_icon = request.form.get("guest_icon", db_guild.guest_icon)
|
||||
if guest_icon != None and guest_icon.strip() == "":
|
||||
@ -261,7 +261,7 @@ def update_administrate_guild(guild_id):
|
||||
chat_links=db_guild.chat_links,
|
||||
bracket_links=db_guild.bracket_links,
|
||||
mentions_limit=db_guild.mentions_limit,
|
||||
discordio=db_guild.discordio,
|
||||
invite_link=db_guild.invite_link,
|
||||
guest_icon=guest_icon,
|
||||
unauth_captcha=db_guild.unauth_captcha,
|
||||
)
|
||||
|
@ -19,7 +19,7 @@ class Guilds(db.Model):
|
||||
emojis = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql'), nullable=False) # Guild Emojis
|
||||
owner_id = db.Column(db.String(255), nullable=False) # Snowflake of the owner
|
||||
icon = db.Column(db.String(255)) # The icon string, null if none
|
||||
discordio = db.Column(db.String(255)) # Custom Discord.io Invite Link
|
||||
invite_link = db.Column(db.String(255)) # Custom Discord Invite Link
|
||||
|
||||
def __init__(self, guild_id, name, roles, channels, webhooks, emojis, owner_id, icon):
|
||||
self.guild_id = guild_id
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 9.8 KiB |
@ -54,13 +54,13 @@ $("#mentions_limit").keyup(function(event){
|
||||
}
|
||||
});
|
||||
|
||||
$("#discordio").keyup(function(event){
|
||||
$("#invite_link").keyup(function(event){
|
||||
if(event.keyCode == 13){
|
||||
var pathname = window.location.pathname;
|
||||
var value = $("#discordio").val()
|
||||
var payload = {"discordio": value}
|
||||
var value = $("#invite_link").val()
|
||||
var payload = {"invite_link": value}
|
||||
$.post(pathname, payload, function(data) {
|
||||
Materialize.toast('Updated Discord.io setting!', 2000)
|
||||
Materialize.toast('Updated invite link setting!', 2000)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -206,25 +206,6 @@ etc.</p>
|
||||
|
||||
<h3>Partners</h3>
|
||||
<p class="flow-text">These are awesome communities that offers amazing tools to enhance your Discord experience and are willing to promote us! So do we!! #TitanThoughtOfTheDay</p>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<div class="card-panel indigo lighten-5 z-depth-1">
|
||||
<div class="row">
|
||||
<div class="col s12 l2">
|
||||
<img src="{{ url_for('static', filename='img/partners/discordio.png') }}" alt="" class="circle responsive-img">
|
||||
</div>
|
||||
<div class="col s12 l10">
|
||||
<h5 class="black-text card-title">Discord.io</h5>
|
||||
<p class="black-text flow-text">Personalized Discord Invites</p>
|
||||
<p class="black-text">Are you tired of having random Discord.gg invite links? Wouldn't it be better if you could customize the letters in your link? Well look no further, we have the perfect solution for you! Discord.io is an unofficial project, which focuses around giving companies and communities on Discord, the option to create their very own personal invitation links.</p>
|
||||
<a href="https://discord.io/" class="waves-effect btn" target="_blank">Website</a>
|
||||
<a href="https://discord.io/dio" class="waves-effect btn" target="_blank">Discord Server</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<div class="card-panel indigo lighten-5 z-depth-1">
|
||||
|
@ -134,10 +134,10 @@
|
||||
|
||||
<br>
|
||||
|
||||
<p class="flow-text">Custom Discord.io Link</p>
|
||||
<p>Because we are a partner with <a href="https://discord.io" target="_blank">Discord.io</a>, we enable you to enter your custom discord.io link and replace the discord.gg link on the embed!</p>
|
||||
<p class="flow-text">Custom Invite Link</p>
|
||||
<p>Have a permanent invite that you really want to use? Something like discord.io on your mind? Enter your custom invite link here to replace the default one on the embed!</p>
|
||||
<p>(Leave blank if none - enter to submit)</p>
|
||||
<input id="discordio" value="{{ guild['discordio'] }}">
|
||||
<input id="invite_link" value="{{ guild['invite_link'] }}">
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -99,8 +99,8 @@
|
||||
<img id="modal_guildiconcircle" class="circle" src="{{ generate_guild_icon( guild['id'], guild['icon'] ) }}">
|
||||
{% endif %}
|
||||
<p id="modal_guildname"><strong>{{ guild['name']|e }}</strong></p>
|
||||
{% if guild["discordio"] %}
|
||||
<a id="modal_invite_btn_discordio" class="waves-effect waves-light btn" target="_blank" href="http://discord.io/{{ guild["discordio"]|e }}">discord.io/{{ guild["discordio"]|e }}</a>
|
||||
{% if guild["invite_link"] %}
|
||||
<a id="modal_invite_btn_invite_link" class="waves-effect waves-light btn" target="_blank" href="{{ guild["invite_link"]|e }}">{{ guild["invite_domain"]|e }}</a>
|
||||
{% else %}
|
||||
<a id="modal_invite_btn" class="waves-effect waves-light btn" target="_blank">discord.gg</a>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user