mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat: 骰子魔法表情 & 猜拳魔法表情
This commit is contained in:
parent
81821e74d8
commit
b501af6e0e
@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
AtType,
|
AtType,
|
||||||
ElementType,
|
ElementType,
|
||||||
|
FaceType,
|
||||||
PicType,
|
PicType,
|
||||||
SendArkElement,
|
SendArkElement,
|
||||||
SendFaceElement,
|
SendFaceElement,
|
||||||
@ -18,6 +19,7 @@ import {calculateFileMD5, isGIF} from "../common/utils/file";
|
|||||||
import {log} from "../common/utils/log";
|
import {log} from "../common/utils/log";
|
||||||
import {defaultVideoThumb, getVideoInfo} from "../common/utils/video";
|
import {defaultVideoThumb, getVideoInfo} from "../common/utils/video";
|
||||||
import {encodeSilk} from "../common/utils/audio";
|
import {encodeSilk} from "../common/utils/audio";
|
||||||
|
import {isNull} from "../common/utils";
|
||||||
|
|
||||||
|
|
||||||
export class SendMsgElementConstructor {
|
export class SendMsgElementConstructor {
|
||||||
@ -237,7 +239,52 @@ export class SendMsgElementConstructor {
|
|||||||
elementId: "",
|
elementId: "",
|
||||||
faceElement: {
|
faceElement: {
|
||||||
faceIndex: faceId,
|
faceIndex: faceId,
|
||||||
faceType: 1
|
faceType: FaceType.normal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static dice(resultId: number|null): SendFaceElement{
|
||||||
|
// 实际测试并不能控制结果
|
||||||
|
|
||||||
|
// 随机1到6
|
||||||
|
if (isNull(resultId)) resultId = Math.floor(Math.random() * 6) + 1;
|
||||||
|
return {
|
||||||
|
elementType: ElementType.FACE,
|
||||||
|
elementId: "",
|
||||||
|
faceElement: {
|
||||||
|
faceIndex: 358,
|
||||||
|
faceType: FaceType.dice,
|
||||||
|
"faceText": "[骰子]",
|
||||||
|
"packId": "1",
|
||||||
|
"stickerId": "33",
|
||||||
|
"sourceType": 1,
|
||||||
|
"stickerType": 2,
|
||||||
|
resultId: resultId.toString(),
|
||||||
|
"surpriseId": "",
|
||||||
|
// "randomType": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 猜拳(石头剪刀布)表情
|
||||||
|
static rps(resultId: number | null): SendFaceElement{
|
||||||
|
// 实际测试并不能控制结果
|
||||||
|
if (isNull(resultId)) resultId = Math.floor(Math.random() * 3) + 1;
|
||||||
|
return {
|
||||||
|
elementType: ElementType.FACE,
|
||||||
|
elementId: "",
|
||||||
|
faceElement: {
|
||||||
|
"faceIndex": 359,
|
||||||
|
"faceText": "[包剪锤]",
|
||||||
|
"faceType": 3,
|
||||||
|
"packId": "1",
|
||||||
|
"stickerId": "34",
|
||||||
|
"sourceType": 1,
|
||||||
|
"stickerType": 2,
|
||||||
|
"resultId": resultId.toString(),
|
||||||
|
"surpriseId": "",
|
||||||
|
// "randomType": 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,9 +212,22 @@ export interface GrayTipElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum FaceType {
|
||||||
|
normal=1, // 小黄脸
|
||||||
|
dice=3 // 骰子
|
||||||
|
}
|
||||||
|
|
||||||
export interface FaceElement {
|
export interface FaceElement {
|
||||||
faceIndex: number,
|
faceIndex: number,
|
||||||
faceType: 1
|
faceType: FaceType,
|
||||||
|
faceText?: string,
|
||||||
|
packId?: string,
|
||||||
|
stickerId?: string,
|
||||||
|
sourceType?: number,
|
||||||
|
stickerType?: number,
|
||||||
|
resultId?: string,
|
||||||
|
surpriseId?: string,
|
||||||
|
randomType?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MarketFaceElement {
|
export interface MarketFaceElement {
|
||||||
|
@ -224,6 +224,14 @@ export async function createSendElements(messageData: OB11MessageData[], target:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case OB11MessageDataType.dice:{
|
||||||
|
const resultId = sendMsg.data?.result
|
||||||
|
sendElements.push(SendMsgElementConstructor.dice(resultId));
|
||||||
|
}break;
|
||||||
|
case OB11MessageDataType.RPS:{
|
||||||
|
const resultId = sendMsg.data?.result
|
||||||
|
sendElements.push(SendMsgElementConstructor.rps(resultId));
|
||||||
|
}break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,9 @@ export enum OB11MessageDataType {
|
|||||||
node = "node", // 合并转发消息节点
|
node = "node", // 合并转发消息节点
|
||||||
forward = "forward", // 合并转发消息,用于上报
|
forward = "forward", // 合并转发消息,用于上报
|
||||||
xml = "xml",
|
xml = "xml",
|
||||||
poke = "poke"
|
poke = "poke",
|
||||||
|
dice = "dice",
|
||||||
|
RPS = "rps"
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OB11MessageMFace{
|
export interface OB11MessageMFace{
|
||||||
@ -126,6 +128,20 @@ export interface OB11MessageMFace{
|
|||||||
text: string
|
text: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface OB11MessageDice{
|
||||||
|
type: OB11MessageDataType.dice,
|
||||||
|
data: {
|
||||||
|
result: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface OB11MessageRPS{
|
||||||
|
type: OB11MessageDataType.RPS,
|
||||||
|
data: {
|
||||||
|
result: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export interface OB11MessageText {
|
export interface OB11MessageText {
|
||||||
type: OB11MessageDataType.text,
|
type: OB11MessageDataType.text,
|
||||||
data: {
|
data: {
|
||||||
@ -226,7 +242,8 @@ export type OB11MessageData =
|
|||||||
OB11MessageFace | OB11MessageMFace |
|
OB11MessageFace | OB11MessageMFace |
|
||||||
OB11MessageAt | OB11MessageReply |
|
OB11MessageAt | OB11MessageReply |
|
||||||
OB11MessageImage | OB11MessageRecord | OB11MessageFile | OB11MessageVideo |
|
OB11MessageImage | OB11MessageRecord | OB11MessageFile | OB11MessageVideo |
|
||||||
OB11MessageNode | OB11MessageCustomMusic | OB11MessageJson | OB11MessagePoke
|
OB11MessageNode | OB11MessageCustomMusic | OB11MessageJson | OB11MessagePoke |
|
||||||
|
OB11MessageDice | OB11MessageRPS
|
||||||
|
|
||||||
export interface OB11PostSendMsg {
|
export interface OB11PostSendMsg {
|
||||||
message_type?: "private" | "group"
|
message_type?: "private" | "group"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user