feat:为戳戳添加昵称

This commit is contained in:
Jerry 2025-08-29 23:02:26 +08:00
parent 39008cda53
commit ea7b3103f0
2 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import axios from 'axios';
import configControl from '../lib/config/configControl.js'; import configControl from '../lib/config/configControl.js';
const replyPoke = configControl.get('poke')?.replyPoke; const replyPoke = configControl.get('poke')?.replyPoke;
const nickName = configControl.get('profile')?.nickName;
export default class ChuochuoPlugin extends plugin { export default class ChuochuoPlugin extends plugin {
constructor() { constructor() {
@ -64,6 +65,7 @@ async function handleBotPoke(e) {
const res = await axios.post(targetUrl, { const res = await axios.post(targetUrl, {
type: 'poke', type: 'poke',
id: 'poke', id: 'poke',
name: nickName,
}); });
if (res.data.success) { if (res.data.success) {
await e.reply(res.data.data); await e.reply(res.data.data);
@ -72,10 +74,10 @@ async function handleBotPoke(e) {
await e.bot.sendApi('group_poke', { group_id: e.group_id, user_id: e.operator_id }); await e.bot.sendApi('group_poke', { group_id: e.group_id, user_id: e.operator_id });
} }
} else { } else {
await e.reply(`戳一戳出错了!${configControl.get('nickName')}不知道该说啥好了..`); await e.reply(`戳一戳出错了!${configControl.get('profile')?.nickName}不知道该说啥好了..`);
} }
} catch (err) { } catch (err) {
logger.error('戳一戳请求失败', err); logger.error('戳一戳请求失败', err);
await e.reply(`戳一戳出错了!${configControl.get('nickName')}不知道该说啥好了..`); await e.reply(`戳一戳出错了!${configControl.get('profile')?.nickName}不知道该说啥好了..`);
} }
} }

3
config/profile.json Normal file
View File

@ -0,0 +1,3 @@
{
"nickName": "鸡气人"
}