Remove tsdoc comments
This commit is contained in:
parent
c7cb3274b5
commit
6257a0a704
33
src/utils.ts
33
src/utils.ts
|
@ -8,15 +8,6 @@ export function checkFile(
|
||||||
encoding: fs.EncodingOption,
|
encoding: fs.EncodingOption,
|
||||||
defaultContent: string,
|
defaultContent: string,
|
||||||
): Messages {
|
): Messages {
|
||||||
/**
|
|
||||||
* Checks if a given JSON file exists and contains valid JSON from a previous message history.
|
|
||||||
*
|
|
||||||
* @param file - The file to check.
|
|
||||||
* @param encoding - The text encoding the given file uses.
|
|
||||||
* @param defaultContent - The default system message to use if no JSON file was found, or the JSON file does not contain valid JSON.
|
|
||||||
*
|
|
||||||
* @returns A list of messages from the given JSON file, or a starter list with just the system messsage.
|
|
||||||
*/
|
|
||||||
let final: Messages;
|
let final: Messages;
|
||||||
const generic: Messages = [
|
const generic: Messages = [
|
||||||
{
|
{
|
||||||
|
@ -77,14 +68,6 @@ export function contentOf(response: ChatCompletion): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getUserInfo(host: string, id: string) {
|
export async function getUserInfo(host: string, id: string) {
|
||||||
/**
|
|
||||||
* Returns various info about a user given a host and server ID.
|
|
||||||
*
|
|
||||||
* @param host - The address of the Tailchat server.
|
|
||||||
* @param id - The user ID to check.
|
|
||||||
*
|
|
||||||
* @returns An object containing all the user data recieved from the server.
|
|
||||||
*/
|
|
||||||
try {
|
try {
|
||||||
const reply = await fetch(`${host}/api/user/getUserInfo`, {
|
const reply = await fetch(`${host}/api/user/getUserInfo`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
@ -111,14 +94,6 @@ export async function getUserInfo(host: string, id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getUsername(host: string, id: string) {
|
export async function getUsername(host: string, id: string) {
|
||||||
/**
|
|
||||||
* Gets the username of a given user.
|
|
||||||
*
|
|
||||||
* @param host - The address of the Tailchat server.
|
|
||||||
* @param id - The user ID to check.
|
|
||||||
*
|
|
||||||
* @returns The username associated with the given user ID.
|
|
||||||
*/
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
throw new Error("No user ID was given.");
|
throw new Error("No user ID was given.");
|
||||||
}
|
}
|
||||||
|
@ -129,14 +104,6 @@ export async function getUsername(host: string, id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function isUserBot(host: string, id: string) {
|
export async function isUserBot(host: string, id: string) {
|
||||||
/**
|
|
||||||
* Returns if the given user is a bot.
|
|
||||||
*
|
|
||||||
* @param host - The address of the Tailchat server.
|
|
||||||
* @param id - The user ID to check.
|
|
||||||
*
|
|
||||||
* @returns true if the user ID is associated with a bot, false if not.
|
|
||||||
*/
|
|
||||||
const reply = await getUserInfo(host, id);
|
const reply = await getUserInfo(host, id);
|
||||||
|
|
||||||
return reply.type === "openapiBot";
|
return reply.type === "openapiBot";
|
||||||
|
|
Loading…
Reference in a new issue