mirror of
				https://github.com/TitanEmbeds/Titan.git
				synced 2025-11-04 07:47:10 +01:00 
			
		
		
		
	Fixes for authenticated discord user check and other small fixes
This commit is contained in:
		@@ -93,7 +93,8 @@ def check_user_in_guild(guild_id):
 | 
			
		||||
    if user_unauthenticated():
 | 
			
		||||
        return guild_id in session['user_keys']
 | 
			
		||||
    else:
 | 
			
		||||
        return 200 == discord_api.get_guild_member_nocache(guild_id, session['user_id'])['code']
 | 
			
		||||
        dbUser = db.session.query(AuthenticatedUsers).filter(and_(AuthenticatedUsers.guild_id == guild_id, AuthenticatedUsers.client_id == session['user_id'])).first()
 | 
			
		||||
        return 200 == discord_api.get_guild_member_nocache(guild_id, session['user_id'])['code'] and dbUser is not None
 | 
			
		||||
 | 
			
		||||
def format_post_content(message):
 | 
			
		||||
    if (session['unauthenticated']):
 | 
			
		||||
 
 | 
			
		||||
@@ -204,12 +204,14 @@ function _wait_for_discord_login(index) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function select_channel(channel_id) {
 | 
			
		||||
    selected_channel = channel_id;
 | 
			
		||||
    last_message_id = null;
 | 
			
		||||
    $("#channels-list > li.active").removeClass("active");
 | 
			
		||||
    $("#channel-"+selected_channel).parent().addClass("active");
 | 
			
		||||
    clearTimeout(fetchtimeout);
 | 
			
		||||
    run_fetch_routine();
 | 
			
		||||
    if (selected_channel != channel_id) {
 | 
			
		||||
        selected_channel = channel_id;
 | 
			
		||||
        last_message_id = null;
 | 
			
		||||
        $("#channels-list > li.active").removeClass("active");
 | 
			
		||||
        $("#channel-"+selected_channel).parent().addClass("active");
 | 
			
		||||
        clearTimeout(fetchtimeout);
 | 
			
		||||
        run_fetch_routine();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function replace_message_mentions(message) {
 | 
			
		||||
@@ -332,8 +334,11 @@ $("#custom_username_field").keyup(function(event){
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
$("#messagebox").keyup(function(event){
 | 
			
		||||
    $(this).val($.trim($(this).val()));
 | 
			
		||||
    if ($(this).val().length == 1) {
 | 
			
		||||
        $(this).val($.trim($(this).val()));
 | 
			
		||||
    }
 | 
			
		||||
    if(event.keyCode == 13 && $(this).val().length >= 1 && $(this).val().length <= 350) {
 | 
			
		||||
        $(this).val($.trim($(this).val()));
 | 
			
		||||
        $(this).blur();
 | 
			
		||||
        var funct = post(selected_channel, $(this).val());
 | 
			
		||||
        funct.done(function(data) {
 | 
			
		||||
 
 | 
			
		||||
@@ -56,11 +56,8 @@ def check_guild_existance(guild_id):
 | 
			
		||||
    dbGuild = Guilds.query.filter_by(guild_id=guild_id).first()
 | 
			
		||||
    if not dbGuild:
 | 
			
		||||
        return False
 | 
			
		||||
    guilds = discord_api.get_all_guilds()
 | 
			
		||||
    for guild in guilds:
 | 
			
		||||
        if guild_id == guild['id']:
 | 
			
		||||
            return True
 | 
			
		||||
    return False
 | 
			
		||||
    guild = discord_api.get_guild(guild_id)
 | 
			
		||||
    return guild['code'] == 200
 | 
			
		||||
 | 
			
		||||
def guild_query_unauth_users_bool(guild_id):
 | 
			
		||||
    dbGuild = db.session.query(Guilds).filter(Guilds.guild_id==guild_id).first()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user