diff --git a/README.md b/README.md index 20789d8..e700e04 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Access the Nintendo Switch Online and Nintendo Switch Parental Controls app APIs - Fetch presence from a custom URL - All titles are supported using a default Nintendo Switch app. A limited number of titles have their own Discord apps (meaning they appear under your name with the title's name instead of "Nintendo Switch") - or other custom Discord features. [See here for Discord title overrides](src/discord/titles.ts) or + or other custom Discord features. [See here for Discord title overrides](src/discord/titles) or [create an issue if you'd like another title added](https://github.com/samuelthomas2774/nxapi/issues/new/choose). ![Screenshot showing Splatoon 2 as a Discord activity](resources/Screenshot%202022-03-31%20at%2017.56.47%203.png) diff --git a/src/discord/titles.ts b/src/discord/titles.ts index 1e4ea8b..2df75cc 100644 --- a/src/discord/titles.ts +++ b/src/discord/titles.ts @@ -1,4 +1,5 @@ import { Title } from './util.js'; +import * as publishers from './titles/index.js'; export const defaultTitle: Title = { id: '0000000000000000', @@ -8,112 +9,12 @@ export const defaultTitle: Title = { showActiveEvent: true, }; -const titles: Title[] = [ - { - // Splatoon 2 [Europe] - id: '0100f8f0000a2000', - client: '950886725398429726', - largeImageKey: '0100f8f0000a2000', - showPlayingOnline: true, - showActiveEvent: true, - }, - { - // Splatoon 2 [The Americas] - id: '01003bc0000a0000', - client: '950886725398429726', - largeImageKey: '0100f8f0000a2000', - showPlayingOnline: true, - showActiveEvent: true, - }, - { - // Splatoon 2 [Japan] - id: '01003c700009c000', - client: '950886725398429726', - largeImageKey: '01003c700009c000', - showPlayingOnline: true, - showActiveEvent: true, - }, +export const titles: Title[] = []; - { - // Super Smash Bros. Ultimate - id: '01006a800016e000', - client: '950894516104212490', - largeImageKey: '01006a800016e000', - showActiveEvent: true, - }, +for (const [publisher, m] of Object.entries(publishers)) { + if (!('titles' in m)) continue; - { - // Mario Kart 8 Deluxe - id: '0100152000022000', - client: '950905573149409280', - largeImageKey: '0100152000022000', - showActiveEvent: true, - }, - - { - // Super Mario Odyssey - id: '0100000000010000', - client: '950905939899351050', - largeImageKey: '0100000000010000', - }, - - { - // Minecraft - id: '0100d71004694000', - client: '950906152391168020', - largeImageKey: '0100d71004694000', - }, - { - // Minecraft: Nintendo Switch Edition - id: '01006bd001e06000', - client: '950906152391168020', - largeImageKey: '01006bd001e06000', - }, - - { - // Nintendo Entertainment System - Nintendo Switch Online - id: '0100d870045b6000', - client: '950907272438104064', - titleName: 'Nintendo Entertainment System', - largeImageKey: '0100d870045b6000', - }, - { - // Super Nintendo Entertainment System - Nintendo Switch Online - id: '01008d300c50c000', - client: '950907272438104064', - titleName: 'Super Nintendo Entertainment System', - largeImageKey: '01008d300c50c000', - }, - { - // Nintendo 64 - Nintendo Switch Online - id: '0100c9a00ece6000', - client: '950907272438104064', - titleName: 'Nintendo 64', - largeImageKey: '0100c9a00ece6000', - }, - { - // SEGA Mega Drive - Nintendo Switch Online - id: '0100b3c014bda000', - client: '950907272438104064', - titleName: 'SEGA Mega Drive', - largeImageKey: '0100b3c014bda000', - }, - - { - // Animal Crossing: New Horizons - id: '01006f8002326000', - client: '950908097235415079', - largeImageKey: '01006f8002326000', - showPlayingOnline: true, - showActiveEvent: true, - }, - { - // Animal Crossing: New Horizons Island Transfer Tool - id: '0100f38011cfe000', - client: '950908097235415079', - titleName: 'Island Transfer Tool', - largeImageKey: '0100f38011cfe000', - }, -]; - -export default titles; + for (const title of m.titles) { + titles.push(title); + } +} diff --git a/src/discord/titles/README.md b/src/discord/titles/README.md new file mode 100644 index 0000000..f37403c --- /dev/null +++ b/src/discord/titles/README.md @@ -0,0 +1,4 @@ +Title overrides for Discord activities +--- + +This directory contains custom configuration for titles. The default configuration for all other titles is in [src/discord/titles.ts](../titles.ts). This is used by [src/discord/util.ts](../util.ts) (which also declares the type for title configuration objects) to convert znc presences to Discord activities. diff --git a/src/discord/titles/index.ts b/src/discord/titles/index.ts new file mode 100644 index 0000000..0a2fb39 --- /dev/null +++ b/src/discord/titles/index.ts @@ -0,0 +1,2 @@ +export * as nintendo from './nintendo.js'; +export * as mojang from './mojang.js'; diff --git a/src/discord/titles/mojang.ts b/src/discord/titles/mojang.ts new file mode 100644 index 0000000..19dc105 --- /dev/null +++ b/src/discord/titles/mojang.ts @@ -0,0 +1,16 @@ +import { Title } from '../util.js'; + +export const titles: Title[] = [ + { + // Minecraft + id: '0100d71004694000', + client: '950906152391168020', + largeImageKey: '0100d71004694000', + }, + { + // Minecraft: Nintendo Switch Edition + id: '01006bd001e06000', + client: '950906152391168020', + largeImageKey: '01006bd001e06000', + }, +]; diff --git a/src/discord/titles/nintendo.ts b/src/discord/titles/nintendo.ts new file mode 100644 index 0000000..9b2d4f1 --- /dev/null +++ b/src/discord/titles/nintendo.ts @@ -0,0 +1,1046 @@ +import { Title } from '../util.js'; + +export const titles: Title[] = [ + { + // Splatoon 2 [Europe] + id: '0100f8f0000a2000', + client: '950886725398429726', + largeImageKey: '0100f8f0000a2000', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Splatoon 2 [The Americas] + id: '01003bc0000a0000', + client: '950886725398429726', + largeImageKey: '0100f8f0000a2000', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Splatoon 2 [Japan] + id: '01003c700009c000', + client: '950886725398429726', + largeImageKey: '01003c700009c000', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Splatoon 2: Splatfest World Premiere [Europe, The Americas] + id: '01003870040fa000', + client: '950886725398429726', + titleName: 'Splatfest World Premiere', + showPlayingOnline: true, + }, + { + // Splatoon 2: Special Demo [Europe] + id: '01007e200d45c000', + client: '950886725398429726', + titleName: 'Special Demo', + showPlayingOnline: true, + }, + { + // Splatoon 2 Special Demo [The Americas] + id: '01006bb00d45a000', + client: '950886725398429726', + titleName: 'Special Demo', + showPlayingOnline: true, + }, + { + // Splatoon 2 Special Demo [Japan] + id: '01009c900d458000', + client: '950886725398429726', + titleName: 'Special Demo', + showPlayingOnline: true, + }, + { + // Splatoon 2: Special Demo 2020 [Europe] + id: '01009240116cc000', + client: '950886725398429726', + titleName: 'Special Demo 2020', + showPlayingOnline: true, + }, + { + // Splatoon 2 Special Demo 2020 [The Americas] + id: '01002120116c4000', + client: '950886725398429726', + titleName: 'Special Demo 2020', + showPlayingOnline: true, + }, + { + // Splatoon 2 Special Demo 2020 [Japan] + id: '0100998011330000', + client: '950886725398429726', + titleName: 'Special Demo 2020', + showPlayingOnline: true, + }, + + { + // Super Smash Bros. Ultimate + id: '01006a800016e000', + client: '950894516104212490', + largeImageKey: '01006a800016e000', + showActiveEvent: true, + }, + + { + // Mario Kart 8 Deluxe + id: '0100152000022000', + client: '950905573149409280', + largeImageKey: '0100152000022000', + showActiveEvent: true, + }, + + { + // Super Mario Odyssey + id: '0100000000010000', + client: '950905939899351050', + largeImageKey: '0100000000010000', + }, + + { + // Nintendo Entertainment System - Nintendo Switch Online + id: '0100d870045b6000', + client: '950907272438104064', + titleName: 'Nintendo Entertainment System', + largeImageKey: '0100d870045b6000', + }, + { + // Super Nintendo Entertainment System - Nintendo Switch Online + id: '01008d300c50c000', + client: '950907272438104064', + titleName: 'Super Nintendo Entertainment System', + largeImageKey: '01008d300c50c000', + }, + { + // Nintendo 64 - Nintendo Switch Online + id: '0100c9a00ece6000', + client: '950907272438104064', + titleName: 'Nintendo 64', + largeImageKey: '0100c9a00ece6000', + }, + { + // SEGA Mega Drive - Nintendo Switch Online + id: '0100b3c014bda000', + client: '950907272438104064', + titleName: 'SEGA Mega Drive', + largeImageKey: '0100b3c014bda000', + }, + + { + // Animal Crossing: New Horizons + id: '01006f8002326000', + client: '950908097235415079', + largeImageKey: '01006f8002326000', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Animal Crossing: New Horizons Island Transfer Tool + id: '0100f38011cfe000', + client: '950908097235415079', + titleName: 'Island Transfer Tool', + largeImageKey: '0100f38011cfe000', + }, + + { + // The Legend of Zelda: Breath of the Wild + id: '01007ef00011e000', + client: '966102432838996009', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // 1-2-Switch + id: '01000320000cc000', + client: '966102630524919848', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Snipperclips - Cut it out, together! + id: '0100704000b3a000', + client: '966102704525025301', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Snipperclips - Cut it out, together! Demo + id: '0100d87002ee0000', + client: '966102704525025301', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // ARMS + id: '01009b500007c000', + client: '966102773642960917', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // ARMS Sparring Demo + id: '0100a5400ac86000', + client: '966102773642960917', + titleName: 'Sparring Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Pokémon: Let's Go, Pikachu! + id: '010003f003a34000', + client: '966102993177034832', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Pokémon: Let's Go, Eevee! + id: '0100187003a36000', + client: '966103072407437332', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Pokémon: Let's Go, Pikachu! & Pokémon: Let's Go, Eevee! Demo + id: '0100c1800d7ae000', + client: '966103072407437332', + titleName: 'Pokémon: Let\'s Go, Pikachu! & Pokémon: Let\'s Go, Eevee! Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Fire Emblem Warriors + id: '0100f15003e64000', + client: '966103152753528942', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Xenoblade Chronicles 2 + id: '0100e95004038000', + client: '966103273612382248', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Yoshi's Crafted World + id: '01006000040c2000', + client: '966103360589672488', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Yoshi's Crafted World Demo + id: '0100ae800c9c6000', + client: '966103360589672488', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Pokkén Tournament DX + id: '0100b3f000be2000', + client: '966103482702647326', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Pokkén Tournament DX Demo + id: '010030d005ae6000', + client: '966103482702647326', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Octopath Traveler + id: '010057d006492000', + client: '966147770006241340', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // OCTOPATH TRAVELER: Prologue Demo + id: '010096000b3ea000', + client: '966147770006241340', + titleName: 'Prologue Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Luigi's Mansion 3 + id: '0100dca0064a6000', + client: '966147956078178364', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Captain Toad: Treasure Tracker + id: '01009bf0072d4000', + client: '966148067134939186', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Captain Toad: Treasure Tracker Demo + id: '01002c400b6b6000', + client: '966148067134939186', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Sushi Striker: The Way of Sushido + id: '0100ddd0085a4000', + client: '966148228154265661', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Sushi Striker: The Way of Sushido Demo + // id: '', // TODO + // client: '966148228154265661', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // Mario Tennis Aces + id: '0100bde00862a000', + client: '966148353727561738', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Mario Tennis Aces: Special Demo [Europe] + id: '0100f9600da78000', + client: '966148353727561738', + titleName: 'Special Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Mario Tennis Aces Special Online Demo [The Americas] + id: '0100a4200da76000', + client: '966148353727561738', + titleName: 'Special Online Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Pokémon Shield + id: '01008db008c2c000', + client: '966148552768249866', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Pokémon Sword + id: '0100abf008968000', + client: '966148667201445928', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Pikmin 3 Deluxe + id: '0100f4c009322000', + client: '966148753365041173', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Pikmin 3 Deluxe Demo + id: '01001cb0106f8000', + client: '966148753365041173', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Dragon Quest Builders + id: '010008900705c000', + client: '966148914933792838', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Dragon Quest Builders Demo + id: '0100c360070f6000', + client: '966148914933792838', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Hyrule Warriors: Definitive Edition + id: '0100ae00096ea000', + client: '966149007959281755', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // New Super Mario Bros. U Deluxe + id: '0100ea80032ea000', + client: '966329678715559996', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Bayonetta 2 + id: '01007960049a0000', + client: '966329813780549672', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Bayonetta + id: '010076f0049a2000', + client: '966329937533497364', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Kirby Star Allies + id: '01007e3006dda000', + client: '966330020391952384', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Kirby Star Allies Demo + id: '01005a70096fa000', + client: '966330020391952384', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Fire Emblem: Three Houses + id: '010055d009f78000', + client: '966330114210152528', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // The Stretchers + id: '0100aa400a238000', + client: '966331256541429831', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Donkey Kong Country: Tropical Freeze + id: '0100c1f0051b6000', + client: '966331402289315850', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Dragon Quest Builders 2 + id: '010042000a986000', + client: '966331488322871346', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Dragon Quest Builders 2 Demo + // id: '', // TODO + // client: '966331488322871346', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + // { + // // Dragon Quest Builders 2 Jumbo Demo + // id: '', // TODO + // client: '966331488322871346', + // titleName: 'Jumbo Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // Go Vacation + id: '0100c1800a9b6000', + client: '966331633244471306', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Fitness Boxing + id: '0100e7300aad4000', + client: '966387481375285300', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Fitness Boxing Demo + id: '010050200d0da000', + client: '966387481375285300', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Marvel Ultimate Alliance 3: The Black Order + id: '010060700ac50000', + client: '966387596173389864', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // The World Ends With You: -Final Remix- + id: '0100c1500b82e000', + client: '966387699344896073', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Mario Kart Live: Home Circuit + id: '0100ed100ba3a000', + client: '966387799718768690', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Pokémon Mystery Dungeon: Rescue Team DX + id: '01003d200baa2000', + client: '966387876520685668', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Pokémon Mystery Dungeon: Rescue Team DX Demo + // id: '', // TODO + // client: '966387876520685668', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // Super Mario Party + id: '010036b0034e4000', + client: '966387972574429184', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // DAEMON X MACHINA + id: '0100b6400ca56000', + client: '966388060428320789', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // DAEMON X MACHINA: Prototype Missions + id: '0100bf600d83a000', + client: '966388060428320789', + titleName: 'Prototype Missions', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // DAEMON X MACHINA Demo + // id: '', // TODO + // client: '966388060428320789', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // TETRIS 99 + id: '010040600c5ce000', + client: '966388175465496626', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Super Mario Maker 2 + id: '01009b90006dc000', + client: '966388261264162836', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // BOXBOY! + BOXGIRL! + id: '010018300d006000', + client: '966388339127234592', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // BOXBOY! + BOXGIRL! Demo + id: '0100b7200e02e000', + client: '966388339127234592', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Astral Chain + id: '01007300020fa000', + client: '966441561158213662', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // The Legend of Zelda: Link's Awakening + id: '01006bb00c6f0000', + client: '966441660210872441', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Cadence of Hyrule - Crypt of the NecroDancer Featuring The Legend of Zelda + id: '01000b900d8b0000', + client: '966441763973763162', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Cadence of Hyrule - Crypt of the NecroDancer Featuring The Legend of Zelda Demo + // id: '', // TODO + // client: '966441763973763162', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // Dragon Quest XI S: Echoes of an Elusive Age - Definitive Edition + id: '01006c300e9f0000', + client: '966441876267864084', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Dragon Quest XI S: Echoes of an Elusive Age - Definitive Edition Demo + // id: '', // TODO + // client: '966441876267864084', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // Super Kirby Clash + id: '01003fb00c5a8000', + client: '966442004026380368', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Tokyo Mirage Sessions #FE Encore + id: '0100a9400c9c2000', + client: '966442166526308463', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Dr Kawashima's Brain Training for Nintendo Switch + id: '0100ed000d390000', + client: '966442282372964372', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Bravely Default II + id: '01006dc010326000', + client: '966442378095382578', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Bravely Default II Demo + id: '0100b6801137e000', + client: '966442378095382578', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Bravely Default II Demo + // id: '', // TODO - there's two demos apparently + // client: '966442378095382578', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // Xenoblade Chronicles: Definitive Edition + id: '0100ff500e34a000', + client: '966442512984191076', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // 51 Worldwide Games + id: '010047700d540000', + client: '966442617938280526', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // 51 Worldwide Games: Local Multiplayer Guest Edition + id: '0100cd9011c04000', + client: '966442617938280526', + titleName: 'Local Multiplayer Guest Edition', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Good Job! + id: '0100b0500fe4e000', + client: '966478025006919680', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Paper Mario: The Origami King + id: '0100a3900c3e2000', + client: '966478424195600385', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Super Mario 3D All-Stars + id: '010049900f546000', + client: '966478641473130506', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Jump Rope Challenge + id: '0100b9c012706000', + client: '966478825707937822', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Super Mario 3D World + Bowser's Fury + id: '010028600ebda000', + client: '966478958868693042', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Kirby Fighters 2 + id: '0100227010460000', + client: '966479069287960656', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Kirby Fighters 2 Demo + // id: '', // TODO + // client: '966479069287960656', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // Hyrule Warriors: Age of Calamity + id: '01002b00111a2000', + client: '966479236762325013', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Hyrule Warriors: Age of Calamity Demo + // id: '', // TODO + // client: '966479236762325013', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // Fitness Boxing 2: Rhythm & Exercise + id: '0100073011382000', + client: '966479353510789150', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Fitness Boxing 2: Rhythm & Exercise Demo + id: '01000f50130a2000', + client: '966479353510789150', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Part Time UFO + id: '01006b5012b32000', + client: '966479489745944737', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // New Pokémon Snap + id: '0100f4300bf2c000', + client: '966479643039399977', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // The Legend of Zelda: Skyward Sword HD + id: '01002da013484000', + client: '966487001119473734', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Miitopia + id: '01003da010e8a000', + client: '966487135194591282', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Miitopia Demo + id: '01007da0140e8000', + client: '966487135194591282', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Mario Golf: Super Rush + id: '0100c9c00e25c000', + client: '966487238944882759', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Pokémon Legends: Arceus + id: '01001f5010dfa000', + client: '966487348743372850', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Pokémon Brilliant Diamond + id: '0100000011d90000', + client: '966487430981111818', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Pokémon Shining Pearl + id: '010018e011d92000', + client: '966487507392933929', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Game Builder Garage + id: '0100fa5010788000', + client: '966487590721163264', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Game Builder Garage Demo + id: '01003b101497c000', + client: '966487590721163264', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Metroid Dread + id: '010093801237c000', + client: '966487674162642974', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Metroid Dread Demo + // id: '', // TODO + // client: '966487674162642974', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // WarioWare: Get It Together! + id: '0100563010e0c000', + client: '966487765447483412', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // WarioWare: Get It Together! Demo + id: '0100ee9015b5e000', + client: '966487765447483412', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Mario Party Superstars + id: '01006fe013472000', + client: '966487877343125584', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Advance Wars 1+2: Re-Boot Camp + id: '0100300012f2a000', + client: '966533261541113857', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Shin Megami Tensei V + id: '0100b870126ce000', + client: '966533545843650570', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Big Brain Academy: Brain vs. Brain + id: '0100620012d6e000', + client: '966533636969082921', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Big Brain Academy: Brain vs. Brain Demo + id: '0100219016ab4000', + client: '966533636969082921', + titleName: 'Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Triangle Strategy + id: '0100cc80140f8000', + client: '966533747023437904', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Project Triangle Strategy Debut Demo + id: '01002980140f6000', + client: '966533747023437904', + titleName: 'Project Triangle Strategy Debut Demo', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Project Triangle Strategy Prologue demo + // id: '', // TODO + // client: '966533747023437904', + // titleName: 'Prologue demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // Kirby and the Forgotten Land + id: '01004d300c5ae000', + client: '966534055116021821', + showPlayingOnline: true, + showActiveEvent: true, + }, + // { + // // Kirby and the Forgotten Land Demo + // id: '', // TODO + // client: '966534055116021821', + // titleName: 'Demo', + // showPlayingOnline: true, + // showActiveEvent: true, + // }, + + { + // Nintendo Switch Sports + id: '0100d2f00d5c0000', + client: '966534181783998474', + showPlayingOnline: true, + showActiveEvent: true, + }, + { + // Nintendo Switch Sports Online Play Test + id: '01000ee017182000', + client: '966534181783998474', + titleName: 'Online Play Test', + showPlayingOnline: true, + showActiveEvent: true, + }, + + { + // Fire Emblem Warriors: Three Hopes + id: '010071f0143ea000', + client: '966534448168439872', + showPlayingOnline: true, + showActiveEvent: true, + }, +]; diff --git a/src/discord/util.ts b/src/discord/util.ts index 5b5c4c6..73b1c31 100644 --- a/src/discord/util.ts +++ b/src/discord/util.ts @@ -1,6 +1,6 @@ import DiscordRPC from 'discord-rpc'; import { ActiveEvent, CurrentUser, Game, PresenceState } from '../api/znc-types.js'; -import titles, { defaultTitle } from './titles.js'; +import { defaultTitle, titles } from './titles.js'; import { getTitleIdFromEcUrl, hrduration } from '../util.js'; import { ZncDiscordPresence } from '../cli/nso/presence.js'; @@ -103,18 +103,56 @@ export function getTitleConfiguration(game: Game, id: string) { } export interface Title { - /** Lowercase hexadecimal title ID */ + /** + * Lowercase hexadecimal title ID. + * + * Valid title IDs are 16 characters long, and should start with `0100` and end with `0000`, `2000`, `4000`, `6000`, `8000`, `a000`, `c000`, `e000` (this is because applications have 4^16 title IDs for the application itself, plus addon content and update data). + */ id: string; - /** Discord client ID */ + /** + * Discord client ID + */ client: string; + /** + * Title name to show in Discord. This is *not* the name that will appear under the user's name after "Playing ". + * + * If this is set to true the title's name from znc will be used. + * If this is set to false (default) no title name will be set. This should be used when a specific Discord client for the title is used. + * If this is set to a string it will be used as the title name. + * + * @default false + */ titleName?: string | boolean; + /** + * By default the title's icon from znc will be used. (No icons need to be uploaded to Discord.) + */ largeImageKey?: string; + /** + * By default this will not be set. + */ smallImageKey?: string; + /** + * Whether to show the timestamp the user started playing the title in Discord. Discord shows this as the number of minutes and seconds since the timestamp; this will be inaccurate as it may take up to a minute (by default) to detect the user's presence, so this is disabled by default. + * + * @default false + */ showTimestamp?: boolean; - /** Show "Playing online" if playing online and the game doesn't set activity details */ + /** + * Show "Playing online" if playing online and the game doesn't set activity details. + * + * @default false + */ showPlayingOnline?: string | boolean; + /** + * Whether to show details of the current event (Online Lounge/voice chat) in Discord. + * + * @default false + */ showActiveEvent?: boolean; + /** + * A function to call to customise the Discord activity. + */ callback?: (activity: DiscordRPC.Presence, game: Game, context?: DiscordPresenceContext) => void; }