forked from pinks/eris
bot/mod.ts aktualisiert
Added new help command Refactored code to use variables inside the bot.api.setMy... functions.
This commit is contained in:
parent
8930544485
commit
ed40a902ef
65
bot/mod.ts
65
bot/mod.ts
|
@ -12,6 +12,7 @@ import { img2imgCommand, img2imgQuestion } from "./img2imgCommand.ts";
|
||||||
import { pnginfoCommand, pnginfoQuestion } from "./pnginfoCommand.ts";
|
import { pnginfoCommand, pnginfoQuestion } from "./pnginfoCommand.ts";
|
||||||
import { queueCommand } from "./queueCommand.ts";
|
import { queueCommand } from "./queueCommand.ts";
|
||||||
import { txt2imgCommand, txt2imgQuestion } from "./txt2imgCommand.ts";
|
import { txt2imgCommand, txt2imgQuestion } from "./txt2imgCommand.ts";
|
||||||
|
import { helpCommand } from "./helpCommand.ts";
|
||||||
import { setConfig, getConfig } from "../app/config.ts";
|
import { setConfig, getConfig } from "../app/config.ts";
|
||||||
|
|
||||||
// Set the new configuration
|
// Set the new configuration
|
||||||
|
@ -117,31 +118,57 @@ bot.use(async (ctx, next) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wrap the calls in try-catch for error handling
|
// Declare the bot description variable
|
||||||
async function setupBotCommands() {
|
export const botDescription = `I can generate furry images from text.
|
||||||
try {
|
\`/txt2img Nyx\`
|
||||||
await bot.api.setMyShortDescription("Generate furry images in '704x704', '576x832', '832x576'. https://ko-fi.com/nyxthebot https://nyx.akiru.de/");
|
|
||||||
} catch (err) {
|
|
||||||
error(`Failed to set short description: ${err.message}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
If you want landscape or portrait:
|
||||||
await bot.api.setMyDescription(
|
\`/txt2img Nyx, Size: 576x832\`
|
||||||
"I can generate furry images from text. If you want a different size, use 'Size: 576x832' for example." +
|
\`/txt2img Nyx, Size: 832x576\`
|
||||||
"Send /txt2img to generate an image.",
|
|
||||||
);
|
|
||||||
} catch (err) {
|
|
||||||
error(`Failed to set description: ${err.message}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
This bot uses the following model and will render nsfw and sfw:
|
||||||
await bot.api.setMyCommands([
|
\`EasyFluffV11.2.safetensors [821628644e]\`
|
||||||
|
|
||||||
|
There is no loRA support.
|
||||||
|
|
||||||
|
Please read about our terms of use:
|
||||||
|
https://nyx.akiru.de/disclaimer
|
||||||
|
|
||||||
|
You can support Nyx by sending her a coffee :3
|
||||||
|
ko-fi.com/nyxthebot`;
|
||||||
|
|
||||||
|
// Short description constant
|
||||||
|
const botShortDescription = `Generate furry images from text.
|
||||||
|
Use /help for more information.
|
||||||
|
https://ko-fi.com/nyxthebot
|
||||||
|
https://nyx.akiru.de`;
|
||||||
|
|
||||||
|
// Command descriptions
|
||||||
|
const botCommands = [
|
||||||
{ command: "txt2img", description: "Generate image from text" },
|
{ command: "txt2img", description: "Generate image from text" },
|
||||||
{ command: "img2img", description: "Generate image from image" },
|
{ command: "img2img", description: "Generate image from image" },
|
||||||
{ command: "pnginfo", description: "Try to extract prompt from raw file" },
|
{ command: "pnginfo", description: "Try to extract prompt from raw file" },
|
||||||
{ command: "queue", description: "Show the current queue" },
|
{ command: "queue", description: "Show the current queue" },
|
||||||
{ command: "cancel", description: "Cancel all your requests" },
|
{ command: "cancel", description: "Cancel all your requests" },
|
||||||
]);
|
{ command: "help", description: "Show bot description" },
|
||||||
|
];
|
||||||
|
|
||||||
|
// Wrap the calls in try-catch for error handling
|
||||||
|
async function setupBotCommands() {
|
||||||
|
try {
|
||||||
|
await bot.api.setMyShortDescription(botShortDescription);
|
||||||
|
} catch (err) {
|
||||||
|
error(`Failed to set short description: ${err.message}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await bot.api.setMyDescription(botDescription);
|
||||||
|
} catch (err) {
|
||||||
|
error(`Failed to set description: ${err.message}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await bot.api.setMyCommands(botCommands);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error(`Failed to set commands: ${err.message}`);
|
error(`Failed to set commands: ${err.message}`);
|
||||||
}
|
}
|
||||||
|
@ -197,6 +224,8 @@ bot.command("queue", queueCommand);
|
||||||
|
|
||||||
bot.command("cancel", cancelCommand);
|
bot.command("cancel", cancelCommand);
|
||||||
|
|
||||||
|
bot.command("help", helpCommand);
|
||||||
|
|
||||||
bot.command("broadcast", broadcastCommand);
|
bot.command("broadcast", broadcastCommand);
|
||||||
|
|
||||||
bot.command("crash", () => {
|
bot.command("crash", () => {
|
||||||
|
|
Loading…
Reference in New Issue