mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
研究消息右键菜单
This commit is contained in:
parent
18ffad8109
commit
7124e550f5
1
src/global.d.ts
vendored
1
src/global.d.ts
vendored
@ -17,6 +17,7 @@ declare var LLAPI: {
|
||||
getFriendsList(forced: boolean): Promise<User[]>
|
||||
getGroupMemberList(group_id: string, num: number): Promise<{result: { infos: Map<string, GroupMemberInfo> }}>
|
||||
getPeer(): Promise<Peer>
|
||||
add_qmenu(func: (qContextMenu: {insertAdjacentHTML: (location: string, ele: string)=>void})=>void): void
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
// 运行在 Electron 主进程 下的插件入口
|
||||
|
||||
import {Group, PostDataSendMsg, User} from "./types";
|
||||
// import {Group, PostDataSendMsg, User} from "./types";
|
||||
// type {Group, PostDataSendMsg, User} = import( "./types");
|
||||
type Group = import( "./types").Group;
|
||||
type PostDataSendMsg = import( "./types").PostDataSendMsg;
|
||||
type User = import( "./types").User;
|
||||
|
||||
const express = require("express")
|
||||
const {ipcMain, webContents} = require('electron');
|
||||
|
@ -1,6 +1,9 @@
|
||||
// Electron 主进程 与 渲染进程 交互的桥梁
|
||||
|
||||
import {Group, PostDataSendMsg, User} from "./types";
|
||||
// import {Group, PostDataSendMsg, User} from "./types";
|
||||
// type Group = import( "./types").Group;
|
||||
// type PostDataSendMsg = import( "./types").PostDataSendMsg;
|
||||
// type User = import( "./types").User;
|
||||
|
||||
const {contextBridge} = require("electron");
|
||||
const {ipcRenderer} = require('electron');
|
||||
|
@ -203,9 +203,21 @@ function onLoad() {
|
||||
}
|
||||
|
||||
window.LLAPI.on("new-messages", onNewMessages);
|
||||
function test(){
|
||||
console.log("test")
|
||||
}
|
||||
try {
|
||||
window.LLAPI.add_qmenu((qContextMenu: { insertAdjacentHTML: (location: string, ele: string) => void }) => {
|
||||
qContextMenu.insertAdjacentHTML("beforeend", `<a class="q-context-menu-item q-context-menu-item--normal vue-component" aria-disabled="false" role="menuitem" tabindex="-1" onclick="test">获取群成员列表</a>`)
|
||||
})
|
||||
}catch (e){
|
||||
log(e)
|
||||
}
|
||||
|
||||
window.LLAPI.on("context-msg-menu", (event, target, msgIds) => {
|
||||
console.log(event);
|
||||
console.log("msg menu", event, target, msgIds);
|
||||
// 消息右键菜单添加一个获取群成员列表的按钮
|
||||
|
||||
window.LLAPI.getPeer().then(peer => {
|
||||
// console.log("current peer", peer)
|
||||
if (peer && peer.chatType == "group") {
|
||||
@ -251,7 +263,7 @@ function onLoad() {
|
||||
}
|
||||
}
|
||||
|
||||
getChatListEle();
|
||||
// getChatListEle();
|
||||
}
|
||||
|
||||
// 打开设置界面时触发
|
||||
|
@ -3,7 +3,7 @@
|
||||
"target": "es6",
|
||||
"module": "es6",
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"strict": false,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"moduleResolution": "node",
|
||||
|
Loading…
x
Reference in New Issue
Block a user