tested & working basic bot
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import * as readline from "node:readline";
|
||||
import { apiClient } from "../core/api-client.ts";
|
||||
import { logError, logInfo } from "./logger.ts";
|
||||
import { logSuccess, logWarning } from "./logger.ts";
|
||||
|
||||
export async function getUserId(username: string): Promise<string | null> {
|
||||
const user = await apiClient.users.getUserByName(username);
|
||||
if (user) {
|
||||
logInfo(`${user.name} => ${user.id}`);
|
||||
if (user?.id) {
|
||||
logSuccess(`${user.name} => ${user.id}`);
|
||||
return user.id;
|
||||
}
|
||||
logError(`no user with name ${username} found`);
|
||||
logWarning(`no user with name ${username} found`);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user