presence: new fields
This commit is contained in:
		
							parent
							
								
									6bae1a2301
								
							
						
					
					
						commit
						02d0e13a2e
					
				
					 1 changed files with 33 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -24,6 +24,8 @@ const {formatTime} = require("#util/time.js");
 | 
			
		|||
  }
 | 
			
		||||
})();*/
 | 
			
		||||
 | 
			
		||||
const ActivityDisplayTypes = ["Name", "State", "Details"];
 | 
			
		||||
 | 
			
		||||
const NOWPLAYING_BAR_LENGTH = 32;
 | 
			
		||||
const NOWPLAYING_BAR_CHAR = "\u2014";
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -192,17 +194,25 @@ presence.callback = async function (msg, line) {
 | 
			
		|||
            let details = activity.details;
 | 
			
		||||
            if (activity.name == "Spotify" && activity.sync_id) {
 | 
			
		||||
              details = `[${details}](https://open.spotify.com/track/${activity.sync_id})`;
 | 
			
		||||
            } else if (activity.details_url) {
 | 
			
		||||
              details = `[${details}](${activity.details_url})`;
 | 
			
		||||
            }
 | 
			
		||||
            descLines.push(`**${details}**`);
 | 
			
		||||
          }
 | 
			
		||||
          if (activity.state) {
 | 
			
		||||
            let stateLine = activity.state;
 | 
			
		||||
            if (activity.name == "Spotify") stateLine = "by " + stateLine.split("; ").join(", ");
 | 
			
		||||
            if (activity.name == "Spotify") {
 | 
			
		||||
              stateLine = stateLine.replaceAll("; ", ", ");
 | 
			
		||||
            } else if (activity.state_url) {
 | 
			
		||||
              stateLine = `[${stateLine}](${activity.state_url})`;
 | 
			
		||||
            }
 | 
			
		||||
            descLines.push(stateLine);
 | 
			
		||||
          }
 | 
			
		||||
          if (activity.assets?.large_text) {
 | 
			
		||||
            let albumLine = activity.assets.large_text;
 | 
			
		||||
            if (activity.name == "Spotify") albumLine = "on " + albumLine;
 | 
			
		||||
            if (activity.assets.large_url) {
 | 
			
		||||
              albumLine = `[${albumLine}](${activity.assets.large_url})`;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (activity.party?.size) {
 | 
			
		||||
              albumLine += ` (${activity.party.size[0]} of ${activity.party.size[1]})`;
 | 
			
		||||
| 
						 | 
				
			
			@ -252,16 +262,34 @@ presence.callback = async function (msg, line) {
 | 
			
		|||
          descLines.push(`-# Platform: ${activity.platform}`);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (activity.status_display_type != null) {
 | 
			
		||||
          descLines.push(
 | 
			
		||||
            `-# Display Type: ${
 | 
			
		||||
              ActivityDisplayTypes[activity.status_display_type] ?? `<unknown type: ${activity.status_display_type}>`
 | 
			
		||||
            }`
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (activity.assets?.large_text && activity.type != 2) {
 | 
			
		||||
          descLines.push("### Large Text", activity.assets.large_text);
 | 
			
		||||
          descLines.push(
 | 
			
		||||
            "### Large Text",
 | 
			
		||||
            activity.assets.large_url
 | 
			
		||||
              ? `[${activity.assets.large_text}](${activity.assets.large_url})`
 | 
			
		||||
              : activity.assets.large_text
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (activity.assets?.small_text) {
 | 
			
		||||
          descLines.push("### Small Text", activity.assets.small_text);
 | 
			
		||||
          descLines.push(
 | 
			
		||||
            "### Small Text",
 | 
			
		||||
            activity.assets.small_url
 | 
			
		||||
              ? `[${activity.assets.small_text}](${activity.assets.small_url})`
 | 
			
		||||
              : activity.assets.small_text
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        descLines.push(
 | 
			
		||||
          `\n-# ${activity.application_id ? activity.application_id + " \u2022 " : ""}<t:${Math.floor(
 | 
			
		||||
          `\n-# ${activity.application_id ? `ID: ${activity.application_id} \u2022 ` : ""}<t:${Math.floor(
 | 
			
		||||
            activity.created_at / 1000
 | 
			
		||||
          )}:f>`
 | 
			
		||||
        );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue