COMMENT
This shortcut was made by Annie of The Apple System (@theaaplfreak on Twitter). If you like this, please consider supporting us at https://ko-fi.com/theapplefreak! Thanks!
COMMENT
FILL THESE IN IF YOU'RE USING AN APPLE WATCH
BEGIN
Apple Watch Setup
SCRIPTING
Get the
Device Is Watch

Device Name
SCRIPTING
If
Device Is Watch
is
<value>
COMMENT
PluralKit token
You can get this by running
pk;token
in any Discord server with PluralKit.
TEXT
Text

Text
VARIABLES
Set variable
TOKEN
to
Text
COMMENT
Sort mode
This will change the order of members in the sort screen.
Valid options are (CASE SENSITIVE)
nameAsc - alphabetical sort, A to Z
nameDesc - alphabetical sort, Z to A
registeredAsc - oldest to newest
registeredDesc - newest to oldest
totalFront - most front time to least
lastFront - whoever fronted most recently, alphabetical sort after
TEXT
nameAsc

Text
VARIABLES
Set variable
PREF_SORT
to
Text
COMMENT
Show the current fronters at the switch select screen
This can slow down switch menu selection a little, depending on the number of fronters. It will also take up more screen space.
Valid options are (case insensitive)
yes / true / 1 (default)
no / false / 0
TEXT
yes

Text
VARIABLES
Set variable
PREF_SHOW_CURRENT_FRONTERS
to
Text
COMMENT
Show member avatars in the member select screens.
Depending on the size of your system, this can make load times a LOT worse and can potentially cause the shortcut to stop if the watch runs out of memory. Not recommended.
Valid options are (case insensitive)
yes / true / 1
no / false / 0 (default)
TEXT
no

Text
VARIABLES
Set variable
PREF_SHOW_AVATARS
to
Text
SCRIPTING
End If

If Result
COMMENT
Apple Watch Setup
END
COMMENT
Set up constants and such
DICTIONARY

Dictionary
VARIABLES
Set variable
ROUTINEHUB_INFO
to
Dictionary
DICTIONARY

Dictionary
VARIABLES
Set variable
TRUE
to
true
VARIABLES
Set variable
FALSE
to
false
TEXT
/PluralKit Switch

Text
VARIABLES
Set variable
DATA_DIR
to
Text
TEXT
https://api.pluralkit.me/v2

Text
VARIABLES
Set variable
PK_API
to
Text
COMMENT
Configure default intent/arguments
SCRIPTING
If
TRUE
is
<value>
SCRIPTING
Get the
Device Is Watch

Device Name
SCRIPTING
If
Device Is Watch
is
<value>
TEXT
SELECT_SWITCH_MEMBERS

Text
SCRIPTING
Otherwise
TEXT
MAIN_MENU

Text
SCRIPTING
End If

If Result
VARIABLES
Set variable
INTENT
to
If Result
DICTIONARY

Dictionary
VARIABLES
Set variable
INTENT_ARGUMENTS
to
Dictionary
SCRIPTING
End If

If Result
COMMENT
Determine the intent
SCRIPTING
If
TRUE
is
<value>
SCRIPTING
Get type of
Shortcut Input

Type
COMMENT
If the type is text, we can assume the user wishes to perform a switch, in which case it should be interpreted as a comma separated list of member IDs to register as switching in.
SCRIPTING
If
Type
is
Text
TEXT
REGISTER_SWITCH

Text
VARIABLES
Set variable
INTENT
to
Text
TEXT
Split
Shortcut Input
by
Custom
,

Split Text
SCRIPTING
Repeat with each item in
Split Text

Repeat Results
DOCUMENTS
Replace
with
World
in
Repeat Item

Updated Text
SCRIPTING
End Repeat

Repeat Results
DICTIONARY

Dictionary
SCRIPTING
Set
members
to
Repeat Results
in
Dictionary

Dictionary
VARIABLES
Set variable
INTENT_ARGUMENTS
to
Dictionary
SCRIPTING
Otherwise
SCRIPTING
If
Type
is
Dictionary
SCRIPTING
Get
Value
for
INTENT
in
Shortcut Input

Dictionary Value
SCRIPTING
Get the
Device Is Watch

Device Name
SCRIPTING
If
Device Is Watch
is
<value>
LIST

List
SCRIPTING
Otherwise
LIST

List
SCRIPTING
End If

If Result
SCRIPTING
If
If Result
contains
Dictionary Value
VARIABLES
Set variable
INTENT
to
Dictionary Value
SCRIPTING
Get
Value
for
ARGUMENTS
in
Shortcut Input

Dictionary Value
VARIABLES
Set variable
INTENT_ARGUMENTS
to
Dictionary Value
SCRIPTING
Otherwise
SCRIPTING
Get the
Device Is Watch

Device Name
SCRIPTING
If
Device Is Watch
is
<value>
TEXT
SELECT_SWITCH_MEMBERS

Text
SCRIPTING
Otherwise
TEXT
MAIN_MENU

Text
SCRIPTING
End If

If Result
VARIABLES
Set variable
INTENT
to
If Result
DICTIONARY

Dictionary
VARIABLES
Set variable
INTENT_ARGUMENTS
to
Dictionary
SCRIPTING
End If

If Result
SCRIPTING
Otherwise
SCRIPTING
Get the
Device Is Watch

Device Name
SCRIPTING
If
Device Is Watch
is
<value>
TEXT
SELECT_SWITCH_MEMBERS

Text
SCRIPTING
Otherwise
TEXT
MAIN_MENU

Text
SCRIPTING
End If

If Result
VARIABLES
Set variable
INTENT
to
If Result
DICTIONARY

Dictionary
VARIABLES
Set variable
INTENT_ARGUMENTS
to
Dictionary
SCRIPTING
End If

If Result
SCRIPTING
End If

If Result
SCRIPTING
End If

If Result
COMMENT
RESET_TOKEN
Clear the stored user token. Will set the intent to the default afterwards.
SCRIPTING
If
INTENT
is
RESET_TOKEN
DOCUMENTS

File
DOCUMENTS
TEXT
MAIN_MENU

Text
VARIABLES
Set variable
INTENT
to
Text
DICTIONARY

Dictionary
VARIABLES
Set variable
INTENT_ARGUMENTS
to
Dictionary
SCRIPTING
End If

If Result