fix: correct irc-framework import to use named Client export
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import IrcFramework from 'irc-framework';
|
import { Client as IrcClient } from 'irc-framework';
|
||||||
import { db } from '../db/index.js';
|
import { db } from '../db/index.js';
|
||||||
import { connections, channels } from '../db/schema.js';
|
import { connections, channels } from '../db/schema.js';
|
||||||
import { eq, and } from 'drizzle-orm';
|
import { eq, and } from 'drizzle-orm';
|
||||||
@@ -41,7 +41,7 @@ const BASE_RECONNECT_DELAY = 1000;
|
|||||||
|
|
||||||
class ConnectionManager {
|
class ConnectionManager {
|
||||||
private static instance: ConnectionManager;
|
private static instance: ConnectionManager;
|
||||||
private userConnections: Map<number, Map<number, IrcFramework.Client>> = new Map();
|
private userConnections: Map<number, Map<number, IrcClient>> = new Map();
|
||||||
private reconnectState: Map<string, ReconnectState> = new Map();
|
private reconnectState: Map<string, ReconnectState> = new Map();
|
||||||
private shutdownRequested = false;
|
private shutdownRequested = false;
|
||||||
|
|
||||||
@@ -75,13 +75,13 @@ class ConnectionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect(userId: number, connConfig: ConnectionConfig): Promise<IrcFramework.Client> {
|
async connect(userId: number, connConfig: ConnectionConfig): Promise<IrcClient> {
|
||||||
const existing = this.getConnection(userId, connConfig.id);
|
const existing = this.getConnection(userId, connConfig.id);
|
||||||
if (existing) {
|
if (existing) {
|
||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
|
|
||||||
const client = new IrcFramework.Client();
|
const client = new IrcClient();
|
||||||
|
|
||||||
const connectOptions: Record<string, unknown> = {
|
const connectOptions: Record<string, unknown> = {
|
||||||
host: connConfig.hostname,
|
host: connConfig.hostname,
|
||||||
@@ -227,13 +227,13 @@ class ConnectionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnection(userId: number, connectionId: number): IrcFramework.Client | undefined {
|
getConnection(userId: number, connectionId: number): IrcClient | undefined {
|
||||||
const userMap = this.userConnections.get(userId);
|
const userMap = this.userConnections.get(userId);
|
||||||
if (!userMap) return undefined;
|
if (!userMap) return undefined;
|
||||||
return userMap.get(connectionId);
|
return userMap.get(connectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserConnections(userId: number): Map<number, IrcFramework.Client> {
|
getUserConnections(userId: number): Map<number, IrcClient> {
|
||||||
return this.userConnections.get(userId) || new Map();
|
return this.userConnections.get(userId) || new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user