Merge branch 'master' into renovate/nest-monorepo

This commit is contained in:
Aleksandr Bukhalo 2020-03-28 11:51:11 +03:00 committed by GitHub
commit 3f97f5ce8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 6 deletions

27
.github/workflows/build-test.yml vendored Normal file
View 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
View File

@ -0,0 +1 @@
lib/telegraf.provider.ts

View File

@ -2,11 +2,10 @@ import { Injectable, OnModuleInit } from '@nestjs/common';
import { DiscoveryService, ModuleRef } from '@nestjs/core';
import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper';
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
import Telegraf from 'telegraf';
import { TelegrafMetadataAccessor } from './telegraf-metadata.accessor';
import { TelegrafProvider } from './telegraf.provider';
import { TELEGRAF_PROVIDER } from './telegraf.constants';
import { ContextMessageUpdate } from 'telegraf';
import { Telegraf, ContextMessageUpdate } from 'telegraf';
import {
TelegrafActionMetadata,
TelegrafCashtagMetadata,

View File

@ -5,13 +5,13 @@ import {
Logger,
OnApplicationShutdown,
} from '@nestjs/common';
import Telegraf, { ContextMessageUpdate } from 'telegraf';
import { Telegraf, ContextMessageUpdate } from 'telegraf';
import { TELEGRAF_MODULE_OPTIONS } from './telegraf.constants';
import { TelegrafModuleOptions } from './interfaces';
@Injectable()
// @ts-ignore
export class TelegrafProvider<TContext extends ContextMessageUpdate>
// @ts-ignore
extends Telegraf<TContext>
implements OnApplicationBootstrap, OnApplicationShutdown {
private logger = new Logger('Telegraf');
@ -21,7 +21,7 @@ export class TelegrafProvider<TContext extends ContextMessageUpdate>
}
onApplicationBootstrap() {
this.catch(e => {
this.catch((e) => {
this.logger.error(e);
});
this.startPolling();

View File

@ -31,7 +31,8 @@
"build": "rm -rf dist && tsc -p tsconfig.json",
"precommit": "lint-staged",
"prepublish:npm": "npm run build",
"publish:npm": "npm publish --access public"
"publish:npm": "npm publish --access public",
"test": ""
},
"dependencies": {
"telegraf": "3.36.0"