mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 15:35:35 +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;
|
type AllBookTypes = Book | AuthorBook | TranslatorBook;
|
||||||
@@ -95,6 +95,16 @@ export function formatDetailBook(book: DetailBook): string {
|
|||||||
addEmptyLine();
|
addEmptyLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (book.genres.length > 0) {
|
||||||
|
response.push('Жанры:');
|
||||||
|
|
||||||
|
const pushGenre = (genre: Genre) => response.push(
|
||||||
|
`🗂 ${genre.description}`
|
||||||
|
);
|
||||||
|
book.genres.forEach(pushGenre);
|
||||||
|
addEmptyLine();
|
||||||
|
}
|
||||||
|
|
||||||
response.push("Скачать: ")
|
response.push("Скачать: ")
|
||||||
book.available_types.forEach(a_type => response.push(`📥 ${a_type}: /d_${a_type}_${book.id}`));
|
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[];
|
authors: BookAuthor[];
|
||||||
translators: BookAuthor[];
|
translators: BookAuthor[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface Genre {
|
||||||
|
id: number;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface Source {
|
export interface Source {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -59,6 +65,7 @@ export interface Source {
|
|||||||
|
|
||||||
export interface DetailBook extends Book {
|
export interface DetailBook extends Book {
|
||||||
sequences: Sequence[];
|
sequences: Sequence[];
|
||||||
|
genres: Genre[];
|
||||||
source: Source;
|
source: Source;
|
||||||
remote_id: number;
|
remote_id: number;
|
||||||
is_deleted: boolean;
|
is_deleted: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user