Refactor sentry

This commit is contained in:
2022-04-01 21:43:33 +03:00
parent 4166e44842
commit 69ca54b055
6 changed files with 17 additions and 37 deletions

View File

@@ -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 {

View File

@@ -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>(

View File

@@ -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> {

View File

@@ -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 {

View File

@@ -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
View File

@@ -0,0 +1,10 @@
import * as Sentry from '@sentry/node';
import env from '@/config';
Sentry.init({
dsn: env.SENTRY_DSN,
});
export default Sentry;