Commit a5470f96 authored by nanahira's avatar nanahira

subscribe text

parent a2c8d164
Pipeline #19409 canceled with stages
in 8 minutes and 16 seconds
...@@ -14,6 +14,9 @@ export class CommandCountService extends CrudService(CommandCount) { ...@@ -14,6 +14,9 @@ export class CommandCountService extends CrudService(CommandCount) {
@UseEvent('command/before-execute') @UseEvent('command/before-execute')
async onCommand(argv: Argv) { async onCommand(argv: Argv) {
this.log.log(
`User ${argv.session.userId} executed command ${argv.command.name}`,
);
const record = new CommandCount().fromArgv(argv); const record = new CommandCount().fromArgv(argv);
await this.create(record); await this.create(record);
} }
......
import { Injectable } from '@nestjs/common'; import { ConsoleLogger, Injectable } from '@nestjs/common';
import { UseEvent } from 'koishi-nestjs'; import { UseEvent } from 'koishi-nestjs';
import { Session } from 'koishi'; import { Session } from 'koishi';
@Injectable() @Injectable()
export class OnSubscribeService { export class OnSubscribeService extends ConsoleLogger {
constructor() {
super('OnSubscribeService');
}
@UseEvent('wechat:subscribe') @UseEvent('wechat:subscribe')
async onSubscribe(session: Session) { async onSubscribe(session: Session) {
await session.send('感谢关注决斗暗网服务号!'); this.log(`User ${session.userId} subscribed.`);
await session.send(
'欢迎关注决斗暗网!\n' +
'\n' +
'我们的菜单包含了各种功能,其中有游戏下载方式,玩家社区,举报反馈渠道等。',
);
}
@UseEvent('wechat:unsubscribe')
async onUnsubscribe(session: Session) {
this.log(`User ${session.userId} unsubscribed.`);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment