Skip to content

Commit

Permalink
✨跟随撤回(beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirius0v0 committed Jun 12, 2022
1 parent bf87097 commit 945e322
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "siriusbot2",
"version": "3.3.1",
"version": "3.4.0",
"description": "qqGroup bot for fun",
"main": "index.js",
"scripts": {
Expand Down
20 changes: 20 additions & 0 deletions plugins/follow-recall/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"pluginName": "plugin-follow-recall",
"default": true,
"privateAvl": false,
"cmd": [],
"options": {
"alias": {},
"boolean": [],
"default": {},
"string": []
},
"usage": "撤回消息",
"description": "跟随撤回消息",
"showThisFeature": false,
"permission": [
"member",
"admin",
"owner"
]
}
27 changes: 27 additions & 0 deletions plugins/follow-recall/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
console.log('plugin-follow-recall loaded');

import _ from "lodash";
import { getPermission } from "../../lib/permission.js";
import dirname from "../../lib/dirname.js";
const __dirname = dirname(import.meta.url);


function apply(hook) {
hook('onNotice', function (e) {
/* 检查命令是否匹配及其功能使用权限 */
if (!getPermission(e.data, __dirname)) return;
if (e.data.sub_type !== "recall") return;
let msgId = e.data.messageDic[e.data.message_id];
if (!msgId) {
setTimeout(() => {
msgId = e.data.messageDic[e.data.message_id];
if (msgId) e.data.group.recallMsg(msgId);
}, 30 * 1000);
}
else {
e.data.group.recallMsg(msgId);
};
});
}

export { apply };

0 comments on commit 945e322

Please sign in to comment.