mirror of https://github.com/vector-im/riot-web
Run chat effects on events sent by widgets too
parent
18a60ae2ea
commit
b6123506d4
|
@ -39,7 +39,10 @@ import WidgetCapabilitiesPromptDialog, {
|
||||||
import { WidgetPermissionCustomisations } from "../../customisations/WidgetPermissions";
|
import { WidgetPermissionCustomisations } from "../../customisations/WidgetPermissions";
|
||||||
import { OIDCState, WidgetPermissionStore } from "./WidgetPermissionStore";
|
import { OIDCState, WidgetPermissionStore } from "./WidgetPermissionStore";
|
||||||
import { WidgetType } from "../../widgets/WidgetType";
|
import { WidgetType } from "../../widgets/WidgetType";
|
||||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
import { EventType, MsgType } from "matrix-js-sdk/src/@types/event";
|
||||||
|
import { CHAT_EFFECTS } from "../../effects";
|
||||||
|
import { containsEmoji } from "../../effects/utils";
|
||||||
|
import dis from "../../dispatcher/dispatcher";
|
||||||
|
|
||||||
// TODO: Purge this from the universe
|
// TODO: Purge this from the universe
|
||||||
|
|
||||||
|
@ -123,6 +126,14 @@ export class StopGapWidgetDriver extends WidgetDriver {
|
||||||
} else {
|
} else {
|
||||||
// message event
|
// message event
|
||||||
r = await client.sendEvent(roomId, eventType, content);
|
r = await client.sendEvent(roomId, eventType, content);
|
||||||
|
|
||||||
|
if (eventType === EventType.RoomMessage) {
|
||||||
|
CHAT_EFFECTS.forEach((effect) => {
|
||||||
|
if (containsEmoji(content, effect.emojis)) {
|
||||||
|
dis.dispatch({action: `effects.${effect.command}`});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {roomId, eventId: r.event_id};
|
return {roomId, eventId: r.event_id};
|
||||||
|
|
Loading…
Reference in New Issue