forked from fnbrjs/fnbr.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
158 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import Base from '../../Base'; | ||
import STWNewsMessageVideo from './STWNewsMessageVideo'; | ||
import type Client from '../../Client'; | ||
|
||
/** | ||
* Represents a STW news message button | ||
*/ | ||
class STWNewsMessageButton extends Base { | ||
/** | ||
* The button's action | ||
*/ | ||
public action?: { | ||
type: string; | ||
video?: STWNewsMessageVideo; | ||
}; | ||
|
||
/** | ||
* The button's style | ||
*/ | ||
public style: string; | ||
|
||
/** | ||
* The button's style | ||
*/ | ||
public text: string; | ||
/** | ||
* @param client The main client | ||
* @param data The buttons's data | ||
*/ | ||
constructor(client: Client, data: any) { | ||
super(client); | ||
|
||
const action = data.Action; | ||
this.action = { | ||
// eslint-disable-next-line no-underscore-dangle | ||
type: action._type, | ||
video: action.video ? new STWNewsMessageVideo(client, action.video) : undefined, | ||
}; | ||
this.style = data.Style; | ||
this.text = data.Text; | ||
} | ||
} | ||
|
||
export default STWNewsMessageButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import Base from '../../Base'; | ||
import type Client from '../../Client'; | ||
|
||
/** | ||
* Represents a fortnite STW news message video | ||
*/ | ||
class STWNewsMessageVideo extends Base { | ||
/** | ||
* The video's id | ||
*/ | ||
public id: string; | ||
|
||
/** | ||
* Whether the video should autoplay | ||
*/ | ||
public autoplay: boolean; | ||
|
||
/** | ||
* The video's string | ||
*/ | ||
public videoString: string; | ||
|
||
/** | ||
* Whether the video has streaming enabled | ||
*/ | ||
public streamingEnabled: boolean; | ||
|
||
/** | ||
* @param client The main client | ||
* @param data The STW news message video data | ||
*/ | ||
constructor(client: Client, data: any) { | ||
super(client); | ||
|
||
this.id = data.UID; | ||
this.autoplay = data.Autoplay; | ||
this.videoString = data.VideoString; | ||
this.streamingEnabled = data.StreamingEnabled; | ||
} | ||
|
||
/** | ||
* Downloads the video | ||
* @throws {AxiosError} | ||
*/ | ||
public async download() { | ||
return this.client.downloadBlurlStream(this.id); | ||
} | ||
} | ||
|
||
export default STWNewsMessageVideo; |