-
Notifications
You must be signed in to change notification settings - Fork 10
Controller Methods
(mapUid: string): Promise<number | undefined>
Fetches map database id
-
mapUidMap uid -
ReturnsMap id or undefined if map is not in database
(mapUids: string[]): Promise<{ uid: string, id: number }[]>
Fetches multiple map database ids
-
mapUidsArray of map uids -
ReturnsArray of objects containing map id and uid. If map is not in the database it won't be in the array
(login: string): Promise<number | undefined>
Fetches player database id
-
loginPlayer login -
ReturnsPlayer id or undefined if player is not in database
(logins: string[]): Promise<{ login: string, id: number }[]> Fetches multiple player database ids.
-
loginsPlayer login -
ReturnsArray of objects containing player id and login. If map is not in the database it won't be in the array
(query: string, ...params: any[]): Promise<any[] | Error>
Executes a query on the database
-
queryQuery to execute -
ReturnsDatabase response or error on invalid query
(): Promise<(query: string, ...params: any[]) => Promise<any[] | Error>>
Initializes a database client and returns a function which executes database queries using the client.
Client queries are handled by a separate thread which makes them a bit faster. Use this only if your plugin needs to execute database queries very frequently. Only a few clients can be active at the same time, if there is too many the program might hang.
-
ReturnsFunction to execute database queries using the client
(mapId: string): Promise<tm.TMXMap | Error>
Fetches TMX for map information.
-
mapIdmap UID -
ReturnsMap info from TMX or error if unsuccessful static async fetchMapInfo(tmxId: number, prefix: TMXPrefix): Promise<Omit<tm.TMXMap, 'id'> | Error>
Fetches TMX for map information. -
tmxIdMap TMX ID -
ReturnsMap info from TMX or error if unsuccessful
(mapId: string): Promise<{ name: string, content: Buffer } | Error>
Fetches map file from TMX via its UID.
-
mapIdMap UID -
ReturnsObject containing map name and file content, or Error if unsuccessfull
(tmxId: number, site?: tm.TMXSite): Promise<{ name: string, content: Buffer } | Error>
Fetches map file from TMX via its TMX ID.
-
tmxIdMap TMX ID -
siteOptional TMX site (TMNF by default) -
Objectcontaining map name and file content, or Error if unsuccessfull
(query?: string, site: tm.TMXSite = 'TMNF', count: number = config.defaultTMXSearchLimit): Promise<Error | tm.TMXSearchResult[]>
Searches for maps matching the specified name on TMX.
-
querySearch query -
siteTMX Site to fetch from -
countNumber of maps to fetch -
ReturnsAn array of searched map objects or Error if unsuccessfull
(site: tm.TMXSite = 'TMNF'): Promise<{ name: string, content: Buffer } | Error>
Fetches a random map file from TMX.
-
siteOptional TMX site (TMNF by default) -
ReturnsObject containing map name and file content, or Error if unsuccessfull
(login: string): Readonly<tm.Player & { currentCheckpoints: Readonly<Readonly<tm.Checkpoint>[]> }> | undefined
Gets the player information from runtime memory. Only online players are stored.
-
loginPlayer login -
ReturnsPlayer object or undefined if the player isn't online
(logins: string[]): Readonly<tm.Player & { currentCheckpoints: Readonly<Readonly<tm.Checkpoint>[]> }>[]
Gets multiple players information from runtime memory. Only online players are stored If some player is not online he won't be returned. Returned array is not in initial order.
-
loginsArray of player logins -
ReturnsArray of player objects
(login: string): Promise<tm.OfflinePlayer | undefined>
Fetches a player from the database. This method should be used to get players who are not online.
-
loginPlayer login -
ReturnsPlayer object or undefined if player is not in the database
(logins: string[]): Promise<tm.OfflinePlayer[]>
Fetches multiple players from the database. This method should be used to get players who are not online of some player is not present in the database he won't be returned. Returned array is not in initial order.
-
loginsArray of player logins -
ReturnsPlayer objects array
All online players.
Number of online players.
Number of all players who visited the server.
(login: string): tm.LocalRecord | undefined
Gets the players local record on the current map.
-
loginPlayer login -
ReturnsLocal record object or undefined if the player doesn't have a local record
(logins: string[]): tm.LocalRecord[]
Gets multiple local records on the current map from runtime memory. If some player has no local record his record object wont be returned. Returned array is sorted primary by time ascending, secondary by date ascending.
-
loginsArray of player logins -
ReturnsArray of local record objects
(login: string): tm.FinishInfo | undefined
Gets the players live record
-
loginPlayer login -
ReturnsLive record object or undefined if the player doesn't have a live record
(logins: string[]): tm.FinishInfo[]
Gets multiple live records If some player has no live record his record object wont be returned.Returned array is sorted primary by time ascending, secondary by date ascending.
-
loginsArray of player logins -
ReturnsArray of live record objects
(...mapIds: string[]): tm.Record[]
Gets local records on the given map if it's in map queue. Returned array is sorted primary by queue position ascending, time ascending and date ascending.
-
madIdsArray of map ids -
ReturnsArray of record objects
(login: string, mapId: string): tm.Record | undefined
Gets local record of the given player, on the given map if it's in map queue.
-
loginPlayer login -
mapIdMap id -
ReturnsRecord object or undefined if record doesn't exist
(...mapIds: string[]): tm.Record[]
Gets local records on the given map if it's in map history. Returned array is sorted primary by history position ascending, time ascending and date ascending.
-
mapIdsArray of map ids -
ReturnsArray of record objects
(login: string, mapId: string): tm.Record | undefined
Gets local record of the given player, on the given map if it's in map history.
-
loginPlayer login -
ReturnsRecord object or undefined if record doesn't exist
(player: { login: string, nickname: string }, mapId: string, caller?: { login: string, nickname: string }): void
Removes a player record.
-
playerPlayer object -
mapIdMap uid -
callerCaller player object
(mapId: string, caller?: { login: string, nickname: string }): void
Removes all records on a given map.
-
mapIdMap uid -
callerCaller player object -
ReturnsDatabase response
(...mapIds: string[]): Promise<tm.Record[]>
Fetches local records for given logins from the database. Returned array is sorted primary by time ascending, secondary by date ascending.
-
mapIdsMap uids -
ReturnsArray of record objects
(laps: number, ...mapIds: string[]): Promise<tm.Record[]>
Fetches local records on given maps with specified laps amount from the database. Returned array is sorted primary by time ascending, secondary by date ascending.
-
mapIdsMap uids -
lapsRecord laps amount -
ReturnsArray of record objects
(mapId: string, login: string): Promise<tm.Record | undefined>
Fetches a given player record on a given map.
-
mapIdMap uid -
loginPlayer login -
lapsRecord laps amount (fetches TimeAttack record if undefined) -
ReturnsRecord object or undefined if player has no record
(...logins: string[]): Promise<tm.Record[]>
Fetches local records for given logins from the database. Returned array is sorted primary by time ascending, secondary by date ascending.
-
loginsPlayer logins -
ReturnsArray of record objects
(login: string): Promise
Fetches number of records a player has in the database.
-
loginPlayer login -
ReturnsNumber of records
(login: string, mapId: string): number | undefined
Gets given player local rank on given map.
-
loginPlayer login -
mapIdMap uid -
ReturnsRank or undefined if player doesn't have a record
(login: string, mapIds?: string[]): { mapId: string, rank: number }[]
Gets given player local ranks on given maps.
-
loginPlayer login -
mapIdsArray of map uids -
ReturnsArray of objects with player ranks and map uids
(login: string): { mapId: string, rank: number }[]
Gets given player local ranks on all maps.
-
loginPlayer login -
ReturnsArray of objects with player ranks and map uids
(login: string): tm.LocalRecord | undefined
Gets the players lap record on the current map. If the map is not in laps mode returns a local record instead.
-
loginPlayer login -
ReturnsLap record object or undefined if the player doesn't have a lap record
(logins: string[]): tm.LocalRecord[]
Gets multiple lap records on the current map from runtime memory. If the map is not in laps mode returns local records instead. If some player has no lap record his record object wont be returned. Returned array is sorted primary by time ascending, secondary by date ascending.
-
loginArray of player logins -
ReturnsArray of lap record objects
(login: string): tm.FinishInfo | undefined
Gets the players current round record.
-
loginPlayer login -
ReturnsRound record object or undefined if the player doesn't have a round record
(logins: string[]): tm.FinishInfo[]
Gets multiple round records. If some player has no round record his record object wont be returned. Returned array is sorted primary by time ascending, secondary by date ascending.
-
loginsArray of player logins -
ReturnsArray of round record objects
Current map local records.
Number of local records on the current map.
Current live records.
Number of live records.
Maximum amount of local records. All local records get fetched, but only the ones below max amount count towards server rank.
Current map lap records. Same as local records if the map is not in multilap mode.
Number of lap records on the current map. Same as local records if the map is not in multilap mode.
Current round records.
Number of current round records.
(login: string): tm.FinishInfo | undefined
Gets the players current round record.
-
loginPlayer login -
ReturnsRound record object or undefined if the player doesn't have a round record
(logins: string[]): tm.FinishInfo[]
Gets multiple round records. If some player has no round record his record object wont be returned. Returned array is sorted primary by time ascending, secondary by date ascending.
-
loginsArray of player logins -
ReturnsArray of round record objects
Current round records.
Number of current round records.
Current team scores (Teams mode only).
Point system for Rounds and Cup mode.
Amount of points to end the map in Rounds mode.
Amount of points to become a finalist in Cup mode.
Amount of points to end map in Teams mode.
Current round points ranking (Rounds/Cup mode only).
Max amount of winners in Cup mode.
Current Cup winners (Cup mode only).
(options: { limit?: number; date?: Date; }): Promise<tm.Message[]>
Fetches chat messages.
-
optionsLimit is maximum amount of fetched messages, date is timestamp after which messages will be fetched. -
ReturnsArray of message objects
(login: string, options: { limit?: number; date?: Date; }): Promise<tm.Message[]>
Fetches chat messages written by specified player.
-
loginPlayer login -
optionsLimit is maximum amount of fetched messages, date is timestamp after which messages will be fetched -
ReturnsArray of message objects
(login: string): Readonly<tm.Message>[]
Gets recent chat messages written by specified player.
-
loginPlayer login -
ReturnsArray of message objects
(callback: MessageFunction, position: number): void
Registers a function to add a prefix or postfix to chat messages when using manual chat routing.
-
callbackThe function takes MessageInfo object and returns string (the prefix) or undefined (then its ignored) -
positionPrefixes are positioned based on this, lowest one is first, negative values are positioned before the nickname, positive after it
(callback: MessageFunction, importance: number)
Registers a function to modify the player name on chat message.
-
callbackThe function takes MessageInfo object and returns string (the name) or undefined (then its ignored) -
importanceIn case multiple functions are registered the most important one will be executed. If it returns undefined the 2nd most important function will be executed and so on
(callback: ModifyTextFunction, importance: number)
Registers a function to modify chat message text.
-
callbackThe function takes MessageInfo object and returns string (the name), error (prevents message from being sent) or undefined (then its ignored) -
importanceIn case multiple functions are registered the most important one will be executed. If it returns undefined the 2nd most important will be executed and so on
Recent chat messages.
Number of recent chat messages.
(...commands: tm.Command[]): void
Adds chat commands to the server.
-
commandsChat commands to register
All registered chat commands.
(method: string, params: tm.CallParams[] = []): Promise<any | Error>
Calls a dedicated server method and awaits the response.
-
methodDedicated server method to be executed -
paramsOptional params for the dedicated server method -
ReturnsServer response or error if the server returns one
(method: 'system.multicall', params: tm.Call[] = []): Promise<({ method: string, params: any } | Error)[] | Error>
Calls multiple dedicated server methods using system.multicall and awaits the response.
-
method'system.multicall' -
paramsArray of Call objects -
ReturnsArray of server responses or error if the server returns one
(method: string, params: tm.CallParams[] = []): void
Calls a dedicated server method without caring for the response.
-
methodDedicated server method to be executed -
paramsOptional params for the dedicated server method
(method: 'system.multicall', params: tm.Call[] = []): void
Calls multiple dedicated server methods using system.multicall without caring for the response.
-
method'system.multicall' -
paramsArray of Call objects
(methods: string[], callback: ((method: string, params: tm.CallParams[], response: any) => void)): void
Adds a callback listener which will be executed when one of the specified dedicated server methods gets called.
-
methodsArray of dedicated server methods -
callbackCallback to execute
(uid: string): Readonly<tm.Map> | undefined
Gets a map from current playlist. Playlist is stored in runtime memory.
-
uidMap uid -
Returnsmap object or undefined if map is not in the playlist
(uids: string[]): Readonly<tm.Map>[]
Gets multiple maps from current playlist. Playlist is stored in runtime memory. If some map is not present in memory it won't be returned. Returned array is not in the initial order.
-
uidsArray of map uids -
ReturnsArray of map objects
(uid: string): Promise<tm.Map | undefined>
Fetches a map from the database. This method should be used to get maps which are not in the current Match Settings.
-
uidsArray of map uid -
ReturnsMap object or undefined if map is not in the database
(uids: string[]): Promise<tm.Map[]> Fetches multiple maps from the database. This method should be used to get maps which are not in the current Match Settings. If some map is not present in the database it won't be returned. Returned array is not in the initial order.
-
uidsArray of map uids -
ReturnsMap objects array
(filename: string, caller?: { login: string, nickname: string }, dontJuke: boolean = false): Promise<tm.Map | Error>
Adds a map to the server. Map needs to be present in the server files.
-
filenamePath to the map file -
callerObject containing login and nickname of the player who is adding the map -
dontJukeIf true the map doesn't get enqueued, false by default -
ReturnsAdded map object or error if unsuccessful
(fileName: string, file: Buffer, caller?: { nickname: string, login: string }, options?: { dontJuke?: boolean, cancelIfAlreadyAdded?: boolean }): Promise<{ map: tm.Map, wasAlreadyAdded: boolean } | Error>
Writes a map file to the server, adds it to the current Match Settings and to the jukebox.
-
fileNameMap file name (file will be saved with this name on the server) -
fileMap file buffer -
callerObject containing login and nickname of the player who is adding the map -
optionsOptional parameters:-
dontJukeIf true the map doesn't get enqueued, false by default -
cancelIfAlreadyAdded- If the map was already on the server returns from the function without searching for the map object. If that happens the map in returned object will be undefined.
-
-
ReturnsError if unsuccessfull, object containing map object and boolean indicating whether the map was already on the server
(id: string, caller?: { login: string, nickname: string }): Promise<boolean | Error>
Removes a map from the server.
-
idMap uid -
callerObject containing login and nickname of the player who is removing the map -
ReturnsTrue if map was successfuly removed, false if map was not in the map list, Error if server fails to remove the map
All maps from current playlist.
Currently played map.
Amount of maps in current playlist.
(...lines: any[]): Promise
Outputs an fatal error message into the console and exits the process.
-
linesMessage lines
(...lines: any[]): Promise
Outputs an error message into the console.
-
linesMessage lines
(...lines: any[]): Promise
Outputs a warn message into the console.
-
linesMessage lines
(...lines: any[]): Promise
Outputs an info message into the console.
-
linesMessage lines
(...lines: any[]): Promise
Outputs a debug message into the console.
-
linesMessage lines
(...lines: any[]): Promise
Outputs a trace message into the console.
-
linesMessage lines
(mapId: string, caller?: { login: string, nickname: string }, setAsNextMap?: true): Promise<void | Error>
Adds map to the queue.
-
mapIdMap UID -
callerObject containing login and nickname of player adding the map -
setAsNextMapIf true map is going to be placed in front of the queue -
ReturnsTrue if successfull, Error if map is not in the memory
(mapId: string, caller?: { login: string, nickname: string }): Promise
Removes a map from the queue.
-
mapidMap UID -
callerObject containing login and nickname of player removing the map -
ReturnsTrue if the map was in the jukebox, false if it wasn't
(caller?: { login: string, nickname: string }): Promise
Removes all maps from the jukebox.
-
callerObject containing login and nickname of player clearing the jukebox
(caller?: { login: string, nickname: string }): Promise
Randomly changes the order of maps in the maplist.
-
callerObject containing login and nickname of the player who called the method
(uid: string): Readonly<tm.Map> | undefined
Gets a map from the queue.
-
uidMap uid -
ReturnsMap object or undefined if map is not in the queue
(uids: string[]): Readonly<tm.Map>[]
Gets multiple maps from queue. If some map is not present in queue it won't be returned. Returned array is not in initial order.
-
uidsArray of map uids -
ReturnsArray of map objects
(uid: string): Readonly<{ map: tm.Map, callerLogin?: string }> | undefined
Gets a map from the jukebox.
-
uidMap uid -
ReturnsJukebox object or undefined if map is not in the jukebox
(uids: string[]): Readonly<{ map: tm.Map, callerLogin?: string }>[]
Gets multiple maps from jukebox. If some map is not present in jukebox it won't be returned. Returned array is not in initial order.
-
uidsArray of map uids -
ReturnsArray of jukebox objects
(uid: string): Readonly<tm.Map> | undefined
Gets a map from map history.
-
uidMap uid -
ReturnsMap object or undefined if map is not in the history
(uids: string[]): Readonly<tm.Map>[]
Gets multiple maps from map history. If some map is not present in history it won't be returned. Returned array is not in initial order.
-
uidsArray of map uids -
ReturnsArray of map objects
Amout of maps in the queue (maps juked by the players and the server). This is always equal to maxQueueCount.
Amount of maps in the history.
Max amount of maps in the queue (maps juked by the players and the server).
Max amount of maps in the history.
Amount of maps juked by the players.
Map queue (maps juked by the players and the server).
Map history.
Currently played map.
Maps juked by the players.
(player: { login: string, nickname?: string }, vote: -3 | -2 | -1 | 1 | 2 | 3): void
Adds a vote on the current map to runtime memory and database.
-
playerPlayer object -
voteVote value
(votes: { login: string, vote: -3 | -2 | -1 | 1 | 2 | 3 }[]): void
Adds multiple votes on the current map to runtime memory and database.
-
votesVote objects
(mapId: string): Promise<tm.Vote[] | undefined>
Fetches all the player votes for a given map UID.
-
mapIdMap UID -
ReturnsArray of vote objects or undefined if map is not in the database
(mapIds: string[]): Promise<{ uid: string, votes: tm.Vote[] }[]>
Fetches all the player votes for given map UIDs.
-
MapIdsArray of Map UIDs -
ReturnsArray of objects containing map UID and vote objects array. If some map is not in the database it won't be in the returned array
(uid: string): tm.Vote[] | undefined
Gets all the player votes for given map UID from the runtime memory. Only votes for maps in the history, queue and the current map are stored.
-
uidMap UID -
ReturnsArray of vote objects or undefined if map is not in the memory
(uids: string[]): { uid: string, votes: tm.Vote[] }[] Gets all the player votes for given map UIDs from the runtime memory. Only votes for maps in the history, queue and the current map are stored.
-
uidsArray of Map UIDs -
ReturnsArray of objects containing map UID and vote objects array. If some map is not in the memory it won't be in the returned array.
Current map votes.
Current map vote count.
All votes in runtime memory. Only votes for maps in the history, queue and the current map are stored.
(): void
Enables the dynamic timer after map change. Dynamic timer
allows players to change remaining race time in real time.
(): void
Disables the dynamic timer after map change.
(): boolean
Pauses the timer. This method works only if dynamic timer is enabled and server is in 'race' state.
-
ReturnsBoolean indicating whether the timer got paused
(): boolean
Resumes the timer. This method works only if dynamic timer is enabled and server is in 'race' state.
-
ReturnsBoolean indicating whether the timer got resumed
(miliseconds: number): boolean
Sets remaining race time. If the time is lower than "dynamicTimerSubtractionLimit" from config it will be set to it. This method works only if dynamic timer is enabled and server is in 'race' state.
-
milisecondsAmount of time to set in miliseconds -
ReturnsBoolean indicating whether the time got set
(miliseconds: number): boolean
Adds remaining race time. This method works only if dynamic timer is enabled and server is in 'race' state.
-
milisecondsAmount of time to add in miliseconds -
ReturnsBoolean indicating whether the time got added
(miliseconds: number): boolean
Subtracts remaining race time. If the time is lower than "dynamicTimerSubtractionLimit" from config it will be set to it. This method works only if dynamic timer is enabled and server is in 'race' state.
-
milisecondsAmount of time to subtract in miliseconds -
ReturnsBoolean indicating whether the time got subtracted
Remaining race time in miliseconds.
Remaining result screen time in miliseconds.
Race time limit in the current round.
Result time limit in the current round.
Timestamp at which the current map has started.
Boolean indicating whether the dynamic timer is paused.
Boolean indicating whether the dynamic timer is enabled.
Boolean indicating whether the dynamic timer will be enabled in the next round.
(login: string, privilege: number, caller?: { login: string, nickname: string }): Promise
Sets a player privilege level.
-
loginPlayer login -
privilegePrivilege level to set -
callerOptional caller player object
(ip: string, login: string, caller: { login: string, privilege: number, nickname: string }, nickname?: string, reason?: string, expireDate?: Date): Promise
Bans, blacklists and kicks a player. If player is not on the server adds him to banOnJoin array. Adds him to banlist table.
-
ipPlayer IP address -
loginPlayer login -
callerCaller player object -
nicknameOptional player nickname -
reasonOptional ban reason -
expireDateOptional ban expire date -
ReturnsTrue if successful, false if caller privilege is too low or if it's not higher than target privilege
(login: string, caller?: { login: string, privilege: number, nickname: string }): Promise<boolean | 'Player not banned' | Error>
Unbans a player and unblacklists him if he is not blacklisted. Deletes all ips tied to his login from the banlist table.
-
loginPlayer login -
callerCaller player object -
ReturnsTrue if successful, false if caller privilege is too low, 'Player not banned' if player was not banned and Error if dedicated server call fails.
(login: string, caller: { login: string, privilege: number, nickname: string },nickname?: string, reason?: string, expireDate?: Date): Promise<boolean | Error>
Blacklists and kicks a player, adds him to blacklist table. Saves the server blacklist.
-
loginPlayer login -
callerCaller player object -
nicknameOptional player nickname -
reasonOptional blacklist reason -
expireDateOtional blacklist expire date -
ReturnsTrue if successful, false if caller privilege is too low or if it's not higher than target privilege, Error if dedicated server call fails
(login: string, caller?: { login: string, privilege: number, nickname: string }): Promise<boolean | 'Player not blacklisted' | Error>
Unblacklists a player if he is not banned and deletes him from blacklist table. Saves the server blacklist.
-
loginPlayer login -
callerCaller player object -
ReturnsTrue if successful, false if caller privilege is too low, 'Player not blacklisted' if player was not blacklisted and Error if dedicated server call fails
(login: string, caller: { login: string, privilege: number, nickname: string }, nickname?: string, reason?: string, expireDate?: Date): Promise
Mutes a player and adds him to mutelist table.
-
loginPlayer login -
callerCaller player object -
nicknameOptional player nickname -
reasonOptional mute reason -
expireDateOptional mute expire date -
ReturnsTrue if successful, false if caller privilege is too low
(login: string, caller?: { login: string, privilege: number, nickname: string }): Promise<boolean | 'Player not muted' | Error>
Unmutes a player and deletes him from mutelist table
-
loginPlayer login -
callerCaller player object -
ReturnsTrue if successful, false if caller privilege is too low, 'Player not muted' if player was not muted, Error if dedicated server call fails
(login: string, caller: { login: string, privilege: number, nickname: string }, nickname?: string): Promise<boolean | 'Already guest' | Error>
Adds a player to server guestlist, saves it and adds him to guestlist table.
-
loginPlayer login -
callerCaller player object -
nicknameOptional player nickname -
ReturnsTrue if successful, false if caller privilege is too low, 'Already guest' if player was already in the guestlist, Error if server call fails
(login: string, caller?: { login: string, privilege: number, nickname: string }): Promise<boolean | 'Player not in guestlist' | Error>
Removes a player from server guestlist, saves it and deletes him from guestlist table.
-
loginPlayer login -
callerCaller player object -
ReturnsTrue if successful, false if caller privilege is too low, 'Player not in guestlist' if player was not in the guestlist, Error if dedicated server call fails
(login: string): Readonly<tm.BanlistEntry> | undefined Gets ban information for given login.
-
loginPlayer login -
ReturnsBan object or undefined if the player isn't banned
(logins: string[]): Readonly<tm.BanlistEntry>[] Gets multiple bans information for given logins.
-
loginsArray of player logins -
ReturnsArray of ban objects
(login: string): Readonly<tm.BlacklistEntry> | undefined
Gets blacklist information for given login.
-
loginPlayer login -
ReturnsBlacklist object or undefined if the player isn't blacklisted
(logins: string[]): Readonly<tm.BlacklistEntry>[]
Gets multiple blacklists information for given logins
-
loginsArray of player logins -
ReturnsArray of blacklist objects
(login: string): Readonly<tm.MutelistEntry> | undefined
Gets mute information for given login.
-
loginPlayer login -
ReturnsMute object or undefined if the player isn't muted
(logins: string[]): Readonly<tm.MutelistEntry>[]
Gets multiple mutes information for given logins.
-
loginsArray of player logins -
ReturnsArray of mute objects
(login: string): Readonly<tm.GuestlistEntry> | undefined Gets guest information for given login.
-
loginPlayer login -
ReturnsGuest object or undefined if the player isn't in the guestlist
(logins: string[]): Readonly<tm.GuestlistEntry>[] Gets multiple guests information for given logins.
-
loginsArray of player logins -
ReturnsArray of guest objects
Banned players.
Blacklisted players.
Muted players.
Server guests.
Number of banned players.
Number of blacklisted players.
Number of muted players.
Number of guests.
Privilege levels for each of the administrative actions.
Relative path (/GameData/Config/) to the blacklist file.
Relative path (/GameData/Config/) to the guestlist file.
Controller config.
Current dedicated server config.
Current game config.
(time: number): string
Formats time for prettier display.
-
timeTime to format -
ReturnsFormatted time string (eg. 25:12.63, 0:56.92)
(pos: number): string Adds an ordinal suffix to numbers.
-
posNumber to add the suffix to -
ReturnsNumber with the suffix (eg. 1st, 9th)
(str: string, removeColours: boolean = true): string
Removes all Trackmania specific formatting (e.g. $w, $fff, etc.) from the supplied string.
-
strString to strip formatting from -
removeColoursWhether to remove colours from the string, defaults to true -
ReturnsString without formatting
(str: string): string
Attempts to convert supplied string to latin text based on the special charmap.
-
strString to convert -
ReturnsConverted string
(region: string): { region: string, country: string, countryCode?: string }
Gets country information from region in Nadeo format (eg. World|Poland|Pomorskie)
-
regionRegion in Nadeo format, can start with World but doesn't have to -
ReturnsObject containing parsed region (eg. Poland|Pomorskie), country and country code (eg. POL) if matching one was found
(searchString: string, possibleMatches: string[], stripSpecialChars?: true): { str: string, value: number }[]
Checks similarity of given strings, returns best matches sorted based on similarity.
-
searchStringString to compare possible matches to -
possibleMatchesArray of strings to sort by similarity -
stripSpecialCharsIf true special characters get in strings get replaced with latin if possible -
ReturnsArray of objects containing string and its similarity value
matchString<T extends { [key: string]: any }>(searchString: string, possibleMatches: T[], key: keyof T, stripSpecialChars?: true): { obj: T, value: number }[]
Checks similarity of given strings in an array of objects, returns best matches sorted based on similarity.
-
searchStringString to compare possible matches to -
possibleMatchesArray of objects to sort by similarity -
keyKey in objects containing the string to compare -
stripSpecialCharsIf true special characters get in strings get replaced with latin if possible -
ReturnsArray of objects containing object and its similarity value
(country: string): string | undefined
Gets the country code (non-ISO) for the specified country name
-
countryCountry name (eg. Poland) -
ReturnsCountry code (eg. POL)
(current: { time: number, position: number }, previous?: { time: number, position: number }): { status: '' | 'acquired' | 'obtained' | 'equaled' | 'improved', difference?: string }
Gets the appropriate verb and calculates record differences.
-
currentObject containing current record time and position -
previousOptional object containing previous record time and position -
ReturnsObject containing the verb to use (eg. 'acquired', 'improved') and the time difference string if previous record was specified
(payerLogin: string, amount: number, message: string, targetLogin: string = ''): Promise<boolean | Error>
Sends coppers with specified parameters.
-
payerLoginLogin of the payee -
amountCoppers amount -
messageMessage to attach in the in-game mail -
targetLoginLogin of the receiver -
ReturnsWhether the payment went through or error
(targetLogin: string, amount: number, message: string): Promise<true | Error>
Pays coppers from the server with specified parameters.
-
targetLoginLogin of the receiver -
amountCoppers amount -
messageMessage to attach in the in-game mail -
ReturnsTrue on payment success or error
(ms: number): string
Converts milliseconds to humanly readable time.
-
msTime to convert (in milliseconds) -
ReturnsHumanly readable time string (eg. 2 hours, 12 minutes and 30 seconds)
(str: string): string
Removes certain HTML tags that may harm XML manialinks.
-
strOriginal string -
ReturnsEscaped string
(url: string): string
In Trackmania, https links won't work
-
urlOriginal URL -
ReturnsURL that will likely function properly
(nickname: string, options?: { similarityGoal: number,minDifferenceBetweenMatches: number): tm.Player | undefined
Attempts to convert the player nickname to their login via charmap.
-
nicknamePlayer nickname -
optionsOptions to modify search similarity goals -
ReturnsPossibly matching login or undefined if unsuccessful
(dateStr: string): number | Error
Converts date string to time in miliseconds. This method is used to parse time in chat commands.
-
dateStrDate string, number followed by optional modifier [s - seconds, m - minutes, h - hours, d - days]). If no modifier is specified the number will be treated as minutes. -
ReturnsTime in miliseconds -
ThrowsTime in miliseconds, RangeError if time is bigger than max js Date, TypeError if the dateStr is not a valid date string
(date: Date, displayDay?: true): string
Formats date into calendar display.
-
dateDate to be formatted -
displayDayWhether to display day -
ReturnsFormatted date string (dd/mm/yyyy)
(commandParams: tm.Command['params']): string
Creates string representation of chat command parameters.
-
commandParamsChat command paramaters -
ReturnsStringified parameters (eg. login , duration[, count, reason])
(coppers: number): number
Calculates nadeo tax for given coppers amount and subtracts it from the amount. Nadeo tax formula: https://docs.google.com/spreadsheets/d/1B_WUKayLJAMCklKaGrrjQZve1JJyFQ7h6SrbO0qdqkQ/pubhtml
-
coppersCoppers amount -
ReturnsCoppers amount after subtracting tax
(str: string, variables: { [name: string]: any }): string
Replaces #{variableName} in string with given variables.
-
strString to replace #{variableName} in -
variablesObject containing values for variable names (key is variableName) -
ReturnsString with replaced variables
(str: string, variables: any[]): string Replaces #{variableName} in string with given variables
-
strString to replace #{variableName} in -
variablesArray containing values for variables in order -
ReturnsString with replaced variable
List of colours in Trackmania format (prefixed with $ and in 3 digit hex).
Server palette of colours defined in config.
List of Trackmania countries and country codes.
(message: string, login?: string | string[], prefix: boolean = true): void
Sends a server message.
-
messageMessage to be sent -
loginOptional player login or array of logins
(manialink: string, login?: string | string[], deleteOnClick: boolean = false, expireTime: number = 0): void
Sends a server manialink.
-
manialinkManialink XML to be sent -
loginOptional player login or array of logins -
deleteOnClickWhether to remove the manialink on player interaction -
expireTimeAmount of time (in seconds) for the manialink to disappear
(...players: { login: string, nickname?: string, region?: string, title?: string }[]): Promise Updates player information in runtime memory and database.
-
playersObjects containing player login and infos to update
(): tm.ServerState
Gets current server state. ('result', 'race', 'transition')
(): tm.GameMode
Gets current server gamemode. ('Rounds', 'TimeAttack', 'Teams', 'Laps', 'Stunts', 'Cup')
(event: keyof tm.Events, callback: ((params: tm.Events[T]) => void | Promise), prepend?: true): void
Add callback function to execute on given event.
-
eventDedicated server callback event -
callbackFunction to execute on event -
prependIf set to true puts the listener on the beggining of the array (it will get executed before other listeners)
(event: (keyof tm.Events)[], callback: ((params: any) => void | Promise), prepend?: true): void
Add callback function to execute on given events.
-
eventArray of dedicated server callback events -
callbackFunction to execute on events -
prependIf set to true puts the listener on the beggining of the array (it will get executed before other listeners)
(callback: Function): void
Removes event listener.
-
callbackCallback function of the listener to remove
(id: number, login: string): void
Emits ManialinkClick for given player and actionId. Used for manialink interaction such as opening UI windows.
-
idManialink ID -
loginPlayer login