diff --git a/discordbot/titanembeds/database/guilds.py b/discordbot/titanembeds/database/guilds.py
index 164382e..80ed764 100644
--- a/discordbot/titanembeds/database/guilds.py
+++ b/discordbot/titanembeds/database/guilds.py
@@ -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
diff --git a/webapp/alembic/versions/0b7761d85555_repurposed_discordio_column_to_generic_.py b/webapp/alembic/versions/0b7761d85555_repurposed_discordio_column_to_generic_.py
new file mode 100644
index 0000000..851b495
--- /dev/null
+++ b/webapp/alembic/versions/0b7761d85555_repurposed_discordio_column_to_generic_.py
@@ -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 ###
diff --git a/webapp/titanembeds/blueprints/admin/admin.py b/webapp/titanembeds/blueprints/admin/admin.py
index 8bd3e8b..e30b30b 100644
--- a/webapp/titanembeds/blueprints/admin/admin.py
+++ b/webapp/titanembeds/blueprints/admin/admin.py
@@ -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,
)
diff --git a/webapp/titanembeds/blueprints/embed/embed.py b/webapp/titanembeds/blueprints/embed/embed.py
index 8d1bc93..bd352f4 100644
--- a/webapp/titanembeds/blueprints/embed/embed.py
+++ b/webapp/titanembeds/blueprints/embed/embed.py
@@ -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("/
These are awesome communities that offers amazing tools to enhance your Discord experience and are willing to promote us! So do we!! #TitanThoughtOfTheDay
-Personalized Discord Invites
-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.
- Website - Discord Server -Custom Discord.io Link
-Because we are a partner with Discord.io, we enable you to enter your custom discord.io link and replace the discord.gg link on the embed!
+Custom Invite Link
+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!
(Leave blank if none - enter to submit)
- +{{ guild['name']|e }}
- {% if guild["discordio"] %} - discord.io/{{ guild["discordio"]|e }} + {% if guild["invite_link"] %} + {{ guild["invite_domain"]|e }} {% else %} discord.gg {% endif %}