logging: try set difference
This commit is contained in:
		
							parent
							
								
									af82f70688
								
							
						
					
					
						commit
						fb7d3cffe6
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -27,8 +27,10 @@ events.add("guildUpdate", "logging", async function (guild, oldGuild) {
 | 
			
		|||
  const channel = await getLoggingChannel(guild);
 | 
			
		||||
  if (!channel) return;
 | 
			
		||||
 | 
			
		||||
  const featuresAdded = guild.features.filter((f) => !oldGuild.features.includes(f));
 | 
			
		||||
  const featuresRemoved = oldGuild.features.filter((f) => !guild.features.includes(f));
 | 
			
		||||
  const oldFeatures = new Set(oldGuild.features);
 | 
			
		||||
  const newFeatures = new Set(guild.features);
 | 
			
		||||
  const featuresAdded = newFeatures.difference(oldFeatures);
 | 
			
		||||
  const featuresRemoved = oldFeatures.difference(newFeatures);
 | 
			
		||||
 | 
			
		||||
  if (featuresAdded.length === 0 && featuresRemoved.length === 0) return;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue