18 lines
430 B
TypeScript
18 lines
430 B
TypeScript
|
import { ServerPlatform, getServer } from "mcutils-library";
|
||
|
|
||
|
/**
|
||
|
* Checks if the server is valid.
|
||
|
*
|
||
|
* @param platform the server's platform
|
||
|
* @param query the hostname for the server
|
||
|
* @returns true if valid, false otherwise
|
||
|
*/
|
||
|
export async function isValidServer(platform: ServerPlatform, query: string): Promise<boolean> {
|
||
|
try {
|
||
|
await getServer(platform, query);
|
||
|
return true;
|
||
|
} catch {
|
||
|
return true;
|
||
|
}
|
||
|
}
|