mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-19 04:00:59 -04:00
Added support for caching pronouncs
This commit is contained in:
@@ -9,6 +9,7 @@ const sbServerAddress = urlParams.get("address") || "127.0.0.1";
|
|||||||
const sbServerPort = urlParams.get("port") || "8080";
|
const sbServerPort = urlParams.get("port") || "8080";
|
||||||
const minimumRole = 2; // 1 - Viewer, 2 - VIP, 3 - Moderator, 4 - Broadcaster
|
const minimumRole = 2; // 1 - Viewer, 2 - VIP, 3 - Moderator, 4 - Broadcaster
|
||||||
const avatarMap = new Map();
|
const avatarMap = new Map();
|
||||||
|
const pronounMap = new Map();
|
||||||
const animationDuration = 8000;
|
const animationDuration = 8000;
|
||||||
let widgetLocked = false; // Needed to lock animation from overlapping
|
let widgetLocked = false; // Needed to lock animation from overlapping
|
||||||
let alertQueue = [];
|
let alertQueue = [];
|
||||||
@@ -1048,14 +1049,23 @@ async function GetAvatar(username) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function GetPronouns(platform, username) {
|
async function GetPronouns(platform, username) {
|
||||||
const response = await client.getUserPronouns(platform, username);
|
if (pronounMap.has(username)) {
|
||||||
const userFound = response.pronoun.userFound;
|
console.debug(`Pronouns found for ${username}. Retrieving from hash map.`)
|
||||||
const pronouns = `${response.pronoun.pronounSubject}/${response.pronoun.pronounObject}`;
|
return pronounMap.get(username);
|
||||||
|
}
|
||||||
if (userFound)
|
else {
|
||||||
return `${response.pronoun.pronounSubject}/${response.pronoun.pronounObject}`;
|
console.debug(`No pronouns found for ${username}. Retrieving from alejo.io.`)
|
||||||
else
|
const response = await client.getUserPronouns(platform, username);
|
||||||
return '';
|
const userFound = response.pronoun.userFound;
|
||||||
|
const pronouns = `${response.pronoun.pronounSubject}/${response.pronoun.pronounObject}`;
|
||||||
|
|
||||||
|
pronounMap.set(username, pronouns);
|
||||||
|
|
||||||
|
if (userFound)
|
||||||
|
return pronouns;
|
||||||
|
else
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddMessageItem(element, elementID, platform, userId) {
|
function AddMessageItem(element, elementID, platform, userId) {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ const urlParams = new URLSearchParams(queryString);
|
|||||||
const sbServerAddress = urlParams.get("address") || "127.0.0.1";
|
const sbServerAddress = urlParams.get("address") || "127.0.0.1";
|
||||||
const sbServerPort = urlParams.get("port") || "8080";
|
const sbServerPort = urlParams.get("port") || "8080";
|
||||||
const avatarMap = new Map();
|
const avatarMap = new Map();
|
||||||
|
const pronounMap = new Map();
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// OPTIONS //
|
// OPTIONS //
|
||||||
@@ -1772,14 +1773,23 @@ async function GetAvatar(username) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function GetPronouns(platform, username) {
|
async function GetPronouns(platform, username) {
|
||||||
const response = await client.getUserPronouns(platform, username);
|
if (pronounMap.has(username)) {
|
||||||
const userFound = response.pronoun.userFound;
|
console.debug(`Pronouns found for ${username}. Retrieving from hash map.`)
|
||||||
const pronouns = `${response.pronoun.pronounSubject}/${response.pronoun.pronounObject}`;
|
return pronounMap.get(username);
|
||||||
|
}
|
||||||
if (userFound)
|
else {
|
||||||
return `${response.pronoun.pronounSubject}/${response.pronoun.pronounObject}`;
|
console.debug(`No pronouns found for ${username}. Retrieving from alejo.io.`)
|
||||||
else
|
const response = await client.getUserPronouns(platform, username);
|
||||||
return '';
|
const userFound = response.pronoun.userFound;
|
||||||
|
const pronouns = `${response.pronoun.pronounSubject}/${response.pronoun.pronounObject}`;
|
||||||
|
|
||||||
|
pronounMap.set(username, pronouns);
|
||||||
|
|
||||||
|
if (userFound)
|
||||||
|
return pronouns;
|
||||||
|
else
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// function IsImageUrl(url) {
|
// function IsImageUrl(url) {
|
||||||
|
|||||||
Reference in New Issue
Block a user