diff --git a/changelog.d/657.misc b/changelog.d/657.misc new file mode 100644 index 0000000000000000000000000000000000000000..76dac591edab71a4ea039104a05f643f07f6c791 --- /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 d285b0a74de9c21fe165fd67f438a3ace10918d8..9dc8783d620d29b8380dc5cab7a4b390aa6c2bd8 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 64ed030101e1521264c33d36feab9dfdb4d60df1..8bc73d410365309800ecdb2a36f3866162871906 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 a92e03938a89b334953345c6068ef35534dc13cf..144ecab2f85a90652a036e32644f85380dfffe83 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 575869ab6b3ee1b588e358ac747c5604163e7f5d..941c346956c1b396f1f3e38f2e402964c3094608 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 baf8cda22bbebe2db4ed54a98a049e65ebbdc5a5..29abf4dd611050d927a92e5372c1877d0a86d4c5 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 af4eb566a912cc27dae56b4a9c8534264fea7830..5ef631c6a909bd2da6129c277dbf0d971c462dc5 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 a257e3e54bffa8be9a3d9fc6bda0a37c24efd715..e8fc7370886f26a96993bfdc9dc03c0a84275977 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 812066ebb0616ee2e0a86fe7ff659859bf1ad67d..75ad0d0136b937cf6419215232715a5dced0c788 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 63f8042e3307d3c602daf68f5856bfc40c944548..015f699b0479b853440a7bc8172ff1bc93e4084b 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 2c749b2c4fb658b42cc76d31b5a0be7d45c9a1dc..20ec2d7d01dcbf75fff799d8607fd0468eeac2f5 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 da7290d576f91f000ce0f5a29469d18a16bd89d2..1f0ab4a56e212f0617a0883fee47d7e843f91551 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 283f35123d34d2e640193ece0c051ee2d0874000..3d037ce455ba2e6f0275ea5b33baadf55a6d87af 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 cbf4d057d4395e9474cedd25fe4e775274c40514..4f7d43f4c9db03d6a253733d1bcdf08481622a33 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 c5df317fa905c19f997ce4988e3ef019b822cd7c..2737abeb006b4c18551934e0a88f7bfc0731527e 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==