diff --git a/src/7tv-emotes/manifest.json b/src/7tv-emotes/manifest.json index 52d98379..06c9768e 100644 --- a/src/7tv-emotes/manifest.json +++ b/src/7tv-emotes/manifest.json @@ -5,7 +5,7 @@ "main", "clips" ], - "version": "1.4.16", + "version": "1.4.17", "short_name": "7TV", "name": "7TV Emotes", "author": "Melonify", @@ -14,5 +14,5 @@ "website": "https://7tv.app", "settings": "add_ons.7tv_emotes", "created": "2021-07-12T23:18:04.000Z", - "updated": "2023-12-15T16:15:39.912Z" + "updated": "2023-12-22T00:31:14.154Z" } \ No newline at end of file diff --git a/src/7tv-emotes/modules/api.js b/src/7tv-emotes/modules/api.js index 1ab3b926..7bdf1990 100644 --- a/src/7tv-emotes/modules/api.js +++ b/src/7tv-emotes/modules/api.js @@ -14,13 +14,22 @@ export default class API extends FrankerFaceZ.utilities.module.Module { this.clientVersion = this.parent.manifest.version; } - makeRequest(route, options = {}) { + makeRequest(route, options = {}, skip_cache = false) { const headers = new Headers(options && options.headers || {}); headers.set('X-SevenTV-Platform', this.clientPlatform); headers.set('X-SevenTV-Version', this.clientVersion); - return fetch(`${this.apiBaseURI}/${route}`, {...options, headers}) + const request = fetch(`${this.apiBaseURI}/${route}`, { + cache: skip_cache ? 'reload' : 'default', + ...options, + headers + }); + + if ( ! skip_cache ) + return request.catch(() => this.makeRequest(route, options, true)); + + return request; } async requestJSON(route, options = {}) { diff --git a/src/7tv-emotes/modules/emotes.js b/src/7tv-emotes/modules/emotes.js index f93500fa..592362ad 100644 --- a/src/7tv-emotes/modules/emotes.js +++ b/src/7tv-emotes/modules/emotes.js @@ -41,6 +41,13 @@ export default class Emotes extends FrankerFaceZ.utilities.module.Module { }); this.setToChannelMap = new Map(); + + this.on('chat:reload-data', flags => { + if (!flags || flags.emotes) { + this.updateGlobalEmotes(); + this.updateChannelSets(); + } + }); } onEnable() {