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
53
bot/mod.ts
53
bot/mod.ts
|
@ -12,6 +12,7 @@ import { img2imgCommand, img2imgQuestion } from "./img2imgCommand.ts";
|
|||
import { pnginfoCommand, pnginfoQuestion } from "./pnginfoCommand.ts";
|
||||
import { queueCommand } from "./queueCommand.ts";
|
||||
import { txt2imgCommand, txt2imgQuestion } from "./txt2imgCommand.ts";
|
||||
import { helpCommand } from "./helpCommand.ts";
|
||||
import { setConfig, getConfig } from "../app/config.ts";
|
||||
|
||||
// Set the new configuration
|
||||
|
@ -117,31 +118,57 @@ bot.use(async (ctx, next) => {
|
|||
}
|
||||
});
|
||||
|
||||
// Declare the bot description variable
|
||||
export const botDescription = `I can generate furry images from text.
|
||||
\`/txt2img Nyx\`
|
||||
|
||||
If you want landscape or portrait:
|
||||
\`/txt2img Nyx, Size: 576x832\`
|
||||
\`/txt2img Nyx, Size: 832x576\`
|
||||
|
||||
This bot uses the following model and will render nsfw and sfw:
|
||||
\`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: "img2img", description: "Generate image from image" },
|
||||
{ command: "pnginfo", description: "Try to extract prompt from raw file" },
|
||||
{ command: "queue", description: "Show the current queue" },
|
||||
{ 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("Generate furry images in '704x704', '576x832', '832x576'. https://ko-fi.com/nyxthebot https://nyx.akiru.de/");
|
||||
await bot.api.setMyShortDescription(botShortDescription);
|
||||
} catch (err) {
|
||||
error(`Failed to set short description: ${err.message}`);
|
||||
}
|
||||
|
||||
try {
|
||||
await bot.api.setMyDescription(
|
||||
"I can generate furry images from text. If you want a different size, use 'Size: 576x832' for example." +
|
||||
"Send /txt2img to generate an image.",
|
||||
);
|
||||
await bot.api.setMyDescription(botDescription);
|
||||
} catch (err) {
|
||||
error(`Failed to set description: ${err.message}`);
|
||||
}
|
||||
|
||||
try {
|
||||
await bot.api.setMyCommands([
|
||||
{ command: "txt2img", description: "Generate image from text" },
|
||||
{ command: "img2img", description: "Generate image from image" },
|
||||
{ command: "pnginfo", description: "Try to extract prompt from raw file" },
|
||||
{ command: "queue", description: "Show the current queue" },
|
||||
{ command: "cancel", description: "Cancel all your requests" },
|
||||
]);
|
||||
await bot.api.setMyCommands(botCommands);
|
||||
} catch (err) {
|
||||
error(`Failed to set commands: ${err.message}`);
|
||||
}
|
||||
|
@ -197,6 +224,8 @@ bot.command("queue", queueCommand);
|
|||
|
||||
bot.command("cancel", cancelCommand);
|
||||
|
||||
bot.command("help", helpCommand);
|
||||
|
||||
bot.command("broadcast", broadcastCommand);
|
||||
|
||||
bot.command("crash", () => {
|
||||
|
|
Loading…
Reference in New Issue