feat: complete Ancestor quote bot with production-ready Docker support

This commit is contained in:
unfunny
2026-09-13 14:14:38 -04:00
parent f2016da05a
commit fe7351a7dc
1145 changed files with 30890 additions and 97684 deletions

View File

@@ -1,11 +1,11 @@
import { RoomMember } from "./room-member.ts";
import { EventType } from "../@types/event.ts";
import { type MatrixEvent } from "./event.ts";
import { type MatrixClient } from "../client.ts";
import { GuestAccess, HistoryVisibility, JoinRule } from "../@types/partials.ts";
import { TypedEventEmitter } from "./typed-event-emitter.ts";
import { Beacon, BeaconEvent, type BeaconEventHandlerMap, type BeaconIdentifier } from "./beacon.ts";
import { TypedReEmitter } from "../ReEmitter.ts";
import { RoomMember } from "./room-member";
import { EventType } from "../@types/event";
import { MatrixEvent } from "./event";
import { MatrixClient } from "../client";
import { GuestAccess, HistoryVisibility, JoinRule } from "../@types/partials";
import { TypedEventEmitter } from "./typed-event-emitter";
import { Beacon, BeaconEvent, BeaconEventHandlerMap, BeaconIdentifier } from "./beacon";
import { TypedReEmitter } from "../ReEmitter";
export interface IMarkerFoundOptions {
/** Whether the timeline was empty before the marker event arrived in the
* room. This could be happen in a variety of cases:
@@ -29,12 +29,10 @@ declare enum OobStatus {
export interface IPowerLevelsContent {
users?: Record<string, number>;
events?: Record<string, number>;
notifications?: Partial<Record<"room", number>>;
users_default?: number;
events_default?: number;
state_default?: number;
ban?: number;
invite?: number;
kick?: number;
redact?: number;
}
@@ -42,15 +40,13 @@ export declare enum RoomStateEvent {
Events = "RoomState.events",
Members = "RoomState.members",
NewMember = "RoomState.newMember",
Update = "RoomState.update",// signals batches of updates without specificity
Update = "RoomState.update",
BeaconLiveness = "RoomState.BeaconLiveness",
Marker = "RoomState.Marker"
}
export type RoomStateEventHandlerMap = {
/**
* Fires whenever the event dictionary in room state is updated.
* This does not guarantee that any related objects (like RoomMember) have been updated.
* Use RoomStateEvent.Update for that.
* @param event - The matrix event which caused this event to fire.
* @param state - The room state whose RoomState.events dictionary
* was updated.
@@ -65,7 +61,7 @@ export type RoomStateEventHandlerMap = {
* });
* ```
*/
[RoomStateEvent.Events]: (event: MatrixEvent, state: RoomState, prevEvent: MatrixEvent | null) => void;
[RoomStateEvent.Events]: (event: MatrixEvent, state: RoomState, lastStateEvent: MatrixEvent | null) => void;
/**
* Fires whenever a member in the members dictionary is updated in any way.
* @param event - The matrix event which caused this event to fire.
@@ -103,9 +99,6 @@ export type RoomStateEventHandlerMap = {
};
type EmittedEvents = RoomStateEvent | BeaconEvent;
type EventHandlerMap = RoomStateEventHandlerMap & BeaconEventHandlerMap;
type KeysMatching<T, V> = {
[K in keyof T]-?: T[K] extends V ? K : never;
}[keyof T];
export declare class RoomState extends TypedEventEmitter<EmittedEvents, EventHandlerMap> {
readonly roomId: string;
private oobMemberFlags;
@@ -124,7 +117,6 @@ export declare class RoomState extends TypedEventEmitter<EmittedEvents, EventHan
paginationToken: string | null;
readonly beacons: Map<string, Beacon>;
private _liveBeaconIds;
private getVersionWarning;
/**
* Construct room state.
*
@@ -156,11 +148,6 @@ export declare class RoomState extends TypedEventEmitter<EmittedEvents, EventHan
constructor(roomId: string, oobMemberFlags?: {
status: OobStatus;
});
/**
* Gets the version of the room
* @returns The version of the room
*/
getRoomVersion(): string;
/**
* Returns the number of joined members in this room
* This method caches the result.
@@ -212,15 +199,13 @@ export declare class RoomState extends TypedEventEmitter<EmittedEvents, EventHan
/**
* Get state events from the state of the room.
* @param eventType - The event type of the state event.
* @returns A list of events
* @param stateKey - Optional. The state_key of the state event. If
* this is `undefined` then all matching state events will be
* returned.
* @returns A list of events if state_key was
* `undefined`, else a single event (or null if no match found).
*/
getStateEvents(eventType: EventType | string): MatrixEvent[];
/**
* Get state events from the state of the room.
* @param eventType - The event type of the state event.
* @param stateKey - The state_key of the state event.
* @returns A single event (or null if no match found).
*/
getStateEvents(eventType: EventType | string, stateKey: string): MatrixEvent | null;
get hasLiveBeacons(): boolean;
get liveBeaconIds(): BeaconIdentifier[];
@@ -358,7 +343,7 @@ export declare class RoomState extends TypedEventEmitter<EmittedEvents, EventHan
* @param powerLevel - The power level of the member
* @returns true if the given power level is sufficient
*/
hasSufficientPowerLevelFor(action: KeysMatching<Required<IPowerLevelsContent>, number>, powerLevel: number): boolean;
hasSufficientPowerLevelFor(action: "ban" | "kick" | "redact", powerLevel: number): boolean;
/**
* Short-form for maySendEvent('m.room.message', userId)
* @param userId - The user ID of the user to test permission for