2024-04-19 14:22:03 +00:00
|
|
|
import { getServer, ServerPlatform } from "mcutils-library";
|
2024-04-18 06:06:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 {
|
2024-04-18 07:54:13 +00:00
|
|
|
return false;
|
2024-04-18 06:06:16 +00:00
|
|
|
}
|
|
|
|
}
|