diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js index c42b424..a5ff518 100644 --- a/webapp/titanembeds/static/js/embed.js +++ b/webapp/titanembeds/static/js/embed.js @@ -80,6 +80,14 @@ return funct.promise(); } + function discord_embed() { + var funct = $.ajax({ + dataType: "json", + url: "https://discordapp.com/api/guilds/" + guild_id + "/widget.json", + }); + return funct.promise(); + } + $(function() { $("#focusmodal").modal({ dismissible: true, @@ -106,6 +114,11 @@ $("#focusmodal").modal("close"); has_already_been_focused = true; + var dembed = discord_embed(); + dembed.done(function (data) { + $("#modal_invite_btn").attr("href", data.instant_invite); + }); + $("#loginmodal").modal({ dismissible: false, // Modal can be dismissed by clicking outside of the modal opacity: .5, // Opacity of modal background diff --git a/webapp/titanembeds/templates/embed.html.j2 b/webapp/titanembeds/templates/embed.html.j2 index 7aa992a..8c0001a 100644 --- a/webapp/titanembeds/templates/embed.html.j2 +++ b/webapp/titanembeds/templates/embed.html.j2 @@ -76,22 +76,33 @@