koishi-plugin-kbot
Version:
A muti-function qq bot for koishi
31 lines (30 loc) • 1.05 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.botRoutes = void 0;
const utils_1 = __importDefault(require("../utils"));
function getBots(context) {
return async (ctx) => {
const bots = context.bots.filter(bot => bot.platform === 'onebot' && bot.status === 'online');
ctx.body = bots.map((bot) => {
return {
userId: bot.selfId,
avatar: bot.avatar,
nickname: bot.username,
};
});
};
}
exports.botRoutes = {
'/bots': function (context) {
return getBots(context);
},
'/sendMessage': function (context) {
return (0, utils_1.default)(context, 'sendMessage', 'botId', 'guildId', 'message', '');
},
'/broadcast': function (context) {
return (0, utils_1.default)(context, 'broadcast', 'botId', 'channels', 'message', 'delay');
},
};