mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 13:17:32 +00:00
fix: 主人权限,消息撤回
This commit is contained in:
parent
eacea6e902
commit
18f24f87bb
7 changed files with 107 additions and 35 deletions
|
|
@ -3,7 +3,7 @@ import settings from '../../lib/settings.js';
|
|||
|
||||
export async function addAlias() {
|
||||
if (!this.e.isMaster) {
|
||||
this.reply('仅限主人设置');
|
||||
this.reply('仅限主人设置', false, { at: true, recallMsg: 100 });
|
||||
return false;
|
||||
}
|
||||
const match = /添加(\S+)别名(\S+)$/g.exec(this.e.msg);
|
||||
|
|
@ -12,15 +12,24 @@ export async function addAlias() {
|
|||
const oriName = char.aliasToName(key);
|
||||
const isExist = char.aliasToName(value);
|
||||
if (!oriName) {
|
||||
await this.e.reply(`未找到 ${value} 的对应角色`);
|
||||
await this.e.reply(`未找到 ${value} 的对应角色`, false, {
|
||||
at: true,
|
||||
recallMsg: 100,
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (isExist) {
|
||||
await this.e.reply(`别名 ${value} 已存在`);
|
||||
await this.e.reply(`别名 ${value} 已存在`, false, {
|
||||
at: true,
|
||||
recallMsg: 100,
|
||||
});
|
||||
return;
|
||||
}
|
||||
settings.addArrayleConfig('alias', oriName, value);
|
||||
await this.e.reply(`角色 ${key} 别名 ${value} 成功`);
|
||||
await this.e.reply(`角色 ${key} 别名 ${value} 成功`, false, {
|
||||
at: true,
|
||||
recallMsg: 100,
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteAlias() {
|
||||
|
|
@ -32,13 +41,22 @@ export async function deleteAlias() {
|
|||
const key = match[1];
|
||||
const oriName = char.aliasToName(key);
|
||||
if (!oriName) {
|
||||
await this.e.reply(`未找到 ${key} 的对应角色`);
|
||||
await this.e.reply(`未找到 ${key} 的对应角色`, false, {
|
||||
at: true,
|
||||
recallMsg: 100,
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (key === oriName) {
|
||||
await this.e.reply(`别名 ${key} 为角色本名,无法删除`);
|
||||
await this.e.reply(`别名 ${key} 为角色本名,无法删除`, false, {
|
||||
at: true,
|
||||
recallMsg: 100,
|
||||
});
|
||||
return;
|
||||
}
|
||||
settings.removeArrayleConfig('alias', oriName, key);
|
||||
await this.e.reply(`角色 ${key} 别名删除成功`);
|
||||
await this.e.reply(`角色 ${key} 别名删除成功`, false, {
|
||||
at: true,
|
||||
recallMsg: 100,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue