mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 07:25:36 +01:00
Add genres
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { AuthorBook, TranslatorBook, Book, Author, Sequence, BookAuthor, DetailBook } from './services/book_library';
|
||||
import { AuthorBook, TranslatorBook, Book, Author, Sequence, BookAuthor, DetailBook, Genre } from './services/book_library';
|
||||
|
||||
|
||||
type AllBookTypes = Book | AuthorBook | TranslatorBook;
|
||||
@@ -95,6 +95,16 @@ export function formatDetailBook(book: DetailBook): string {
|
||||
addEmptyLine();
|
||||
}
|
||||
|
||||
if (book.genres.length > 0) {
|
||||
response.push('Жанры:');
|
||||
|
||||
const pushGenre = (genre: Genre) => response.push(
|
||||
`🗂 ${genre.description}`
|
||||
);
|
||||
book.genres.forEach(pushGenre);
|
||||
addEmptyLine();
|
||||
}
|
||||
|
||||
response.push("Скачать: ")
|
||||
book.available_types.forEach(a_type => response.push(`📥 ${a_type}: /d_${a_type}_${book.id}`));
|
||||
|
||||
|
||||
@@ -45,12 +45,18 @@ export interface TranslatorBook extends BaseBook {
|
||||
}
|
||||
|
||||
|
||||
export interface Book extends AuthorBook {
|
||||
export interface Book extends BaseBook {
|
||||
authors: BookAuthor[];
|
||||
translators: BookAuthor[];
|
||||
}
|
||||
|
||||
|
||||
export interface Genre {
|
||||
id: number;
|
||||
description: string;
|
||||
}
|
||||
|
||||
|
||||
export interface Source {
|
||||
id: number;
|
||||
name: string;
|
||||
@@ -59,6 +65,7 @@ export interface Source {
|
||||
|
||||
export interface DetailBook extends Book {
|
||||
sequences: Sequence[];
|
||||
genres: Genre[];
|
||||
source: Source;
|
||||
remote_id: number;
|
||||
is_deleted: boolean;
|
||||
|
||||
Reference in New Issue
Block a user