mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-01-12 15:11:05 +03:00
Merge branch 'master' into renovate/nest-monorepo
This commit is contained in:
commit
3f97f5ce8f
27
.github/workflows/build-test.yml
vendored
Normal file
27
.github/workflows/build-test.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
name: Build & Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [12.x, 13.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run build --if-present
|
||||||
|
- run: npm test
|
||||||
|
env:
|
||||||
|
CI: true
|
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
lib/telegraf.provider.ts
|
@ -2,11 +2,10 @@ import { Injectable, OnModuleInit } from '@nestjs/common';
|
|||||||
import { DiscoveryService, ModuleRef } from '@nestjs/core';
|
import { DiscoveryService, ModuleRef } from '@nestjs/core';
|
||||||
import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper';
|
import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper';
|
||||||
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
|
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
|
||||||
import Telegraf from 'telegraf';
|
|
||||||
import { TelegrafMetadataAccessor } from './telegraf-metadata.accessor';
|
import { TelegrafMetadataAccessor } from './telegraf-metadata.accessor';
|
||||||
import { TelegrafProvider } from './telegraf.provider';
|
import { TelegrafProvider } from './telegraf.provider';
|
||||||
import { TELEGRAF_PROVIDER } from './telegraf.constants';
|
import { TELEGRAF_PROVIDER } from './telegraf.constants';
|
||||||
import { ContextMessageUpdate } from 'telegraf';
|
import { Telegraf, ContextMessageUpdate } from 'telegraf';
|
||||||
import {
|
import {
|
||||||
TelegrafActionMetadata,
|
TelegrafActionMetadata,
|
||||||
TelegrafCashtagMetadata,
|
TelegrafCashtagMetadata,
|
||||||
|
@ -5,13 +5,13 @@ import {
|
|||||||
Logger,
|
Logger,
|
||||||
OnApplicationShutdown,
|
OnApplicationShutdown,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import Telegraf, { ContextMessageUpdate } from 'telegraf';
|
import { Telegraf, ContextMessageUpdate } from 'telegraf';
|
||||||
import { TELEGRAF_MODULE_OPTIONS } from './telegraf.constants';
|
import { TELEGRAF_MODULE_OPTIONS } from './telegraf.constants';
|
||||||
import { TelegrafModuleOptions } from './interfaces';
|
import { TelegrafModuleOptions } from './interfaces';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
// @ts-ignore
|
|
||||||
export class TelegrafProvider<TContext extends ContextMessageUpdate>
|
export class TelegrafProvider<TContext extends ContextMessageUpdate>
|
||||||
|
// @ts-ignore
|
||||||
extends Telegraf<TContext>
|
extends Telegraf<TContext>
|
||||||
implements OnApplicationBootstrap, OnApplicationShutdown {
|
implements OnApplicationBootstrap, OnApplicationShutdown {
|
||||||
private logger = new Logger('Telegraf');
|
private logger = new Logger('Telegraf');
|
||||||
@ -21,7 +21,7 @@ export class TelegrafProvider<TContext extends ContextMessageUpdate>
|
|||||||
}
|
}
|
||||||
|
|
||||||
onApplicationBootstrap() {
|
onApplicationBootstrap() {
|
||||||
this.catch(e => {
|
this.catch((e) => {
|
||||||
this.logger.error(e);
|
this.logger.error(e);
|
||||||
});
|
});
|
||||||
this.startPolling();
|
this.startPolling();
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
"build": "rm -rf dist && tsc -p tsconfig.json",
|
"build": "rm -rf dist && tsc -p tsconfig.json",
|
||||||
"precommit": "lint-staged",
|
"precommit": "lint-staged",
|
||||||
"prepublish:npm": "npm run build",
|
"prepublish:npm": "npm run build",
|
||||||
"publish:npm": "npm publish --access public"
|
"publish:npm": "npm publish --access public",
|
||||||
|
"test": ""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"telegraf": "3.36.0"
|
"telegraf": "3.36.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user