update
This commit is contained in:
parent
5a797f97c7
commit
291199a995
@ -15,11 +15,9 @@ const visitCache = new Map<string, number>();
|
|||||||
|
|
||||||
export class OpenMcpChannel {
|
export class OpenMcpChannel {
|
||||||
|
|
||||||
@mapper.onGroup(qq_groups.OPENMCP_DEV)
|
@mapper.onGroup(qq_groups.OPENMCP_DEV, { memorySize: 50 })
|
||||||
async handleOpenMcpChannel(c: LagrangeContext<GroupMessage>) {
|
async handleOpenMcpChannel(c: LagrangeContext<GroupMessage>) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const text = c.getRawText();
|
const text = c.getRawText();
|
||||||
const commandResult = parseCommand(text);
|
const commandResult = parseCommand(text);
|
||||||
if (commandResult !== undefined) {
|
if (commandResult !== undefined) {
|
||||||
@ -37,6 +35,9 @@ export class OpenMcpChannel {
|
|||||||
c.sendMessage('检测到超级管理员,TIP 系统允许访问,正在执行 ' + JSON.stringify(commandResult));
|
c.sendMessage('检测到超级管理员,TIP 系统允许访问,正在执行 ' + JSON.stringify(commandResult));
|
||||||
visitCache.set(c.message.user_id.toString(), now);
|
visitCache.set(c.message.user_id.toString(), now);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
c.sendMessage('非法请求,TIP 系统拒绝访问');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { command, args } = commandResult;
|
const { command, args } = commandResult;
|
||||||
|
@ -6,6 +6,7 @@ import { getNews, publishOpenMCP } from './test-channel.service';
|
|||||||
import { es_db, qq_groups, qq_users } from '../global';
|
import { es_db, qq_groups, qq_users } from '../global';
|
||||||
import { parseCommand, sendMessageToDiscord } from '../hook/util';
|
import { parseCommand, sendMessageToDiscord } from '../hook/util';
|
||||||
import { walktalk } from './bug-logger.service';
|
import { walktalk } from './bug-logger.service';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
console.log('activate ' + path.basename(__filename));
|
console.log('activate ' + path.basename(__filename));
|
||||||
|
|
||||||
@ -48,7 +49,6 @@ export class TestChannel {
|
|||||||
const commandResult = parseCommand(text);
|
const commandResult = parseCommand(text);
|
||||||
if (commandResult !== undefined) {
|
if (commandResult !== undefined) {
|
||||||
// 校验身份
|
// 校验身份
|
||||||
|
|
||||||
if (c.message.user_id === qq_users.JIN_HUI) {
|
if (c.message.user_id === qq_users.JIN_HUI) {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const lastVisit = visitCache.get(c.message.user_id.toString());
|
const lastVisit = visitCache.get(c.message.user_id.toString());
|
||||||
@ -61,6 +61,9 @@ export class TestChannel {
|
|||||||
c.sendMessage('检测到超级管理员,TIP 系统允许访问,正在执行 ' + JSON.stringify(commandResult));
|
c.sendMessage('检测到超级管理员,TIP 系统允许访问,正在执行 ' + JSON.stringify(commandResult));
|
||||||
visitCache.set(c.message.user_id.toString(), now);
|
visitCache.set(c.message.user_id.toString(), now);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
c.sendMessage('非法请求,TIP 系统拒绝访问');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { command, args } = commandResult;
|
const { command, args } = commandResult;
|
||||||
@ -119,8 +122,11 @@ export class TestChannel {
|
|||||||
c.setGroupAddRequest('', c.message.sub_type, true, '');
|
c.setGroupAddRequest('', c.message.sub_type, true, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
@mapper.createTimeSchedule('0 11 20 * * *')
|
@mapper.createTimeSchedule('0 40 16 * * *')
|
||||||
async handleTestChannelSchedule(c: LagrangeContext<Message>) {
|
async handleTestChannelSchedule(c: LagrangeContext<Message>) {
|
||||||
c.sendPrivateMsg(qq_users.JIN_HUI, 'hello');
|
const res = await axios.post('http://localhost:3000/get-news-from-hack-news');
|
||||||
|
const data = res.data;
|
||||||
|
const message = data.msg;
|
||||||
|
c.sendGroupMsg(qq_groups.TEST_CHANNEL, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user