forked from pinks/eris
small changes
This commit is contained in:
parent
6b0d7b7198
commit
4d69b87b97
|
@ -15,7 +15,6 @@ export async function queueCommand(ctx: Grammy.CommandContext<Context>) {
|
|||
const waitingJobs = await jobStore.getBy("status.type", "waiting")
|
||||
.then((jobs) => jobs.map((job, index) => ({ ...job.value, place: index + 1 })));
|
||||
const jobs = [...processingJobs, ...waitingJobs];
|
||||
const config = ctx.session.global;
|
||||
const { bold } = GrammyParseMode;
|
||||
return fmt([
|
||||
"Current queue:\n",
|
||||
|
@ -40,7 +39,7 @@ export async function queueCommand(ctx: Grammy.CommandContext<Context>) {
|
|||
])
|
||||
: ["Queue is empty.\n"],
|
||||
"\nActive workers:\n",
|
||||
...config.workers.flatMap((worker) => [
|
||||
...ctx.session.global.workers.flatMap((worker) => [
|
||||
runningWorkers.has(worker.name) ? "✅ " : "☠️ ",
|
||||
fmt`${bold(worker.name)} `,
|
||||
`(max ${(worker.maxResolution / 1000000).toFixed(1)} Mpx) `,
|
||||
|
|
|
@ -22,24 +22,23 @@ async function txt2img(ctx: Context, match: string, includeRepliedTo: boolean):
|
|||
return;
|
||||
}
|
||||
|
||||
const config = ctx.session.global;
|
||||
if (config.pausedReason != null) {
|
||||
await ctx.reply(`I'm paused: ${config.pausedReason || "No reason given"}`);
|
||||
if (ctx.session.global.pausedReason != null) {
|
||||
await ctx.reply(`I'm paused: ${ctx.session.global.pausedReason || "No reason given"}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const jobs = await jobStore.getBy("status.type", "waiting");
|
||||
if (jobs.length >= config.maxJobs) {
|
||||
if (jobs.length >= ctx.session.global.maxJobs) {
|
||||
await ctx.reply(
|
||||
`The queue is full. Try again later. (Max queue size: ${config.maxJobs})`,
|
||||
`The queue is full. Try again later. (Max queue size: ${ctx.session.global.maxJobs})`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const userJobs = jobs.filter((job) => job.value.request.from.id === ctx.message?.from?.id);
|
||||
if (userJobs.length >= config.maxUserJobs) {
|
||||
if (userJobs.length >= ctx.session.global.maxUserJobs) {
|
||||
await ctx.reply(
|
||||
`You already have ${config.maxUserJobs} jobs in queue. Try again later.`,
|
||||
`You already have ${ctx.session.global.maxUserJobs} jobs in queue. Try again later.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
6
utils.ts
6
utils.ts
|
@ -105,7 +105,7 @@ const languageToFlagMap: Record<string, string> = {
|
|||
"lb": "🇱🇺", // Luxembourgish - Luxembourg
|
||||
};
|
||||
|
||||
export function getFlagEmoji(countryCode?: string): string | undefined {
|
||||
if (!countryCode) return;
|
||||
return languageToFlagMap[countryCode];
|
||||
export function getFlagEmoji(languageCode?: string): string | undefined {
|
||||
if (!languageCode) return;
|
||||
return languageToFlagMap[languageCode];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue