diff --git a/src/store.ts b/src/store.ts index 6bb4ec47129243d6775658c5c837b9482bf3f5dd..58c0606ef99252065870046c95c0a77bdaff1030 100644 --- a/src/store.ts +++ b/src/store.ts @@ -99,7 +99,7 @@ export class DiscordStore { return Promise.all([ this.db.runAsync( ` - INSERT INTO user_id_discord_id (discord_id,user_id) VALUES ($userId,$discordId); + INSERT INTO user_id_discord_id (discord_id,user_id) VALUES ($discordId,$userId); ` , { $userId: userId, @@ -121,7 +121,7 @@ export class DiscordStore { public delete_user_token(discordId: string): Promise<null> { log.silly("SQL", "delete_user_token => %s", discordId); - return this.db.execAsync( + return this.db.runAsync( ` DELETE FROM user_id_discord_id WHERE discord_id = $id; DELETE FROM discord_id_token WHERE discord_id = $id; diff --git a/test/test_matrixeventprocessor.ts b/test/test_matrixeventprocessor.ts index 56adf8910ba316399804687bf218bdc34145700b..01572ecc1c22b1bd15418551dd3b51f52c8dac04 100644 --- a/test/test_matrixeventprocessor.ts +++ b/test/test_matrixeventprocessor.ts @@ -262,6 +262,14 @@ describe("MatrixEventProcessor", () => { processor.FindMentionsInPlainBody("Hello TestUsername#54321", members), "Hello <@!12345>", ); + Chai.assert.equal( + processor.FindMentionsInPlainBody("I really love going to https://TestUsername.com", members), + "I really love going to https://TestUsername.com", + ); + Chai.assert.equal( + processor.FindMentionsInPlainBody("I really love going to www.TestUsername.com", members), + "I really love going to www.TestUsername.com", + ); }); it("processes mentioned nickname correctly", async () => { const processor = createMatrixEventProcessor(); @@ -310,6 +318,14 @@ describe("MatrixEventProcessor", () => { processor.FindMentionsInPlainBody("Fixing this issue provided by @Test", members), "Fixing this issue provided by <@!54321>", ); + Chai.assert.equal( + processor.FindMentionsInPlainBody("I really love going to https://Test.com", members), + "I really love going to https://Test.com", + ); + Chai.assert.equal( + processor.FindMentionsInPlainBody("I really love going to www.Test.com", members), + "I really love going to www.Test.com", + ); }); it("processes non-mentions correctly", async () => { const processor = createMatrixEventProcessor(); diff --git a/tools/userClientTools.ts b/tools/userClientTools.ts index 0e26b49b19e782b84235a6b8a322ec7cb6d3bf8c..0db1f3198fcf3c8095795d7b4b6cc9c566f5c809 100644 --- a/tools/userClientTools.ts +++ b/tools/userClientTools.ts @@ -5,6 +5,7 @@ import * as args from "command-line-args"; import * as usage from "command-line-usage"; import * as readline from "readline"; import * as Bluebird from "bluebird"; +import * as process from "process"; import {DiscordClientFactory} from "../src/clientfactory"; import { DiscordBridgeConfig } from "../src/config"; @@ -79,16 +80,20 @@ Please enter your Discord Token rl.close(); addUserToken(userid, token).then(() => { log.info("tool", "Completed successfully"); + process.exit(0); }).catch((err) => { log.info("tool", "Failed to add, $s", err); + process.exit(1); }); }); } else if (options.remove) { rl.close(); discordstore.delete_user_token(userid).then(() => { log.info("tool", "Completed successfully"); + process.exit(0); }).catch((err) => { log.info("tool", "Failed to delete, $s", err); + process.exit(1); }); } });