diff --git a/d2m/actions/register-user.test.js b/d2m/actions/register-user.test.js index 7e23450a..0afce500 100644 --- a/d2m/actions/register-user.test.js +++ b/d2m/actions/register-user.test.js @@ -4,21 +4,21 @@ const {test} = require("supertape") const testData = require("../../test/data") test("member2state: general", async t => { - t.deepEqual( - await _memberToStateContent(testData.member.sheep.user, testData.member.sheep, testData.guild.general.id), - { - avatar_url: "mxc://cadence.moe/rfemHmAtcprjLEiPiEuzPhpl", - displayname: "The Expert's Submarine | aprilsong", - membership: "join", - "moe.cadence.ooye.member": { - avatar: "/guilds/112760669178241024/users/134826546694193153/avatars/38dd359aa12bcd52dd3164126c587f8c.png?size=1024" - }, - "uk.half-shot.discord.member": { - bot: false, - displayColor: null, - id: "134826546694193153", - username: "@aprilsong" - } - } - ) + t.deepEqual( + await _memberToStateContent(testData.member.sheep.user, testData.member.sheep, testData.guild.general.id), + { + avatar_url: "mxc://cadence.moe/rfemHmAtcprjLEiPiEuzPhpl", + displayname: "The Expert's Submarine | aprilsong", + membership: "join", + "moe.cadence.ooye.member": { + avatar: "/guilds/112760669178241024/users/134826546694193153/avatars/38dd359aa12bcd52dd3164126c587f8c.png?size=1024" + }, + "uk.half-shot.discord.member": { + bot: false, + displayColor: null, + id: "134826546694193153", + username: "@aprilsong" + } + } + ) }) diff --git a/d2m/converters/message-to-event.test.js b/d2m/converters/message-to-event.test.js index 1f3a844e..6e673f17 100644 --- a/d2m/converters/message-to-event.test.js +++ b/d2m/converters/message-to-event.test.js @@ -3,68 +3,68 @@ const {messageToEvent} = require("./message-to-event") const data = require("../../test/data") test("message2event: simple plaintext", async t => { - const events = await messageToEvent(data.message.simple_plaintext, data.guild.general) - t.deepEqual(events, [{ - $type: "m.room.message", - msgtype: "m.text", - body: "ayy lmao" - }]) + const events = await messageToEvent(data.message.simple_plaintext, data.guild.general) + t.deepEqual(events, [{ + $type: "m.room.message", + msgtype: "m.text", + body: "ayy lmao" + }]) }) test("message2event: simple user mention", async t => { - const events = await messageToEvent(data.message.simple_user_mention, data.guild.general) - t.deepEqual(events, [{ - $type: "m.room.message", - msgtype: "m.text", - body: "@crunch god: Tell me about Phil, renowned martial arts master and creator of the Chin Trick", - format: "org.matrix.custom.html", - formatted_body: '@crunch god Tell me about Phil, renowned martial arts master and creator of the Chin Trick' - }]) + const events = await messageToEvent(data.message.simple_user_mention, data.guild.general) + t.deepEqual(events, [{ + $type: "m.room.message", + msgtype: "m.text", + body: "@crunch god: Tell me about Phil, renowned martial arts master and creator of the Chin Trick", + format: "org.matrix.custom.html", + formatted_body: '@crunch god Tell me about Phil, renowned martial arts master and creator of the Chin Trick' + }]) }) test("message2event: attachment with no content", async t => { - const events = await messageToEvent(data.message.attachment_no_content, data.guild.general) - t.deepEqual(events, [{ - $type: "m.room.message", - msgtype: "m.image", - url: "mxc://cadence.moe/qXoZktDqNtEGuOCZEADAMvhM", - body: "image.png", - external_url: "https://cdn.discordapp.com/attachments/497161332244742154/1124628646431297546/image.png", - info: { - mimetype: "image/png", - w: 466, - h: 85, - size: 12919, - }, - }]) + const events = await messageToEvent(data.message.attachment_no_content, data.guild.general) + t.deepEqual(events, [{ + $type: "m.room.message", + msgtype: "m.image", + url: "mxc://cadence.moe/qXoZktDqNtEGuOCZEADAMvhM", + body: "image.png", + external_url: "https://cdn.discordapp.com/attachments/497161332244742154/1124628646431297546/image.png", + info: { + mimetype: "image/png", + w: 466, + h: 85, + size: 12919, + }, + }]) }) test("message2event: stickers", async t => { - const events = await messageToEvent(data.message.sticker, data.guild.general) - t.deepEqual(events, [{ - $type: "m.room.message", - msgtype: "m.text", - body: "can have attachments too" - }, { - $type: "m.room.message", - msgtype: "m.image", - url: "mxc://cadence.moe/ZDCNYnkPszxGKgObUIFmvjus", - body: "image.png", - external_url: "https://cdn.discordapp.com/attachments/122155380120748034/1106366167486038016/image.png", - info: { - mimetype: "image/png", - w: 333, - h: 287, - size: 127373, - }, - }, { - $type: "m.sticker", - body: "pomu puff - damn that tiny lil bitch really chuffing. puffing that fat ass dart", - info: { - mimetype: "image/png" - // thumbnail_url - // thumbnail_info - }, - url: "mxc://cadence.moe/UuUaLwXhkxFRwwWCXipDlBHn" - }]) + const events = await messageToEvent(data.message.sticker, data.guild.general) + t.deepEqual(events, [{ + $type: "m.room.message", + msgtype: "m.text", + body: "can have attachments too" + }, { + $type: "m.room.message", + msgtype: "m.image", + url: "mxc://cadence.moe/ZDCNYnkPszxGKgObUIFmvjus", + body: "image.png", + external_url: "https://cdn.discordapp.com/attachments/122155380120748034/1106366167486038016/image.png", + info: { + mimetype: "image/png", + w: 333, + h: 287, + size: 127373, + }, + }, { + $type: "m.sticker", + body: "pomu puff - damn that tiny lil bitch really chuffing. puffing that fat ass dart", + info: { + mimetype: "image/png" + // thumbnail_url + // thumbnail_info + }, + url: "mxc://cadence.moe/UuUaLwXhkxFRwwWCXipDlBHn" + }]) }) diff --git a/package-lock.json b/package-lock.json index 4908aa6e..7dcde49e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "better-sqlite3": "^8.3.0", "cloudstorm": "^0.8.0", - "discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#24508e701e91d5a00fa5e773ced874d9ee8c889b", + "discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#df495b152fdc48fb22284ecda9a988e6df61bf99", "heatsync": "^2.4.1", "js-yaml": "^4.1.0", "matrix-appservice": "^2.0.0", @@ -685,11 +685,11 @@ } }, "node_modules/cloudstorm": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/cloudstorm/-/cloudstorm-0.8.2.tgz", - "integrity": "sha512-G/P6/+LwXjiS6AmheRG+07DmmsrpHpt21JFMhe+rW8VagFOOKemC2Bcru+Qncl/5jdjZC2gzjKpjfdTjfUm+iw==", + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/cloudstorm/-/cloudstorm-0.8.3.tgz", + "integrity": "sha512-4c2rqFFvzM4P3pcnjnGUlYuyBjx/xnMew6imB0sFwmNLITLCTLYa3qGkrnhI1g/tM0fqg+Gr+EmDHiDZfEr9LQ==", "dependencies": { - "snowtransfer": "^0.8.2" + "snowtransfer": "^0.8.3" }, "engines": { "node": ">=12.0.0" @@ -929,7 +929,7 @@ }, "node_modules/discord-markdown": { "version": "2.4.1", - "resolved": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#24508e701e91d5a00fa5e773ced874d9ee8c889b", + "resolved": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#df495b152fdc48fb22284ecda9a988e6df61bf99", "license": "MIT", "dependencies": { "simple-markdown": "^0.7.2" @@ -2464,9 +2464,9 @@ } }, "node_modules/snowtransfer": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snowtransfer/-/snowtransfer-0.8.2.tgz", - "integrity": "sha512-fAmaJSpFZqGwAvbrhT3XOWwhbiuHOgxN8pGeKnDDW0f8zdkPmSQT9aekXhFr1WukB94NIALYGcyIXe902p8S4A==", + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/snowtransfer/-/snowtransfer-0.8.3.tgz", + "integrity": "sha512-0X6NLFBUKppYT5VH/mVQNGX+ufv0AndunZC84MqGAR/3rfTIGQblgGJlHlDQbeCytlXdMpgRHIGQnBFlE094NQ==", "dependencies": { "discord-api-types": "^0.37.47", "form-data": "^4.0.0", diff --git a/package.json b/package.json index b3e19eb8..7fb8cc66 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "dependencies": { "better-sqlite3": "^8.3.0", "cloudstorm": "^0.8.0", - "discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#24508e701e91d5a00fa5e773ced874d9ee8c889b", + "discord-markdown": "git+https://git.sr.ht/~cadence/nodejs-discord-markdown#df495b152fdc48fb22284ecda9a988e6df61bf99", "heatsync": "^2.4.1", "js-yaml": "^4.1.0", "matrix-appservice": "^2.0.0",