mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
fix: types
This commit is contained in:
parent
33ac5a8246
commit
7e55ba9e3c
@ -3,6 +3,7 @@ import {
|
|||||||
type Awaitable,
|
type Awaitable,
|
||||||
type DeepPartial,
|
type DeepPartial,
|
||||||
type If,
|
type If,
|
||||||
|
type MakePartial,
|
||||||
type WatcherPayload,
|
type WatcherPayload,
|
||||||
type WatcherSendToShard,
|
type WatcherSendToShard,
|
||||||
hasIntent,
|
hasIntent,
|
||||||
@ -228,7 +229,5 @@ export interface ClientOptions extends BaseClientOptions {
|
|||||||
reply?: (ctx: CommandContext) => boolean;
|
reply?: (ctx: CommandContext) => boolean;
|
||||||
};
|
};
|
||||||
handlePayload?: ShardManagerOptions['handlePayload'];
|
handlePayload?: ShardManagerOptions['handlePayload'];
|
||||||
resharding?: Omit<NonNullable<ShardManagerOptions['resharding']>, 'getInfo'> & {
|
resharding?: MakePartial<NonNullable<ShardManagerOptions['resharding']>, 'getInfo'>;
|
||||||
getInfo?: NonNullable<ShardManagerOptions['resharding']>['getInfo'];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,6 @@ export class HttpClient extends BaseClient {
|
|||||||
|
|
||||||
async start(options: DeepPartial<Omit<StartOptions, 'connection' | 'eventsDir'>> = {}) {
|
async start(options: DeepPartial<Omit<StartOptions, 'connection' | 'eventsDir'>> = {}) {
|
||||||
await super.start(options);
|
await super.start(options);
|
||||||
return this.execute(options.httpConnection ?? {});
|
return this.execute(options.httpConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import type { UsingClient } from '../commands';
|
import type { UsingClient } from '../commands';
|
||||||
|
import type { Awaitable } from '../common';
|
||||||
|
|
||||||
export interface HttpServerAdapter {
|
export interface HttpServerAdapter {
|
||||||
client: UsingClient;
|
client: UsingClient;
|
||||||
start?(path: `/${string}`): any;
|
start?(path: `/${string}`): Awaitable<unknown>;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ export class OptionResolver {
|
|||||||
|
|
||||||
const channel = resolved.channels?.[value];
|
const channel = resolved.channels?.[value];
|
||||||
if (channel) {
|
if (channel) {
|
||||||
resolve.channel = 'fetch' in channel ? (channel as unknown as AllChannels) : channelFrom(channel, this.client);
|
resolve.channel = channelFrom(channel, this.client);
|
||||||
}
|
}
|
||||||
|
|
||||||
const role = resolved.roles?.[value];
|
const role = resolved.roles?.[value];
|
||||||
|
@ -89,12 +89,6 @@ export type NulleableCoalising<A, B> = NonFalsy<A> extends never ? B : A;
|
|||||||
|
|
||||||
export type TupleOr<A, T> = ValueOf<A> extends never ? A : TupleOr<ArrayFirsElement<T>, Tail<T>>;
|
export type TupleOr<A, T> = ValueOf<A> extends never ? A : TupleOr<ArrayFirsElement<T>, Tail<T>>;
|
||||||
|
|
||||||
export type PickPartial<T, K extends keyof T> = {
|
|
||||||
[P in keyof T]?: T[P] | undefined;
|
|
||||||
} & {
|
|
||||||
[P in K]: T[P];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type MakeRequired<T, K extends keyof T = keyof T> = T & { [P in K]-?: NonFalsy<T[P]> };
|
export type MakeRequired<T, K extends keyof T = keyof T> = T & { [P in K]-?: NonFalsy<T[P]> };
|
||||||
|
|
||||||
export type NonFalsy<T> = T extends false | 0 | '' | null | undefined | 0n ? never : T;
|
export type NonFalsy<T> = T extends false | 0 | '' | null | undefined | 0n ? never : T;
|
||||||
|
@ -215,7 +215,7 @@ export class EventHandler extends BaseHandler {
|
|||||||
t: name,
|
t: name,
|
||||||
d: packet,
|
d: packet,
|
||||||
} as GatewayDispatchPayload);
|
} as GatewayDispatchPayload);
|
||||||
await (Event.run as any)(hook, client, shardId);
|
await Event.run(hook, client, shardId);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await this.onFail(name, e);
|
await this.onFail(name, e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user