Skip to content

Commit

Permalink
feat: fix for internal regression
Browse files Browse the repository at this point in the history
  • Loading branch information
KagChi committed Apr 4, 2022
1 parent 07d5cab commit d3a908f
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@sapphire/async-queue": "^1.3.0",
"@sapphire/utilities": "^3.5.0",
"discord-api-types": "^0.29.0",
"discord.js": "^13.6.0",
"lavalink-api-types": "^0.1.9",
"undici": "^4.16.0",
"ws": "^8.5.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GatewayVoiceServerUpdateDispatch, GatewayVoiceStateUpdateDispatch } from 'discord-api-types/gateway/v9';
import { WebsocketOpEnum } from 'lavalink-api-types';
import { KirishimaPlayerOptions, Kirishima, KirishimaNode, createVoiceChannelJoinPayload } from '..';
import { KirishimaPlayerOptions, KirishimaNode, createVoiceChannelJoinPayload, Kirishima } from '../..';

export class BasePlayer {
public voiceServer: GatewayVoiceServerUpdateDispatch['d'] | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/Structures/KirishimaNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { KirishimaNodeOptions } from '../typings';
import type { Kirishima } from './Kirishima';
import { GatewayVoiceServerUpdateDispatch, GatewayVoiceStateUpdateDispatch } from 'discord-api-types/gateway/v9';
import { LavalinkStatsPayload, WebsocketOpEnum } from 'lavalink-api-types';
import { BasePlayer } from './BasePlayer';
import { BasePlayer } from './Base/BasePlayer';

export class KirishimaNode {
public ws!: Gateway;
Expand Down
2 changes: 1 addition & 1 deletion src/Structures/KirishimaPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { KirishimaTrack } from './Track/KirishimaTrack';
import { KirishimaFilter, KirishimaFilterOptions } from './KirishimaFilter';
import { Structure } from './Structure';
import { BasePlayer } from './BasePlayer';
import { BasePlayer } from './Base/BasePlayer';

export class KirishimaPlayer extends BasePlayer {
public filters = new (Structure.get('KirishimaFilter'))();
Expand Down
4 changes: 1 addition & 3 deletions src/Structures/Structure.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/no-extraneous-class */
import type { Extendable } from '../typings';
import { BasePlayer } from './BasePlayer';
import { KirishimaFilter } from './KirishimaFilter';

import { KirishimaNode } from './KirishimaNode';
Expand All @@ -13,8 +12,7 @@ const structures = {
KirishimaPlayer,
KirishimaPartialTrack,
KirishimaTrack,
KirishimaFilter,
BasePlayer
KirishimaFilter
};

export abstract class Structure {
Expand Down
10 changes: 6 additions & 4 deletions src/Structures/Track/KirishimaPartialTrack.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Awaitable } from "@sapphire/utilities";

/**
* @description Represents a unplayable track by lavalink. This is a partial track. that must be resolved later
*/
export class KirishimaPartialTrack {
public track?: string;
public info: PartialLavalinkTrack['info'];
public constructor(raw: PartialLavalinkTrack) {
this.track = raw.track;
this.info = raw.info;
this.track = raw.track!;
this.info = raw.info!;
}

public toJSON() {
Expand All @@ -16,14 +18,14 @@ export class KirishimaPartialTrack {
};
}

public thumbnailURL(_size?: unknown) {
public thumbnailURL(_size?: unknown): Awaitable<string | null> {
return null;
}
}

export interface PartialLavalinkTrack {
track?: string;
info: {
info?: {
identifier?: string;
isSeekable?: boolean;
author?: string;
Expand Down
3 changes: 2 additions & 1 deletion src/Structures/Track/KirishimaTrack.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Awaitable } from '@sapphire/utilities';
import { LavalinkTrack } from 'lavalink-api-types';

/**
Expand All @@ -18,7 +19,7 @@ export class KirishimaTrack {
};
}

public thumbnailURL(size?: unknown) {
public thumbnailURL(size?: unknown): Awaitable<string | null> {
return this.info.uri.includes('youtube') ? `https://img.youtube.com/vi/${this.info.identifier}/${size ?? 'default'}.jpg` : null;
}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export * from './Structures/Track/KirishimaPartialTrack';
export * from './Structures/Track/KirishimaTrack';
export * from './Structures/KirishimaFilter';
export * from './Structures/KirishimaPlugin';
export * from './Structures/BasePlayer';
export * from './Structures/Base/BasePlayer';
export * from './typings/index';
export * from './Util';
5 changes: 2 additions & 3 deletions src/typings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { KirishimaTrack } from '../Structures/Track/KirishimaTrack';
import type { KirishimaPartialTrack } from '../Structures/Track/KirishimaPartialTrack';
import { KirishimaFilter } from '../Structures/KirishimaFilter';
import { KirishimaPlugin } from '../Structures/KirishimaPlugin';
import { BasePlayer } from '../Structures/BasePlayer';
import { LoadTrackResponse as OLoadTrackResponse } from 'lavalink-api-types';
import { BasePlayer } from '../Structures/Base/BasePlayer';

export interface KirishimaOptions {
clientId?: string;
Expand Down Expand Up @@ -68,9 +68,8 @@ export interface Extendable {
KirishimaTrack: typeof KirishimaTrack;
KirishimaPartialTrack: typeof KirishimaPartialTrack;
KirishimaFilter: typeof KirishimaFilter;
BasePlayer: typeof BasePlayer;
}

export interface LoadTrackResponse extends OLoadTrackResponse {
tracks: KirishimaTrack[];
tracks: Array<KirishimaTrack>;
}

0 comments on commit d3a908f

Please sign in to comment.