Skip to content

Commit

Permalink
7TV Emotes 1.4.18
Browse files Browse the repository at this point in the history
* Changed: Attempt to fix vanishing of badges / name paints by only sending a presence update at most once every 10 seconds (instead of on every message)
  • Loading branch information
Lordmau5 committed Jan 16, 2024
1 parent 371c3a2 commit 0b66a86
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/7tv-emotes/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main",
"clips"
],
"version": "1.4.17",
"version": "1.4.18",
"short_name": "7TV",
"name": "7TV Emotes",
"author": "Melonify",
Expand Down
9 changes: 9 additions & 0 deletions src/7tv-emotes/modules/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default class Socket extends FrankerFaceZ.utilities.module.Module {
this._connect_attempts = 0;

this._session_id = '';
this._last_presence_at = 0;

this._user_id = false;
this._active_channel_set = false;
Expand Down Expand Up @@ -98,6 +99,12 @@ export default class Socket extends FrankerFaceZ.utilities.module.Module {
sendPresences(self = false, room_id = undefined) {
if (!this._user_id) return;

// Only send a presence at most every 10 seconds
if (this._last_presence_at && this._last_presence_at > Date.now() - 1000 * 10)
return;

this._last_presence_at = Date.now();

if (room_id) {
this.stv_api.user.updateUserPresences(this._user_id, room_id, self, this._session_id);
return;
Expand All @@ -108,6 +115,8 @@ export default class Socket extends FrankerFaceZ.utilities.module.Module {
this.stv_api.user.updateUserPresences(this._user_id, room.id, self, this._session_id);
}
}

this._last_presence_at = Date.now();
}

async roomAdd(room) {
Expand Down

0 comments on commit 0b66a86

Please sign in to comment.