diff --git a/src/github-stats/github-stats.controller.ts b/src/github-stats/github-stats.controller.ts index 611c45f..ed3e6ea 100644 --- a/src/github-stats/github-stats.controller.ts +++ b/src/github-stats/github-stats.controller.ts @@ -24,7 +24,7 @@ export class GithubStatsController { await this.statsService.createStat({ stat_id: 'github_commit_count', - name: 'коммита', + name: '— количество коммитов в гитхабе', count: updatedCount, }); diff --git a/src/telegram-stats/telegram-stats.service.ts b/src/telegram-stats/telegram-stats.service.ts index 299a6f9..b8ba1e0 100644 --- a/src/telegram-stats/telegram-stats.service.ts +++ b/src/telegram-stats/telegram-stats.service.ts @@ -23,7 +23,7 @@ export class TelegramStatsService { await this.statsService.createStat({ stat_id: 'telegram_channel_count', - name: 'подписчиков в телеграм канале', + name: 'в телеграм канале', count: updatedCount, }); @@ -36,38 +36,25 @@ export class TelegramStatsService { } } - @On('message') - async onMessage(ctx: Context) { - if (ctx.message.chat.type !== 'private') return; - - const stat_id = ctx.text.split(' ')[0]; - const count = parseInt(ctx.text.split(' ')[1]); - const name = ctx.text.split(' ').slice(2).join(' '); - - await this.statsService.createStat({ - stat_id, - count, - name, - }); - } - @On('text') async onComment(ctx: Context) { - const lastMessage = ctx.message; - - await this.statsService.createStat({ - stat_id: 'telegram_channel_commented', - name: `${lastMessage.from.first_name} прокоментировал "${ctx.text}"`, - count: 0, - }); - } - - @On('boost_added') - async onBoost(ctx: Context) { - await this.statsService.createStat({ - stat_id: 'telegram_channel_boost', - name: `${ctx.chatBoost.boost.source.user.first_name} кинул буст`, - count: 0, - }); + if (ctx.chat.type === 'private') { + console.info('updated stat'); + const stat_id = ctx.text.split(' ')[0]; + const count = parseInt(ctx.text.split(' ')[1]); + const name = ctx.text.split(' ').slice(2).join(' '); + await this.statsService.createStat({ + stat_id, + count, + name, + }); + } else { + console.info('added comment'); + await this.statsService.createStat({ + stat_id: 'telegram_channel_commented', + name: `"${ctx.text}"`, + count: 0, + }); + } } }