mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-06 15:35:35 +01:00
Refactor sentry
This commit is contained in:
@@ -1,14 +1,10 @@
|
||||
import * as Sentry from '@sentry/node';
|
||||
import { createClient, RedisClientType } from 'redis';
|
||||
import moment from 'moment';
|
||||
import BotsManager from '@/bots/manager';
|
||||
|
||||
import env from '@/config';
|
||||
import BotsManager from '@/bots/manager';
|
||||
|
||||
|
||||
Sentry.init({
|
||||
dsn: env.SENTRY_DSN,
|
||||
});
|
||||
import Sentry from '@/sentry';
|
||||
|
||||
|
||||
enum RedisKeys {
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
import * as Sentry from '@sentry/node';
|
||||
import { Context } from "telegraf";
|
||||
import { AuthorAnnnotation, BookAnnotation } from "./services/book_library";
|
||||
|
||||
import env from '@/config';
|
||||
import { isNormalText } from "./utils";
|
||||
import { getTextPaginationData } from './keyboard';
|
||||
|
||||
|
||||
Sentry.init({
|
||||
dsn: env.SENTRY_DSN,
|
||||
});
|
||||
import Sentry from '@/sentry';
|
||||
|
||||
|
||||
export function getAnnotationHandler<T extends BookAnnotation | AuthorAnnnotation>(
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import * as Sentry from '@sentry/node';
|
||||
|
||||
import { Context, Telegraf, Markup } from 'telegraf';
|
||||
import moment from 'moment';
|
||||
|
||||
@@ -15,17 +13,13 @@ import * as BookLibrary from "./services/book_library";
|
||||
import UsersCounter from '@/analytics/users_counter';
|
||||
import { createOrUpdateUserSettings, getUserOrDefaultLangCodes } from './services/user_settings';
|
||||
import { formatBook, formatBookShort, formatAuthor, formatSequence, formatTranslator, formatDetailBook } from './format';
|
||||
import { getCallbackArgs, getPaginatedMessage, getPrefixWithQueryCreator, getSearchArgs, isNormalText, registerLanguageSettingsCallback, registerPaginationCommand, registerRandomItemCallback } from './utils';
|
||||
import { getCallbackArgs, getPaginatedMessage, getPrefixWithQueryCreator, getSearchArgs, registerLanguageSettingsCallback, registerPaginationCommand, registerRandomItemCallback } from './utils';
|
||||
import { getRandomKeyboard, getTextPaginationData, getUpdateLogKeyboard, getUserAllowedLangsKeyboard } from './keyboard';
|
||||
import { sendFile } from './hooks/downloading';
|
||||
import { setCommands } from './hooks/setCommands';
|
||||
import { isNotModifiedMessage, isReplyMessageNotFound } from './errors_utils';
|
||||
import { getAnnotationHandler } from './annotations';
|
||||
|
||||
|
||||
Sentry.init({
|
||||
dsn: env.SENTRY_DSN,
|
||||
});
|
||||
import Sentry from '@/sentry';
|
||||
|
||||
|
||||
export async function createApprovedBot(token: string, state: BotState): Promise<Telegraf> {
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
import { Context, Markup, Telegraf } from 'telegraf';
|
||||
import { InlineKeyboardMarkup } from 'typegram';
|
||||
import { URLSearchParams } from 'url';
|
||||
import * as Sentry from '@sentry/node';
|
||||
|
||||
import env from '@/config';
|
||||
|
||||
|
||||
import { isNotModifiedMessage } from './errors_utils';
|
||||
import { getPaginationKeyboard, getUserAllowedLangsKeyboard } from './keyboard';
|
||||
import * as BookLibrary from "./services/book_library";
|
||||
import { createOrUpdateUserSettings, getUserOrDefaultLangCodes } from './services/user_settings';
|
||||
|
||||
|
||||
Sentry.init({
|
||||
dsn: env.SENTRY_DSN,
|
||||
});
|
||||
import Sentry from '@/sentry';
|
||||
|
||||
|
||||
interface PreparedMessage {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import * as Sentry from '@sentry/node';
|
||||
|
||||
import express, { Response, Request, NextFunction } from 'express';
|
||||
import { Server } from 'http';
|
||||
|
||||
@@ -12,11 +10,7 @@ import getBot from '../factory/index';
|
||||
import UsersCounter from '@/analytics/users_counter';
|
||||
import { makeSyncRequest } from "./utils";
|
||||
import { BotState } from "./types";
|
||||
|
||||
|
||||
Sentry.init({
|
||||
dsn: env.SENTRY_DSN,
|
||||
});
|
||||
import Sentry from '@/sentry';
|
||||
|
||||
|
||||
export default class BotsManager {
|
||||
|
||||
10
src/sentry.ts
Normal file
10
src/sentry.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import * as Sentry from '@sentry/node';
|
||||
|
||||
import env from '@/config';
|
||||
|
||||
|
||||
Sentry.init({
|
||||
dsn: env.SENTRY_DSN,
|
||||
});
|
||||
|
||||
export default Sentry;
|
||||
Reference in New Issue
Block a user