diff --git a/src/messageprocessor.ts b/src/messageprocessor.ts index f276324c309e52874b2f16e03eb152e9d0d3841b..8142611f14b457a8946706bd6128c8736ee51d94 100644 --- a/src/messageprocessor.ts +++ b/src/messageprocessor.ts @@ -47,7 +47,7 @@ export class MessageProcessor { } public InsertEmbeds(content: string, msg: Discord.Message): string { - for (let embed of msg.embeds) { + for (const embed of msg.embeds) { let embedContent = "\n----\n"; // Horizontal rule. const embedTitle = embed.url ? `[${embed.title}](${embed.url})` : embed.title; embedContent += embedTitle != null ? `#### ${embedTitle}\n\n${embed.description}` : embed.description; diff --git a/test/test_messageprocessor.ts b/test/test_messageprocessor.ts index b8b39eed9377b53523307fb8a8d0f6ae29bdaf8f..71b527e44d2a2431fa7fcb3a4e2b7305cbfe6945 100644 --- a/test/test_messageprocessor.ts +++ b/test/test_messageprocessor.ts @@ -170,9 +170,9 @@ describe("MessageProcessor", () => { const msg = new Discord.Message(null, null, null); msg.embeds = [ new Discord.MessageEmbed(msg, { - description: "TestDescription" - }) - ] + description: "TestDescription", + }), + ]; const inContent = ""; const content = processor.InsertEmbeds(inContent, msg); Chai.assert.equal(content, "\n----\nTestDescription"); @@ -184,8 +184,8 @@ describe("MessageProcessor", () => { new Discord.MessageEmbed(msg, { title: "TestTitle", description: "TestDescription", - }) - ] + }), + ]; const inContent = ""; const content = processor.InsertEmbeds(inContent, msg); Chai.assert.equal(content, "\n----\n#### TestTitle\n\nTestDescription"); @@ -198,8 +198,8 @@ describe("MessageProcessor", () => { title: "TestTitle", url: "testurl", description: "TestDescription", - }) - ] + }), + ]; const inContent = ""; const content = processor.InsertEmbeds(inContent, msg); Chai.assert.equal(content, "\n----\n#### [TestTitle](testurl)\n\nTestDescription"); @@ -217,11 +217,14 @@ describe("MessageProcessor", () => { title: "TestTitle2", url: "testurl2", description: "TestDescription2", - }) - ] + }), + ]; const inContent = ""; const content = processor.InsertEmbeds(inContent, msg); - Chai.assert.equal(content, "\n----\n#### [TestTitle](testurl)\n\nTestDescription\n----\n#### [TestTitle2](testurl2)\n\nTestDescription2"); + Chai.assert.equal( + content, +"\n----\n#### [TestTitle](testurl)\n\nTestDescription\n----\n#### [TestTitle2](testurl2)\n\nTestDescription2", + ); }); it("inserts embeds properly", () => { const processor = new MessageProcessor(new MessageProcessorOpts("localhost"), <DiscordBot> bot); @@ -231,11 +234,14 @@ describe("MessageProcessor", () => { title: "TestTitle", url: "testurl", description: "TestDescription", - }) - ] + }), + ]; const inContent = "Content that goes in the message"; const content = processor.InsertEmbeds(inContent, msg); - Chai.assert.equal(content, "Content that goes in the message\n----\n#### [TestTitle](testurl)\n\nTestDescription"); + Chai.assert.equal( + content, + "Content that goes in the message\n----\n#### [TestTitle](testurl)\n\nTestDescription", + ); }); }); });