@kotori-bot/kotori-plugin-adapter-sandbox
Version:
Kotori modules test environment,a visual sandbox
253 lines (250 loc) • 10.5 kB
JavaScript
/**
* @Package @kotori-bot/kotori-plugin-adapter-sandbox
* @Version 1.1.0
* @Author Hotaru <me@hotaru.icu>
* @Copyright 2024 Hotaru. All rights reserved.
* @License GPL-3.0
* @Link https://github.com/kotorijs/kotori
* @Date 2024/8/8 20:54:03
*/
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var type_exports = {};
__export(type_exports, {
eventDataSchema: () => eventDataSchema,
responseSchema: () => responseSchema
});
module.exports = __toCommonJS(type_exports);
var import_kotori_bot = require("kotori-bot");
const eventDataPrivateMsgSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_message"),
type: import_kotori_bot.Tsu.Literal(0),
message: import_kotori_bot.Tsu.String(),
messageAlt: import_kotori_bot.Tsu.String(),
userId: import_kotori_bot.Tsu.String(),
sender: import_kotori_bot.Tsu.Object({
nickname: import_kotori_bot.Tsu.String()
}),
time: import_kotori_bot.Tsu.Number()
});
const eventDataGroupMsgSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_message"),
type: import_kotori_bot.Tsu.Literal(1),
message: import_kotori_bot.Tsu.String(),
messageAlt: import_kotori_bot.Tsu.String(),
userId: import_kotori_bot.Tsu.String(),
sender: import_kotori_bot.Tsu.Object({
nickname: import_kotori_bot.Tsu.String(),
role: import_kotori_bot.Tsu.Enum(import_kotori_bot.Tsu.Literal("owner"), import_kotori_bot.Tsu.Literal("admin"), import_kotori_bot.Tsu.Literal("member"))
}),
time: import_kotori_bot.Tsu.Number(),
groupId: import_kotori_bot.Tsu.String()
});
const eventDataChannelMsgSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_message"),
type: import_kotori_bot.Tsu.Literal(2),
message: import_kotori_bot.Tsu.String(),
messageAlt: import_kotori_bot.Tsu.String(),
userId: import_kotori_bot.Tsu.String(),
sender: import_kotori_bot.Tsu.Object({
nickname: import_kotori_bot.Tsu.String()
}),
time: import_kotori_bot.Tsu.Number(),
channelId: import_kotori_bot.Tsu.String()
});
const eventDataPrivateMsgDeleteSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_message_delete"),
type: import_kotori_bot.Tsu.Literal(0),
userId: import_kotori_bot.Tsu.String(),
messageId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataGroupMsgDeleteSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_message_delete"),
type: import_kotori_bot.Tsu.Literal(1),
userId: import_kotori_bot.Tsu.String(),
messageId: import_kotori_bot.Tsu.String(),
operatorId: import_kotori_bot.Tsu.String(),
groupId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataChannelMsgDeleteSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_message_delete"),
type: import_kotori_bot.Tsu.Literal(2),
userId: import_kotori_bot.Tsu.String(),
messageId: import_kotori_bot.Tsu.String(),
operatorId: import_kotori_bot.Tsu.String(),
channelId: import_kotori_bot.Tsu.String(),
guildId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataFriendIncreaseSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_friend_increase"),
type: import_kotori_bot.Tsu.Literal(0),
userId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataFriendDecreaseSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_friend_decrease"),
type: import_kotori_bot.Tsu.Literal(0),
userId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataGroupIncreaseSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_group_increase"),
type: import_kotori_bot.Tsu.Literal(1),
userId: import_kotori_bot.Tsu.String(),
operatorId: import_kotori_bot.Tsu.String(),
groupId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataGroupDecreaseSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_group_decrease"),
type: import_kotori_bot.Tsu.Literal(1),
userId: import_kotori_bot.Tsu.String(),
operatorId: import_kotori_bot.Tsu.String(),
groupId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataGuildIncreaseSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_guild_increase"),
type: import_kotori_bot.Tsu.Literal(2),
userId: import_kotori_bot.Tsu.String(),
operatorId: import_kotori_bot.Tsu.String(),
channelId: import_kotori_bot.Tsu.String(),
guildId: import_kotori_bot.Tsu.String()
});
const eventDataGuildDecreaseSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_guild_decrease"),
type: import_kotori_bot.Tsu.Literal(2),
userId: import_kotori_bot.Tsu.String(),
operatorId: import_kotori_bot.Tsu.String(),
channelId: import_kotori_bot.Tsu.String(),
guildId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataChannelIncreaseSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_channel_increase"),
type: import_kotori_bot.Tsu.Literal(2),
userId: import_kotori_bot.Tsu.String(),
operatorId: import_kotori_bot.Tsu.String(),
channelId: import_kotori_bot.Tsu.String(),
guildId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataChannelDecreaseSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_channel_decrease"),
type: import_kotori_bot.Tsu.Literal(2),
userId: import_kotori_bot.Tsu.String(),
operatorId: import_kotori_bot.Tsu.String(),
channelId: import_kotori_bot.Tsu.String(),
guildId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataGroupAdminSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_group_admin"),
type: import_kotori_bot.Tsu.Literal(1),
userId: import_kotori_bot.Tsu.String(),
operation: import_kotori_bot.Tsu.Union(import_kotori_bot.Tsu.Literal("set"), import_kotori_bot.Tsu.Literal("unset")),
groupId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataGroupBanSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_group_ban"),
type: import_kotori_bot.Tsu.Literal(1),
userId: import_kotori_bot.Tsu.String(),
operatorId: import_kotori_bot.Tsu.String(),
duration: import_kotori_bot.Tsu.Number(),
groupId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataGroupWholeBanSchema = import_kotori_bot.Tsu.Object({
event: import_kotori_bot.Tsu.Literal("on_group_whole_ban"),
type: import_kotori_bot.Tsu.Literal(1),
operatorId: import_kotori_bot.Tsu.String(),
operation: import_kotori_bot.Tsu.Union(import_kotori_bot.Tsu.Literal("set"), import_kotori_bot.Tsu.Literal("unset")),
groupId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const eventDataSchema = import_kotori_bot.Tsu.Union(
eventDataPrivateMsgSchema,
eventDataGroupMsgSchema,
eventDataChannelMsgSchema,
eventDataPrivateMsgDeleteSchema,
eventDataGroupMsgDeleteSchema,
eventDataChannelMsgDeleteSchema,
eventDataFriendIncreaseSchema,
eventDataFriendDecreaseSchema,
eventDataGroupIncreaseSchema,
eventDataGroupDecreaseSchema,
eventDataGuildIncreaseSchema,
eventDataGuildDecreaseSchema,
eventDataChannelIncreaseSchema,
eventDataChannelDecreaseSchema,
eventDataGroupAdminSchema,
eventDataGroupBanSchema,
eventDataGroupWholeBanSchema
);
const sendMessageResponseSchema = import_kotori_bot.Tsu.Object({
response: import_kotori_bot.Tsu.Literal("send_message_response"),
messageId: import_kotori_bot.Tsu.String(),
time: import_kotori_bot.Tsu.Number()
});
const selfInfoResponseSchema = import_kotori_bot.Tsu.Object({
response: import_kotori_bot.Tsu.Literal("self_info_response"),
userId: import_kotori_bot.Tsu.String(),
username: import_kotori_bot.Tsu.String(),
userDisplayname: import_kotori_bot.Tsu.String()
});
const userInfoResponseSchema = import_kotori_bot.Tsu.Object({
response: import_kotori_bot.Tsu.Literal("user_info_response"),
userId: import_kotori_bot.Tsu.String(),
username: import_kotori_bot.Tsu.String(),
userDisplayname: import_kotori_bot.Tsu.String(),
userRemark: import_kotori_bot.Tsu.String()
});
const friendListResponseSchema = import_kotori_bot.Tsu.Array(userInfoResponseSchema);
const groupInfoResponseSchema = import_kotori_bot.Tsu.Object({
response: import_kotori_bot.Tsu.Literal("group_info_response"),
groupId: import_kotori_bot.Tsu.String(),
groupName: import_kotori_bot.Tsu.String()
});
const groupListResponseSchema = import_kotori_bot.Tsu.Array(groupInfoResponseSchema);
const groupMemberInfoResponseSchema = import_kotori_bot.Tsu.Object({
response: import_kotori_bot.Tsu.Literal("group_member_info_response"),
userId: import_kotori_bot.Tsu.String(),
username: import_kotori_bot.Tsu.String(),
userDisplayname: import_kotori_bot.Tsu.String()
});
const groupMemberListResponseSchema = import_kotori_bot.Tsu.Array(groupMemberInfoResponseSchema);
const responseSchema = import_kotori_bot.Tsu.Union(
sendMessageResponseSchema,
selfInfoResponseSchema,
userInfoResponseSchema,
friendListResponseSchema,
groupInfoResponseSchema,
groupListResponseSchema,
groupMemberInfoResponseSchema,
groupMemberListResponseSchema
);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
eventDataSchema,
responseSchema
});