Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🎸 broadcast #217

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/mixins/message-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import type {
ImageType,
} from '../schemas/image.js'
import type {
BroadcastStatus,
BroadcastTargetStatus,
MessagePayload,
MessagePayloadFilterFunction,
MessageQueryFilter,
Expand Down Expand Up @@ -77,6 +79,16 @@ const messageMixin = <MinxinBase extends typeof PuppetSkeleton & CacheMixin>(bas
abstract messageSendText (conversationId: string, text: string, mentionIdList?: string[]) : Promise<void | string>
abstract messageSendUrl (conversationId: string, urlLinkPayload: UrlLinkPayload) : Promise<void | string>

abstract createMessageBroadcast(targets: string[], content: PostPayload): Promise<void | string>
abstract getMessageBroadcastStatus(id: string): Promise<{
status: BroadcastStatus,
detail: {
contactId?: string,
roomId?: string,
status: BroadcastTargetStatus,
}[]
}>

abstract messageRecall (messageId: string) : Promise<boolean>

/**
Expand Down
4 changes: 4 additions & 0 deletions src/mods/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
FriendshipType,
ImageType,
MessageType,
BroadcastStatus,
BroadcastTargetStatus,
PostType,
TapType,
sayableTypes,
Expand Down Expand Up @@ -42,6 +44,8 @@ export {

export {
ScanStatus,
BroadcastStatus,
BroadcastTargetStatus,
type FriendshipAddOptions,
YOU,
CHAT_EVENT_DICT,
Expand Down
13 changes: 13 additions & 0 deletions src/schemas/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,16 @@ export type MessagePayloadFilterFunction = (payload: MessagePayload) => boole

/** @hidden */
export type MessagePayloadFilterFactory = (query: MessageQueryFilter) => MessagePayloadFilterFunction

export enum BroadcastStatus {
Unknown = 0,
Sending = 1,
Sent = 2
}

export enum BroadcastTargetStatus {
Unsent = 0,
Sent = 1,
NotFriend = 2,
Occupied = 3,
}
4 changes: 4 additions & 0 deletions src/schemas/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
type MessagePayloadTo,
type MessageQueryFilter,
MessageType,
BroadcastStatus,
BroadcastTargetStatus,
} from './message.js'
import { DirtyType } from './dirty.js'
import {
Expand Down Expand Up @@ -114,6 +116,8 @@ export {
isPostPayloadClient,
isPostPayloadServer,
MessageType,
BroadcastStatus,
BroadcastTargetStatus,
PaginationRequest,
PaginationResponse,
PostType,
Expand Down