Fix annotations command

This commit is contained in:
2022-03-05 23:05:20 +03:00
parent d948fc1f36
commit 3a189e0f53
3 changed files with 7 additions and 7 deletions

View File

@@ -9,8 +9,8 @@ export const AUTHOR_BOOKS_PREFIX = 'ba_';
export const TRANSLATOR_BOOKS_PREFIX = 'bt_';
export const SEQUENCE_BOOKS_PREFIX = 'bs_';
export const BOOK_ANNOTATION_PREFIX = 'a_info_';
export const AUTHOR_ANNOTATION_PREFIX = 'b_info_';
export const BOOK_ANNOTATION_PREFIX = 'a_an_';
export const AUTHOR_ANNOTATION_PREFIX = 'b_an_';
export const RANDOM_BOOK = 'random_book';
export const RANDOM_AUTHOR = 'random_author';

View File

@@ -20,7 +20,7 @@ export function formatBook(book: AllBookTypes, short: boolean = false): string {
response.push(`📖 ${book.title} | ${book.lang}`);
if (book.annotation_exists) {
response.push(`📝 Аннотация: /b_info_${book.id}`)
response.push(`📝 Аннотация: /b_an_${book.id}`)
}
if (isTranslatorBook(book) && book.authors.length > 0) {
@@ -58,7 +58,7 @@ export function formatAuthor(author: Author): string {
response.push(`/a_${author.id}`);
if (author.annotation_exists) {
response.push(`📝 Аннотация: /a_info_${author.id}`);
response.push(`📝 Аннотация: /a_an_${author.id}`);
}
return response.join('\n');
@@ -72,7 +72,7 @@ export function formatTranslator(author: Author): string {
response.push(`/t_${author.id}`);
if (author.annotation_exists) {
response.push(`📝 Аннотация: /a_info_${author.id}`);
response.push(`📝 Аннотация: /a_an_${author.id}`);
}
return response.join('\n');

View File

@@ -172,7 +172,7 @@ export async function createApprovedBot(token: string, state: BotState): Promise
bot.hears(new RegExp(`^/d_[a-zA-Z0-9]+_[\\d]+(@${me.username})*$`), async (ctx) => sendFile(ctx, state));
bot.hears(new RegExp(`^/b_info_[\\d]+(@${me.username})*$`), async (ctx: Context) => {
bot.hears(new RegExp(`^/b_an_[\\d]+(@${me.username})*$`), async (ctx: Context) => {
if (!ctx.message || !('text' in ctx.message)) {
return;
}
@@ -235,7 +235,7 @@ export async function createApprovedBot(token: string, state: BotState): Promise
}
});
bot.hears(new RegExp(`^/a_info_[\\d]+(@${me.username})*$`), async (ctx: Context) => {
bot.hears(new RegExp(`^/a_an_[\\d]+(@${me.username})*$`), async (ctx: Context) => {
if (!ctx.message || !('text' in ctx.message)) {
return;
}