Parameters
- player: Player
- msg:
| {
song: {
artist: string;
audioURL: string;
cover: string
| null;
hrefURL: string;
name: string;
};
startPos: number;
type: "player_pick_song";
}
| { answer?: string; answerIndex?: number; type: "select_answer" }
| { type: "start_game" }
| {
playlists: {
cover: string | null;
hrefURL: string;
name: string;
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
subtitle?: string;
}[];
type: "add_playlists";
}
| { index: number
| null; type: "remove_playlist" }
| { type: "change_username"; username: string }
| {
advancedSongFiltering: boolean;
allowChangingAnswer: boolean;
audioStartPosition: number | null;
distractionsPreferSameArtist: boolean;
endWhenAnswered: boolean;
gameMode: "multiple_choice" | "player_picks";
multipleChoiceAnswersCount: number;
playerPickTimeout: number;
roundsCount: number;
timePerQuestion: number;
type: "room_config";
}
| { playerName: string; type: "transfer_host" }
| { type: "return_to"; where: "lobby" | "results" }
| {
error?: string;
sourceMessage:
| { duration: number; offset: number; type: "progressbar_update" }
| {
song: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
};
startPos: number;
type: "player_pick_song";
}
| { answer?: string; answerIndex?: number; type: "select_answer" }
| { type: "start_game" }
| {
playlists: {
cover: string | null;
hrefURL: string;
name: string;
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
subtitle?: string;
}[];
type: "add_playlists";
}
| { index: number
| null; type: "remove_playlist" }
| { type: "change_username"; username: string }
| {
advancedSongFiltering: boolean;
allowChangingAnswer: boolean;
audioStartPosition: number | null;
distractionsPreferSameArtist: boolean;
endWhenAnswered: boolean;
gameMode: "multiple_choice" | "player_picks";
multipleChoiceAnswersCount: number;
playerPickTimeout: number;
roundsCount: number;
timePerQuestion: number;
type: "room_config";
}
| { playerName: string; type: "transfer_host" }
| { type: "return_to"; where: "lobby" | "results" }
| {
entry: LogEntry;
level: "error" | "info" | "warn" | "debug";
type: "add_log_message";
}
| { messages: LoggerStorage; type: "update_log_messages" }
| {
gamePhase: GamePhase;
question?:
| {
answerOptions: string[];
correctAnswerIndex?: number;
questionType: "multiple_choice";
startPos: number;
}
| {
correctAnswer?: {
artist: string;
audioURL: string;
cover: string
| null;
hrefURL: string;
name: string;
};
pickerId: string;
questionCount: number;
questionCurrent: number;
questionType: "player_picks";
startPos: number;
};
roundCurrent: number;
type: "round_state";
}
| { action: "load"; audioURL: string; type: "audio_control" }
| {
action:
| "play"
| "pause"
| "play_countdown_running"
| "play_countdown_end";
type: "audio_control";
}
| { countdown: number; type: "countdown" }
| {
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
type: "update_played_songs";
}
| {
filteredSongsCount: number;
playlists?: {
cover: string
| null;
hrefURL: string;
name: string;
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
subtitle?: string;
}[];
type: "update_playlists";
}
| {
players: Record<
string,
{
answerData?: {
answer?: string;
answerIndex?: number;
answerSpeed?: number;
answerTimestamp?: number;
questionPoints: number;
};
color: string;
hasPicked?: boolean;
isHost: boolean;
isSpectator: boolean;
points: number;
username: string;
uuid: string;
},
>;
state: "lobby"
| "results"
| "ingame";
type: "room_state";
uuid: string;
}
| { type: "other" };
type: "confirmation";
}
| { seq: number; type: "ping" }
| { seq: number; type: "pong" }
- {
song: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
};
startPos: number;
type: "player_pick_song";
}
-
song: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}
-
artist: string
-
audioURL: string
-
cover: string | null
-
hrefURL: string
-
name: string
-
startPos: number
-
type: "player_pick_song"
- { answer?: string; answerIndex?: number; type: "select_answer" }
-
Optionalanswer?: string
-
OptionalanswerIndex?: number
-
type: "select_answer"
- { type: "start_game" }
- {
playlists: {
cover: string | null;
hrefURL: string;
name: string;
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
subtitle?: string;
}[];
type: "add_playlists";
}
-
playlists: {
cover: string | null;
hrefURL: string;
name: string;
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
subtitle?: string;
}[]
-
type: "add_playlists"
- { index: number | null; type: "remove_playlist" }
-
index: number | null
-
type: "remove_playlist"
- { type: "change_username"; username: string }
-
type: "change_username"
-
username: string
- {
advancedSongFiltering: boolean;
allowChangingAnswer: boolean;
audioStartPosition: number | null;
distractionsPreferSameArtist: boolean;
endWhenAnswered: boolean;
gameMode: "multiple_choice" | "player_picks";
multipleChoiceAnswersCount: number;
playerPickTimeout: number;
roundsCount: number;
timePerQuestion: number;
type: "room_config";
}
-
advancedSongFiltering: boolean
-
allowChangingAnswer: boolean
-
audioStartPosition: number | null
-
distractionsPreferSameArtist: boolean
-
endWhenAnswered: boolean
-
gameMode: "multiple_choice" | "player_picks"
-
multipleChoiceAnswersCount: number
-
playerPickTimeout: number
-
roundsCount: number
-
timePerQuestion: number
-
type: "room_config"
- { playerName: string; type: "transfer_host" }
-
playerName: string
-
type: "transfer_host"
- { type: "return_to"; where: "lobby" | "results" }
-
type: "return_to"
-
where: "lobby" | "results"
- {
error?: string;
sourceMessage:
| { duration: number; offset: number; type: "progressbar_update" }
| {
song: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
};
startPos: number;
type: "player_pick_song";
}
| { answer?: string; answerIndex?: number; type: "select_answer" }
| { type: "start_game" }
| {
playlists: {
cover: string | null;
hrefURL: string;
name: string;
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
subtitle?: string;
}[];
type: "add_playlists";
}
| { index: number
| null; type: "remove_playlist" }
| { type: "change_username"; username: string }
| {
advancedSongFiltering: boolean;
allowChangingAnswer: boolean;
audioStartPosition: number | null;
distractionsPreferSameArtist: boolean;
endWhenAnswered: boolean;
gameMode: "multiple_choice" | "player_picks";
multipleChoiceAnswersCount: number;
playerPickTimeout: number;
roundsCount: number;
timePerQuestion: number;
type: "room_config";
}
| { playerName: string; type: "transfer_host" }
| { type: "return_to"; where: "lobby" | "results" }
| {
entry: LogEntry;
level: "error" | "info" | "warn" | "debug";
type: "add_log_message";
}
| { messages: LoggerStorage; type: "update_log_messages" }
| {
gamePhase: GamePhase;
question?:
| {
answerOptions: string[];
correctAnswerIndex?: number;
questionType: "multiple_choice";
startPos: number;
}
| {
correctAnswer?: {
artist: string;
audioURL: string;
cover: string
| null;
hrefURL: string;
name: string;
};
pickerId: string;
questionCount: number;
questionCurrent: number;
questionType: "player_picks";
startPos: number;
};
roundCurrent: number;
type: "round_state";
}
| { action: "load"; audioURL: string; type: "audio_control" }
| {
action:
| "play"
| "pause"
| "play_countdown_running"
| "play_countdown_end";
type: "audio_control";
}
| { countdown: number; type: "countdown" }
| {
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
type: "update_played_songs";
}
| {
filteredSongsCount: number;
playlists?: {
cover: string
| null;
hrefURL: string;
name: string;
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
subtitle?: string;
}[];
type: "update_playlists";
}
| {
players: Record<
string,
{
answerData?: {
answer?: string;
answerIndex?: number;
answerSpeed?: number;
answerTimestamp?: number;
questionPoints: number;
};
color: string;
hasPicked?: boolean;
isHost: boolean;
isSpectator: boolean;
points: number;
username: string;
uuid: string;
},
>;
state: "lobby"
| "results"
| "ingame";
type: "room_state";
uuid: string;
}
| { type: "other" };
type: "confirmation";
}
-
Optionalerror?: string
-
sourceMessage:
| { duration: number; offset: number; type: "progressbar_update" }
| {
song: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
};
startPos: number;
type: "player_pick_song";
}
| { answer?: string; answerIndex?: number; type: "select_answer" }
| { type: "start_game" }
| {
playlists: {
cover: string | null;
hrefURL: string;
name: string;
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
subtitle?: string;
}[];
type: "add_playlists";
}
| { index: number
| null; type: "remove_playlist" }
| { type: "change_username"; username: string }
| {
advancedSongFiltering: boolean;
allowChangingAnswer: boolean;
audioStartPosition: number | null;
distractionsPreferSameArtist: boolean;
endWhenAnswered: boolean;
gameMode: "multiple_choice" | "player_picks";
multipleChoiceAnswersCount: number;
playerPickTimeout: number;
roundsCount: number;
timePerQuestion: number;
type: "room_config";
}
| { playerName: string; type: "transfer_host" }
| { type: "return_to"; where: "lobby" | "results" }
| {
entry: LogEntry;
level: "error" | "info" | "warn" | "debug";
type: "add_log_message";
}
| { messages: LoggerStorage; type: "update_log_messages" }
| {
gamePhase: GamePhase;
question?:
| {
answerOptions: string[];
correctAnswerIndex?: number;
questionType: "multiple_choice";
startPos: number;
}
| {
correctAnswer?: {
artist: string;
audioURL: string;
cover: string
| null;
hrefURL: string;
name: string;
};
pickerId: string;
questionCount: number;
questionCurrent: number;
questionType: "player_picks";
startPos: number;
};
roundCurrent: number;
type: "round_state";
}
| { action: "load"; audioURL: string; type: "audio_control" }
| {
action:
| "play"
| "pause"
| "play_countdown_running"
| "play_countdown_end";
type: "audio_control";
}
| { countdown: number; type: "countdown" }
| {
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
type: "update_played_songs";
}
| {
filteredSongsCount: number;
playlists?: {
cover: string
| null;
hrefURL: string;
name: string;
songs: {
artist: string;
audioURL: string;
cover: string | null;
hrefURL: string;
name: string;
}[];
subtitle?: string;
}[];
type: "update_playlists";
}
| {
players: Record<
string,
{
answerData?: {
answer?: string;
answerIndex?: number;
answerSpeed?: number;
answerTimestamp?: number;
questionPoints: number;
};
color: string;
hasPicked?: boolean;
isHost: boolean;
isSpectator: boolean;
points: number;
username: string;
uuid: string;
},
>;
state: "lobby"
| "results"
| "ingame";
type: "room_state";
uuid: string;
}
| { type: "other" }
-
type: "confirmation"
- { seq: number; type: "ping" }
- { seq: number; type: "pong" }
Returns boolean
whether the message was handled by this listener.
Whether to perform advanced filtering tactics when generating the songs array. Currently just ignores parens when filtering for identical song names.