UNPKG

koishi-plugin-steam-family-bot

Version:

一个用于新版 Steam 家庭的库存监控 koishi Bot 插件

51 lines 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.KSession = void 0; const steam_family_bot_core_1 = require("steam-family-bot-core"); const koishi_1 = require("koishi"); class KSession { // create a session Object? session; uid; lang; store; constructor(session, tmpFileStorage) { this.session = session; this.uid = session.uid; this.lang = 'zh-cn'; this.store = tmpFileStorage; } getSessionInfo() { return { uid: this.session.uid, channelId: this.session.channelId, selfId: this.session.selfId, platform: this.session.platform, }; } async send(msg) { await this.session.send(msg); } async sendImgUrl(url) { await this.session.send((0, koishi_1.h)('message', [(0, koishi_1.h)('img', { src: url })])); } async sendImgBuffer(content, mimeType) { if (this.store) { const url = await this.store.uploadImg(content, mimeType); return await this.sendImgUrl(url); } await this.session.send(koishi_1.h.image(content, mimeType ?? 'image/png')); } async sendQueued(msg) { await this.session.sendQueued(msg); } async sendQuote(msg) { await this.session.sendQueued(msg); } text(path, params = {}) { const res = (0, steam_family_bot_core_1.tran)(path, params, this.lang); return res ?? path; } } exports.KSession = KSession; //# sourceMappingURL=cmd-session.js.map