Skip to content

Commit

Permalink
refactor: move MyContext to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
tfkhdyt committed Sep 27, 2023
1 parent c60e846 commit 06162f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/Bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ import { Context, Telegraf } from 'telegraf'
import { Fetcher } from './Fetcher.js'
import { Scraper } from './Scraper.js'
import config from './config/config.js'
import { User } from './db/postgres/schemas/user.schema.js'
import { CallbackQuery } from './interfaces/callback-query.interface.js'
import { MyContext } from './interfaces/context.js'
import { IResult } from './interfaces/result.interface.js'
import { decreaseCredits } from './user.repository.js'

interface MyContext extends Context {
user: User
}

// App class
export default class App {
bot: Telegraf<MyContext>
Expand Down
6 changes: 6 additions & 0 deletions src/interfaces/context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Context } from 'telegraf'
import { User } from '../db/postgres/schemas/user.schema'

export interface MyContext extends Context {
user: User
}

0 comments on commit 06162f6

Please sign in to comment.