mirror of
				https://github.com/TitanEmbeds/Titan.git
				synced 2025-11-04 07:47:10 +01:00 
			
		
		
		
	Less query guild
This commit is contained in:
		@@ -12,6 +12,7 @@
 | 
				
			|||||||
    var last_message_id; // last message tracked
 | 
					    var last_message_id; // last message tracked
 | 
				
			||||||
    var selected_channel = guild_id; // user selected channel, defaults to #general channel
 | 
					    var selected_channel = guild_id; // user selected channel, defaults to #general channel
 | 
				
			||||||
    var guild_channels = {}; // all server channels used to highlight channels in messages
 | 
					    var guild_channels = {}; // all server channels used to highlight channels in messages
 | 
				
			||||||
 | 
					    var times_fetched = 0; // kept track of how many times that it has fetched
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function element_in_view(element, fullyInView) {
 | 
					    function element_in_view(element, fullyInView) {
 | 
				
			||||||
        var pageTop = $(window).scrollTop();
 | 
					        var pageTop = $(window).scrollTop();
 | 
				
			||||||
@@ -418,6 +419,7 @@
 | 
				
			|||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                $("#administrate_link").hide();
 | 
					                $("#administrate_link").hide();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            if (times_fetched % 10 == 0) {
 | 
				
			||||||
              var guild = query_guild();
 | 
					              var guild = query_guild();
 | 
				
			||||||
              guild.done(function(guildobj) {
 | 
					              guild.done(function(guildobj) {
 | 
				
			||||||
                  fill_channels(guildobj.channels);
 | 
					                  fill_channels(guildobj.channels);
 | 
				
			||||||
@@ -426,6 +428,9 @@
 | 
				
			|||||||
                  fill_unauthenticated_users(guildobj.embedmembers.unauthenticated);
 | 
					                  fill_unauthenticated_users(guildobj.embedmembers.unauthenticated);
 | 
				
			||||||
                  fetchtimeout = setTimeout(run_fetch_routine, 5000);
 | 
					                  fetchtimeout = setTimeout(run_fetch_routine, 5000);
 | 
				
			||||||
              });
 | 
					              });
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					              fetchtimeout = setTimeout(run_fetch_routine, 5000);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        fet.fail(function(data) {
 | 
					        fet.fail(function(data) {
 | 
				
			||||||
            if (data.status == 403) {
 | 
					            if (data.status == 403) {
 | 
				
			||||||
@@ -438,12 +443,13 @@
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        fet.catch(function(data) {
 | 
					        fet.catch(function(data) {
 | 
				
			||||||
          if (500 <= data.status && data.status < 600) {
 | 
					          if (500 <= data.status && data.status < 600) {
 | 
				
			||||||
              Materialize.toast('Fetching messages error! Webserver down?', 10000);
 | 
					              Materialize.toast('Fetching messages error! EndenDragon probably broke something. Sorry =(', 10000);
 | 
				
			||||||
              fetchtimeout = setTimeout(run_fetch_routine, 10000);
 | 
					              fetchtimeout = setTimeout(run_fetch_routine, 10000);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        fet.always(function() {
 | 
					        fet.always(function() {
 | 
				
			||||||
            currently_fetching = false;
 | 
					            currently_fetching = false;
 | 
				
			||||||
 | 
					            times_fetched += 1;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user