koishi-plugin-steam-family-bot
Version:
一个用于新版 Steam 家庭的库存监控 koishi Bot 插件
47 lines • 1.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.KoishiSession = void 0;
const steam_family_bot_core_1 = require("steam-family-bot-core");
const koishi_1 = require("koishi");
class KoishiSession {
bot;
channelInfo;
uid;
lang;
store;
constructor(bot, channelInfo, store) {
this.lang = 'zh-cn';
this.bot = bot;
this.uid = channelInfo.uid;
this.channelInfo = channelInfo;
this.store = store;
}
async sendImgUrl(url) {
await this.bot.sendMessage(this.channelInfo.channelId, (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.bot.sendMessage(this.channelInfo.channelId, koishi_1.h.image(content, mimeType ?? 'image/png'));
}
getSessionInfo() {
return this.channelInfo;
}
async send(msg) {
await this.bot.sendMessage(this.channelInfo.channelId, msg);
}
async sendQueued(msg) {
await this.bot.sendMessage(this.channelInfo.channelId, msg);
}
sendQuote(msg) {
throw Error('unsupport quote reply in passive msg');
}
text(path, params = {}) {
const res = (0, steam_family_bot_core_1.tran)(path, params, 'zh-cn');
return res ?? path;
}
}
exports.KoishiSession = KoishiSession;
//# sourceMappingURL=schedule-session.js.map