From e2bc480cc39cfd8436aa1bc08cd510eef96956df Mon Sep 17 00:00:00 2001
From: Christian Paul <christianp@matrix.org>
Date: Thu, 11 Aug 2022 22:56:16 +0200
Subject: [PATCH] Remove variables which are never read (#657)

* Remove variables which are never read
---
 changelog.d/657.misc                 | 1 +
 package.json                         | 1 -
 src/bot.ts                           | 1 -
 src/db/roomstore.ts                  | 4 +---
 src/db/schema/v8.ts                  | 1 -
 src/matrixcommandhandler.ts          | 1 -
 src/matrixeventprocessor.ts          | 1 -
 src/matrixmessageprocessor.ts        | 2 --
 src/matrixroomhandler.ts             | 5 -----
 test/db/test_roomstore.ts            | 2 +-
 test/mocks/channel.ts                | 2 +-
 test/mocks/discordclient.ts          | 3 ---
 test/test_discordmessageprocessor.ts | 1 -
 test/test_presencehandler.ts         | 1 -
 yarn.lock                            | 2 +-
 15 files changed, 5 insertions(+), 23 deletions(-)
 create mode 100644 changelog.d/657.misc

diff --git a/changelog.d/657.misc b/changelog.d/657.misc
new file mode 100644
index 0000000..76dac59
--- /dev/null
+++ b/changelog.d/657.misc
@@ -0,0 +1 @@
+Remove unused variables.
\ No newline at end of file
diff --git a/package.json b/package.json
index d285b0a..9dc8783 100644
--- a/package.json
+++ b/package.json
@@ -51,7 +51,6 @@
     "marked": "^1.2.2",
     "matrix-appservice-bridge": "^5.0.0",
     "mime": "^2.4.6",
-    "node-html-parser": "^1.2.19",
     "p-queue": "^6.4.0",
     "pg-promise": "^10.5.6",
     "prom-client": "^12.0.0",
diff --git a/src/bot.ts b/src/bot.ts
index 64ed030..8bc73d4 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -94,7 +94,6 @@ class DiscordBridgeBlocker extends BridgeBlocker {
 export class DiscordBot {
     private clientFactory: DiscordClientFactory;
     private _bot: Discord.Client|undefined;
-    private presenceInterval: number;
     private sentMessages: string[];
     private lastEventIds: { [channelId: string]: string };
     private discordMsgProcessor: DiscordMessageProcessor;
diff --git a/src/db/roomstore.ts b/src/db/roomstore.ts
index a92e039..144ecab 100644
--- a/src/db/roomstore.ts
+++ b/src/db/roomstore.ts
@@ -25,7 +25,7 @@ const log = new Log("DbRoomStore");
 
 /**
  * A RoomStore compatible with
- * https://github.com/matrix-org/matrix-appservice-bridge/blob/master/lib/components/room-bridge-store.js
+ * https://github.com/matrix-org/matrix-appservice-bridge/blob/master/src/components/room-bridge-store.ts
  * that accesses the database instead.
  */
 
@@ -122,8 +122,6 @@ export class DbRoomStore {
     }
 
     public async upsertEntry(entry: IRoomStoreEntry) {
-        const promises: Promise<void>[] = [];
-
         const row = (await this.db.Get("SELECT * FROM room_entries WHERE id = $id", {id: entry.id})) || {};
 
         if (!row.id) {
diff --git a/src/db/schema/v8.ts b/src/db/schema/v8.ts
index 575869a..941c346 100644
--- a/src/db/schema/v8.ts
+++ b/src/db/schema/v8.ts
@@ -16,7 +16,6 @@ limitations under the License.
 
 import {IDbSchema} from "./dbschema";
 import {DiscordStore} from "../../store";
-import { Log } from "../../log";
 
 export class Schema implements IDbSchema {
     public description = "create room store tables";
diff --git a/src/matrixcommandhandler.ts b/src/matrixcommandhandler.ts
index baf8cda..29abf4d 100644
--- a/src/matrixcommandhandler.ts
+++ b/src/matrixcommandhandler.ts
@@ -27,7 +27,6 @@ import * as markdown from "marked";
 const log = new Log("MatrixCommandHandler");
 
 const PROVISIONING_DEFAULT_POWER_LEVEL = 50;
-const PROVISIONING_DEFAULT_USER_POWER_LEVEL = 0;
 const ROOM_CACHE_MAXAGE_MS = 15 * 60 * 1000;
 
 export class MatrixCommandHandler {
diff --git a/src/matrixeventprocessor.ts b/src/matrixeventprocessor.ts
index af4eb56..5ef631c 100644
--- a/src/matrixeventprocessor.ts
+++ b/src/matrixeventprocessor.ts
@@ -38,7 +38,6 @@ const MIN_NAME_LENGTH = 2;
 const MAX_NAME_LENGTH = 32;
 const DISCORD_AVATAR_WIDTH = 128;
 const DISCORD_AVATAR_HEIGHT = 128;
-const ROOM_NAME_PARTS = 2;
 const AGE_LIMIT = 900000; // 15 * 60 * 1000
 const PROFILE_CACHE_LIFETIME = 900000;
 
diff --git a/src/matrixmessageprocessor.ts b/src/matrixmessageprocessor.ts
index a257e3e..e8fc737 100644
--- a/src/matrixmessageprocessor.ts
+++ b/src/matrixmessageprocessor.ts
@@ -16,7 +16,6 @@ limitations under the License.
 
 import * as Discord from "better-discord.js";
 import { IMatrixMessage } from "./matrixtypes";
-import * as Parser from "node-html-parser";
 import { Util } from "./util";
 import { DiscordBot } from "./bot";
 import { MatrixClient } from "matrix-bot-sdk";
@@ -37,7 +36,6 @@ export interface IMatrixMessageProcessorParams {
 }
 
 export class MatrixMessageProcessor {
-    private listBulletPoints: string[] = ["●", "○", "■", "‣"];
     private parser: MatrixMessageParser;
     constructor(public bot: DiscordBot, private config: DiscordBridgeConfig) {
         this.parser = new MatrixMessageParser();
diff --git a/src/matrixroomhandler.ts b/src/matrixroomhandler.ts
index 812066e..75ad0d0 100644
--- a/src/matrixroomhandler.ts
+++ b/src/matrixroomhandler.ts
@@ -25,12 +25,7 @@ import { DbRoomStore, MatrixStoreRoom, RemoteStoreRoom } from "./db/roomstore";
 import { Appservice, Intent, IApplicationServiceProtocol } from "matrix-bot-sdk";
 
 const ICON_URL = "https://matrix.org/_matrix/media/r0/download/matrix.org/mlxoESwIsTbJrfXyAAogrNxA";
-const HTTP_UNSUPPORTED = 501;
 const ROOM_NAME_PARTS = 2;
-const PROVISIONING_DEFAULT_POWER_LEVEL = 50;
-const PROVISIONING_DEFAULT_USER_POWER_LEVEL = 0;
-const USERSYNC_STATE_DELAY_MS = 5000;
-const ROOM_CACHE_MAXAGE_MS = 15 * 60 * 1000;
 
 // Note: The schedule must not have duplicate values to avoid problems in positioning.
 // Disabled because it complains about the values in the array
diff --git a/test/db/test_roomstore.ts b/test/db/test_roomstore.ts
index 63f8042..015f699 100644
--- a/test/db/test_roomstore.ts
+++ b/test/db/test_roomstore.ts
@@ -15,7 +15,7 @@ limitations under the License.
 */
 
 import { expect } from "chai";
-import { DiscordStore, CURRENT_SCHEMA } from "../../src/store";
+import { DiscordStore } from "../../src/store";
 import { RemoteStoreRoom, MatrixStoreRoom } from "../../src/db/roomstore";
 
 // we are a test file and thus need those
diff --git a/test/mocks/channel.ts b/test/mocks/channel.ts
index 2c749b2..20ec2d7 100644
--- a/test/mocks/channel.ts
+++ b/test/mocks/channel.ts
@@ -15,7 +15,7 @@ limitations under the License.
 */
 
 import {MockMember} from "./member";
-import {MockCollection, MockCollectionManager} from "./collection";
+import {MockCollection} from "./collection";
 import {Permissions, PermissionResolvable, TextChannel} from "better-discord.js";
 import { MockGuild } from "./guild";
 
diff --git a/test/mocks/discordclient.ts b/test/mocks/discordclient.ts
index da7290d..1f0ab4a 100644
--- a/test/mocks/discordclient.ts
+++ b/test/mocks/discordclient.ts
@@ -24,7 +24,6 @@ import {MockUser} from "./user";
 export class MockDiscordClient {
     public guilds = new MockCollectionManager<string, MockGuild>();
     public user: MockUser;
-    private testLoggedIn: boolean = false;
     private testCallbacks: Map<string, (...data: any[]) => void> = new Map();
 
     constructor() {
@@ -62,7 +61,6 @@ export class MockDiscordClient {
         });
     }
 
-
     public async emit(event: string, ...data: any[]) {
         return await this.testCallbacks.get(event)!.apply(this, data);
     }
@@ -71,7 +69,6 @@ export class MockDiscordClient {
         if (token !== "passme") {
             throw new Error("Mock Discord Client only logins with the token 'passme'");
         }
-        this.testLoggedIn = true;
         if (this.testCallbacks.has("ready")) {
             this.testCallbacks.get("ready")!();
         }
diff --git a/test/test_discordmessageprocessor.ts b/test/test_discordmessageprocessor.ts
index 283f351..3d037ce 100644
--- a/test/test_discordmessageprocessor.ts
+++ b/test/test_discordmessageprocessor.ts
@@ -15,7 +15,6 @@ limitations under the License.
 */
 
 import { expect } from "chai";
-import * as Discord from "better-discord.js";
 import { DiscordMessageProcessor } from "../src/discordmessageprocessor";
 import { DiscordBot } from "../src/bot";
 import { MockGuild } from "./mocks/guild";
diff --git a/test/test_presencehandler.ts b/test/test_presencehandler.ts
index cbf4d05..4f7d43f 100644
--- a/test/test_presencehandler.ts
+++ b/test/test_presencehandler.ts
@@ -15,7 +15,6 @@ limitations under the License.
 */
 
 import { expect } from "chai";
-import * as Discord from "better-discord.js";
 
 import { PresenceHandler } from "../src/presencehandler";
 import { DiscordBot } from "../src/bot";
diff --git a/yarn.lock b/yarn.lock
index c5df317..2737abe 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3025,7 +3025,7 @@ node-fetch@^2.6.0:
   dependencies:
     whatwg-url "^5.0.0"
 
-node-html-parser@^1.2.19, node-html-parser@^1.4.5:
+node-html-parser@^1.4.5:
   version "1.4.9"
   resolved "https://registry.yarnpkg.com/node-html-parser/-/node-html-parser-1.4.9.tgz#3c8f6cac46479fae5800725edb532e9ae8fd816c"
   integrity sha512-UVcirFD1Bn0O+TSmloHeHqZZCxHjvtIeGdVdGMhyZ8/PWlEiZaZ5iJzR189yKZr8p0FXN58BUeC7RHRkf/KYGw==
-- 
GitLab