diff --git a/webapp/titanembeds/blueprints/api/api.py b/webapp/titanembeds/blueprints/api/api.py index 6fbab52..17f4d92 100644 --- a/webapp/titanembeds/blueprints/api/api.py +++ b/webapp/titanembeds/blueprints/api/api.py @@ -232,8 +232,7 @@ def filter_guild_channel(guild_id, channel_id): return chan return None -def get_online_discord_users(guild_id): - embed = discord_api.get_widget(guild_id) +def get_online_discord_users(guild_id, embed): apimembers = list_all_guild_members(guild_id) apimembers_filtered = {} for member in apimembers: @@ -379,10 +378,11 @@ def query_guild(): guild_id = request.args.get('guild_id') if check_guild_existance(guild_id): if check_user_in_guild(guild_id): + widget = discord_api.get_widget(guild_id) channels = get_guild_channels(guild_id) - discordmembers = get_online_discord_users(guild_id) + discordmembers = get_online_discord_users(guild_id, widget) embedmembers = get_online_embed_users(guild_id) - return jsonify(channels=channels, discordmembers=discordmembers, embedmembers=embedmembers) + return jsonify(channels=channels, discordmembers=discordmembers, embedmembers=embedmembers, instant_invite=widget.get("instant_invite")) abort(403) abort(404) diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js index dce42aa..4c93c04 100644 --- a/webapp/titanembeds/static/js/embed.js +++ b/webapp/titanembeds/static/js/embed.js @@ -163,6 +163,7 @@ fill_discord_members(guildobj.discordmembers); fill_authenticated_users(guildobj.embedmembers.authenticated); fill_unauthenticated_users(guildobj.embedmembers.unauthenticated); + $("#instant-inv").attr("href", guildobj.instant_invite); run_fetch_routine(); } @@ -461,6 +462,7 @@ fill_discord_members(guildobj.discordmembers); fill_authenticated_users(guildobj.embedmembers.authenticated); fill_unauthenticated_users(guildobj.embedmembers.unauthenticated); + $("#instant-inv").attr("href", guildobj.instant_invite); fetchtimeout = setTimeout(run_fetch_routine, 5000); }); } else { diff --git a/webapp/titanembeds/templates/embed.html.j2 b/webapp/titanembeds/templates/embed.html.j2 index bbe0f05..abfcdd2 100644 --- a/webapp/titanembeds/templates/embed.html.j2 +++ b/webapp/titanembeds/templates/embed.html.j2 @@ -47,7 +47,7 @@
  • Actions
  • -
  • Open Server on Discordapp
  • +
  • Open Server on Discordapp