UNPKG

munar-adapter-plugdj

Version:

plug.dj adapter for Munar

41 lines (31 loc) 744 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _DJBooth = require("./DJBooth"); class DJHistory { constructor(plug) { this.plug = plug; } get mp() { return this.plug.mp; } convertUser(raw) { const user = this.mp.user(raw.id); if (user) { return this.plug.toBotUser(user); } return this.plug.toBotUser(raw); } async getRecent(limit) { const history = await this.mp.getRoomHistory(); return history.slice(0, limit).map(entry => ({ id: entry.id, media: (0, _DJBooth.convertMedia)(entry.media), user: this.convertUser(entry.user), playedAt: entry.timestamp })); } } exports.default = DJHistory;