diff --git a/spec/integ/matrix-client-methods.spec.ts b/spec/integ/matrix-client-methods.spec.ts
index c1c4c30dc..01e24ded4 100644
--- a/spec/integ/matrix-client-methods.spec.ts
+++ b/spec/integ/matrix-client-methods.spec.ts
@@ -1177,11 +1177,10 @@ describe("MatrixClient", function () {
.when("PUT", "/send")
.check((req) => {
expect(req.data).toStrictEqual({
- "msgtype": "m.emote",
- "body": "Body",
- "formatted_body": "
Body
",
- "format": "org.matrix.custom.html",
- "org.matrix.msc1767.message": expect.anything(),
+ msgtype: "m.emote",
+ body: "Body",
+ formatted_body: "Body
",
+ format: "org.matrix.custom.html",
});
})
.respond(200, { event_id: "$foobar" });
@@ -1197,11 +1196,10 @@ describe("MatrixClient", function () {
.when("PUT", "/send")
.check((req) => {
expect(req.data).toStrictEqual({
- "msgtype": "m.text",
- "body": "Body",
- "formatted_body": "Body
",
- "format": "org.matrix.custom.html",
- "org.matrix.msc1767.message": expect.anything(),
+ msgtype: "m.text",
+ body: "Body",
+ formatted_body: "Body
",
+ format: "org.matrix.custom.html",
});
})
.respond(200, { event_id: "$foobar" });
diff --git a/src/client.ts b/src/client.ts
index 551119307..c7c75b35d 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -18,7 +18,7 @@ limitations under the License.
* This is an internal module. See {@link MatrixClient} for the public class.
*/
-import { EmoteEvent, IPartialEvent, MessageEvent, NoticeEvent, Optional } from "matrix-events-sdk";
+import { Optional } from "matrix-events-sdk";
import type { IMegolmSessionData } from "./@types/crypto";
import { ISyncStateData, SyncApi, SyncApiOptions, SyncState } from "./sync";
@@ -4541,44 +4541,8 @@ export class MatrixClient extends TypedEventEmitter | undefined => {
- let newEvent: IPartialEvent | undefined;
-
- if (content["msgtype"] === MsgType.Text) {
- newEvent = MessageEvent.from(content["body"], content["formatted_body"]).serialize();
- } else if (content["msgtype"] === MsgType.Emote) {
- newEvent = EmoteEvent.from(content["body"], content["formatted_body"]).serialize();
- } else if (content["msgtype"] === MsgType.Notice) {
- newEvent = NoticeEvent.from(content["body"], content["formatted_body"]).serialize();
- }
-
- if (newEvent && content["m.new_content"] && recurse) {
- const newContent = makeContentExtensible(content["m.new_content"], false);
- if (newContent) {
- newEvent.content["m.new_content"] = newContent.content;
- }
- }
-
- if (newEvent) {
- // copy over all other fields we don't know about
- for (const [k, v] of Object.entries(content)) {
- if (!newEvent.content.hasOwnProperty(k)) {
- newEvent.content[k] = v;
- }
- }
- }
-
- return newEvent;
- };
- const result = makeContentExtensible(sendContent);
- if (result) {
- eventType = result.type;
- sendContent = result.content;
- }
+ const eventType: string = EventType.RoomMessage;
+ const sendContent: IContent = content as IContent;
return this.sendEvent(roomId, threadId as string | null, eventType, sendContent, txnId);
}