Commit a2c8d164 authored by nanahira's avatar nanahira

send on subscribe

parent 5977f881
......@@ -14,6 +14,7 @@ import { FeedbackService } from './feedback/feedback.service';
import PuppeteerPlugin from 'koishi-plugin-puppeteer';
import { HttpModule } from '@nestjs/axios';
import { Feedback } from './feedback/entities/feedback.entity';
import { OnSubscribeService } from './on-subscribe/on-subscribe.service';
@Module({
imports: [
......@@ -126,7 +127,7 @@ import { Feedback } from './feedback/entities/feedback.entity';
{
type: 'click',
name: '有奖调研',
command: 'reply.bonus',
command: 'invenstigate',
},
{
type: 'click',
......@@ -151,6 +152,7 @@ import { Feedback } from './feedback/entities/feedback.entity';
CommandCountService,
CdbLoaderService,
FeedbackService,
OnSubscribeService,
],
})
export class AppModule {}
......@@ -71,6 +71,11 @@ export class FeedbackService extends CrudService(Feedback) {
}
}
@UseCommand('investigate', '调研')
private async investigateCommand() {
return '欢迎访问MC有奖调研功能。目前暂时无进行中的调研。我们一般每1-2个月都会公布有奖调研,欢迎下次再查询。';
}
@UseCommand('feedback', '发送反馈。')
private async feedbackCommand(@PutSession() session: Session) {
await session.send(
......
import { Test, TestingModule } from '@nestjs/testing';
import { OnSubscribeService } from './on-subscribe.service';
describe('OnSubscribeService', () => {
let service: OnSubscribeService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [OnSubscribeService],
}).compile();
service = module.get<OnSubscribeService>(OnSubscribeService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
});
import { Injectable } from '@nestjs/common';
import { UseEvent } from 'koishi-nestjs';
import { Session } from 'koishi';
@Injectable()
export class OnSubscribeService {
@UseEvent('wechat:subscribe')
async onSubscribe(session: Session) {
await session.send('感谢关注决斗暗网服务号!');
}
}
......@@ -50,11 +50,6 @@ export class ReplyService implements OnModuleInit {
'现在为广大玩家们提供娘化补丁下载。\n' +
'详情与下载方式:https://ygobbs.com/t/396440',
},
{
key: 'bonus',
content:
'欢迎访问MC有奖调研功能。目前暂时无进行中的调研。我们一般每1-2个月都会公布有奖调研,欢迎下次再查询。',
},
];
constructor(@InjectContext() private ctx: Context) {}
......
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