Skip to content

Commit

Permalink
7TV Emotes 1.4.29
Browse files Browse the repository at this point in the history
* Fixed: Animated avatars not working anymore due to a change on 7TV's side
  • Loading branch information
Lordmau5 committed Oct 31, 2024
1 parent 982bb3f commit edcf221
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions 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.28",
"version": "1.4.29",
"short_name": "7TV",
"name": "7TV Emotes",
"author": "Melonify",
Expand All @@ -14,5 +14,5 @@
"website": "https://7tv.app",
"settings": "add_ons.7tv_emotes",
"created": "2021-07-12T23:18:04.000Z",
"updated": "2024-10-27T20:48:45.095Z"
"updated": "2024-10-31T09:27:26.411Z"
}
10 changes: 7 additions & 3 deletions src/7tv-emotes/modules/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ export class Emotes extends FrankerFaceZ.utilities.module.Module {
}

export class Cosmetics extends FrankerFaceZ.utilities.module.Module {
fetchAvatars() {
return {};
// return this.parent.requestObject('cosmetics/avatars?map_to=login');
fetchAvatars(identifiers) {
return this.parent.requestJSON('bridge/event-api', {
method: 'POST',
body: JSON.stringify({
identifiers
})
});
}
}
19 changes: 6 additions & 13 deletions src/7tv-emotes/modules/avatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,16 @@ export default class Avatars extends FrankerFaceZ.utilities.module.Module {
this.waitingAvatars.push(login);

if ( ! this.requestTimer )
this.requestTimer = setTimeout(() => {
this.requestTimer = setTimeout(async () => {
this.requestTimer = null;
const waiting = this.waitingAvatars;
this.waitingAvatars = null;

const socket = this.resolve('..socket');
socket.emitSocket({
op: socket.OPCODES.BRIDGE,
d: {
command: 'userstate',
body: {
identifiers: waiting.map(login => `username:${login}`),
platform: 'TWITCH',
kinds: ['AVATAR']
}
}
});
const avatars = await this.api.cosmetics.fetchAvatars(waiting.map(login => `username:${login}`));
for (const { body } of avatars) {
const { data } = body.object;
this.receiveAvatarData(data);
}
}, 1000); // request them all after 1000ms
});

Expand Down
8 changes: 5 additions & 3 deletions src/7tv-emotes/modules/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,11 @@ export default class Socket extends FrankerFaceZ.utilities.module.Module {
else if (kind === 'BADGE') {
this.badges.addBadge(data);
}
else if (kind === 'AVATAR') {
this.avatars.receiveAvatarData(data);
}
// Deprecated because it was causing too many issues on their websocket
// It's using an API endpoint now
// else if (kind === 'AVATAR') {
// this.avatars.receiveAvatarData(data);
// }
}
else if (type === 'entitlement.create') {
const object = body.object;
Expand Down

0 comments on commit edcf221

Please sign in to comment.