logging: fallbacks
This commit is contained in:
		
							parent
							
								
									b023d6cb8f
								
							
						
					
					
						commit
						0430a68f5a
					
				
					 1 changed files with 44 additions and 21 deletions
				
			
		| 
						 | 
					@ -164,6 +164,13 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
 | 
				
			||||||
              });
 | 
					              });
 | 
				
			||||||
              break;
 | 
					              break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            default: {
 | 
				
			||||||
 | 
					              fields.push({
 | 
				
			||||||
 | 
					                name: `\`${key}\``,
 | 
				
			||||||
 | 
					                value,
 | 
				
			||||||
 | 
					                inline: true,
 | 
				
			||||||
 | 
					              });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -278,7 +285,7 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            default: {
 | 
					            default: {
 | 
				
			||||||
              fields.push({
 | 
					              fields.push({
 | 
				
			||||||
                name: key,
 | 
					                name: `\`${key}\``,
 | 
				
			||||||
                value: formatChange(oldValue, newValue),
 | 
					                value: formatChange(oldValue, newValue),
 | 
				
			||||||
                inline: true,
 | 
					                inline: true,
 | 
				
			||||||
              });
 | 
					              });
 | 
				
			||||||
| 
						 | 
					@ -388,19 +395,22 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
 | 
				
			||||||
        const bot = hf.bot;
 | 
					        const bot = hf.bot;
 | 
				
			||||||
        const target = bot.users.get(entry.targetID);
 | 
					        const target = bot.users.get(entry.targetID);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const oldNickname = before?.nick;
 | 
					        for (const [key, newValue] of Object.entries(after)) {
 | 
				
			||||||
        const newNickname = after?.nick;
 | 
					          const oldValue = before[key];
 | 
				
			||||||
 | 
					          switch (key) {
 | 
				
			||||||
        if (oldNickname != newNickname) {
 | 
					            case "nick": {
 | 
				
			||||||
 | 
					              if (oldValue != newValue) {
 | 
				
			||||||
                fields.push({
 | 
					                fields.push({
 | 
				
			||||||
                  name: "Nickname",
 | 
					                  name: "Nickname",
 | 
				
			||||||
            value: formatChange(oldNickname, newNickname),
 | 
					                  value: formatChange(oldValue, newValue),
 | 
				
			||||||
                  inline: true,
 | 
					                  inline: true,
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
 | 
					              break;
 | 
				
			||||||
        const isTimedOut = after?.communication_disabled_until != null;
 | 
					            }
 | 
				
			||||||
        const timeout = isTimedOut ? after?.communication_disabled_until : before?.communication_disabled_until;
 | 
					            case "communication_disabled_until": {
 | 
				
			||||||
 | 
					              const isTimedOut = newValue != null;
 | 
				
			||||||
 | 
					              const timeout = isTimedOut ? newValue : oldValue;
 | 
				
			||||||
              if (timeout != null) {
 | 
					              if (timeout != null) {
 | 
				
			||||||
                const timeoutDuration = new Date(timeout);
 | 
					                const timeoutDuration = new Date(timeout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -410,6 +420,19 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
 | 
				
			||||||
                  inline: true,
 | 
					                  inline: true,
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
 | 
					              break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            case "bypasses_verification":
 | 
				
			||||||
 | 
					              break;
 | 
				
			||||||
 | 
					            default: {
 | 
				
			||||||
 | 
					              fields.push({
 | 
				
			||||||
 | 
					                name: `\`${key}\``,
 | 
				
			||||||
 | 
					                value: formatChange(oldValue, newValue),
 | 
				
			||||||
 | 
					                inline: true,
 | 
				
			||||||
 | 
					              });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let verb = "updated";
 | 
					        let verb = "updated";
 | 
				
			||||||
        if (after.bypasses_verification) {
 | 
					        if (after.bypasses_verification) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue