onebots
Version:
基于icqq的多例oneBot实现
68 lines (67 loc) • 2.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FriendAction = void 0;
class FriendAction {
/**
* 发送私聊消息
* @param user_id {number} 用户id
* @param message {V11.Sendable} 发送的消息
* @param message_id {number} 引用的消息ID
*/
async sendPrivateMsg(user_id, message, message_id) {
const msg_id = message_id ? this.getStrByInt("message_id", message_id) : undefined;
const uid = this.getStrByInt("user_id", user_id);
return this.adapter.call(this.oneBot.uin, "V11", "sendPrivateMessage", [
uid,
message,
msg_id,
]);
}
/**
* 发送转发消息
* @param user_id {number} 用户id
* @param messages {V11.MessageNode[]} 转发节点
*/
async sendPrivateForwardMsg(user_id, messages) {
const uid = this.getStrByInt("user_id", user_id);
return this.adapter.call(this.oneBot.uin, "V11", "sendPrivateForwardMessage", [
uid,
messages,
]);
}
/**
* 获取好友列表
*/
async getFriendList() {
return this.adapter.call(this.oneBot.uin, "V11", "getFriendList");
}
/**
* 处理好友添加请求
* @param flag {string} 请求flag
* @param approve {boolean} 是否同意
* @param remark {string} 添加后的备注
*/
async setFriendAddRequest(flag, approve = true, remark = "") {
return this.adapter.call(this.oneBot.uin, "V11", "setFriendAddRequest", [
flag,
approve,
remark,
]);
}
/**
* 获取陌生人信息
* @param user_id {number} 用户id
*/
async getStrangerInfo(user_id) {
return this.adapter.call(this.oneBot.uin, "V11", "getStrangerInfo", [user_id]);
}
/**
* 为指定用户点赞
* @param user_id {number} 用户id
* @param times 点赞次数
*/
async sendLike(user_id, times) {
return this.adapter.call(this.oneBot.uin, "V11", "sendLike", [user_id, times]);
}
}
exports.FriendAction = FriendAction;