mirror of
https://git.lucida.su/lucida/verdana.git
synced 2026-08-16 20:45:55 +00:00
fix modules option type definition
This commit is contained in:
parent
e7ffc2e7ba
commit
ad945277e8
1 changed files with 7 additions and 4 deletions
11
src/index.ts
11
src/index.ts
|
|
@ -1,7 +1,7 @@
|
|||
import { GetByUrlResponse, SearchResults, StreamerWithLogin } from './types.js'
|
||||
import { GetByUrlResponse, SearchResults, Streamer, StreamerWithLogin } from './types.js'
|
||||
|
||||
interface LucidaOptions {
|
||||
modules: { [key: string]: StreamerWithLogin }
|
||||
modules: { [key: string]: Streamer | StreamerWithLogin }
|
||||
logins?: {
|
||||
[key: string]: {
|
||||
username: string
|
||||
|
|
@ -11,7 +11,7 @@ interface LucidaOptions {
|
|||
}
|
||||
|
||||
class Lucida {
|
||||
modules: { [key: string]: StreamerWithLogin }
|
||||
modules: { [key: string]: Streamer | StreamerWithLogin }
|
||||
hostnames: string[]
|
||||
logins?: { [key: string]: { username: string; password: string } }
|
||||
constructor(options: LucidaOptions) {
|
||||
|
|
@ -25,7 +25,10 @@ class Lucida {
|
|||
if (!this.logins) throw new Error('No logins specified')
|
||||
for (const i in this.logins) {
|
||||
const credentials = this.logins[i]
|
||||
await this.modules[i]?.login?.(credentials.username, credentials.password)
|
||||
const module = this.modules[i]
|
||||
if ('login' in module) {
|
||||
await module.login?.(credentials.username, credentials.password)
|
||||
}
|
||||
}
|
||||
}
|
||||
async search(query: string, limit: number): Promise<{ [key: string]: SearchResults }> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue