add easy setup
This commit is contained in:
12
src/util/general.ts
Normal file
12
src/util/general.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { apiClient } from "../core/api-client";
|
||||
import { logError, logInfo } from "./logger";
|
||||
|
||||
export async function getUserId(username: string): Promise<string | null> {
|
||||
const user = await apiClient.users.getUserByName(username);
|
||||
if (user) {
|
||||
logInfo(`${user.name} => ${user.id}`);
|
||||
return user.id;
|
||||
}
|
||||
logError(`no user with name ${username} found`);
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user