Minor update

- feat(Client): redeemNitro & autoRedeemNitro
- fix(Modal): Reply modal bug
- fix(RichPresence): setAssetsImage bug
- refactor(RichPresence): Clean code
This commit is contained in:
March 7th
2022-07-09 19:47:00 +07:00
parent 0df013b2dc
commit 536a86a5f3
14 changed files with 88 additions and 7030 deletions

View File

@@ -163,15 +163,6 @@ class RichPresence {
* @returns {RichPresence}
*/
setAssetsLargeImage(image) {
// Gif support
if (
typeof image == 'string' &&
(image.startsWith('https://') || image.startsWith('http://')) &&
image.includes('external') &&
image.includes('discord')
) {
image = `mp:external${image.split('external')[1]}`;
}
if (!(this.assets instanceof Object)) this.assets = {};
this.assets.large_image = image;
return this;
@@ -182,15 +173,6 @@ class RichPresence {
* @returns {RichPresence}
*/
setAssetsSmallImage(image) {
// Gif support
if (
typeof image == 'string' &&
(image.startsWith('https://') || image.startsWith('http://')) &&
image.includes('external') &&
image.includes('discord')
) {
image = `mp:external${image.split('external')[1]}`;
}
if (!(this.assets instanceof Object)) this.assets = {};
this.assets.small_image = image;
return this;
@@ -458,13 +440,7 @@ class SpotifyRPC extends RichPresence {
*/
setAssetsLargeImage(image) {
if (image.startsWith('spotify:')) image = image.replace('spotify:', '');
if (!(this.assets instanceof Object)) {
this.assets = {
large_image: `spotify:${image}`,
};
} else {
this.assets.large_image = `spotify:${image}`;
}
super.setAssetsLargeImage(`spotify:${image}`);
return this;
}
/**
@@ -474,13 +450,7 @@ class SpotifyRPC extends RichPresence {
*/
setAssetsSmallImage(image) {
if (image.startsWith('spotify:')) image = image.replace('spotify:', '');
if (!(this.assets instanceof Object)) {
this.assets = {
small_image: `spotify:${image}`,
};
} else {
this.assets.small_image = `spotify:${image}`;
}
super.setAssetsSmallImage(`spotify:${image}`);
return this;
}
/**

View File

@@ -472,8 +472,8 @@ class User extends Base {
/**
* Set note to user
* @param {string<User.note>} note Note to set
* @returns {Promise<User.note>}
* @param {string} note Note to set
* @returns {Promise<User>}
*/
async setNote(note = null) {
await this.client.api.users['@me'].notes(this.id).put({ data: { note } });