PronounDB: Rework API to avoid rate limits

This commit is contained in:
Nuckyz 2024-09-22 12:47:18 -03:00
parent db5fe2a394
commit b1db18c319
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
6 changed files with 208 additions and 205 deletions

View file

@ -21,9 +21,9 @@ import "./styles.css";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { useProfilePronouns } from "./api";
import PronounsAboutComponent from "./components/PronounsAboutComponent";
import { CompactPronounsChatComponentWrapper, PronounsChatComponentWrapper } from "./components/PronounsChatComponent";
import { useProfilePronouns } from "./pronoundbUtils";
import { settings } from "./settings";
export default definePlugin({
@ -53,15 +53,15 @@ export default definePlugin({
replacement: [
{
match: /\.PANEL},/,
replace: "$&[vcPronoun,vcPronounSource,vcHasPendingPronouns]=$self.useProfilePronouns(arguments[0].user?.id),"
replace: "$&{pronouns:vcPronoun,source:vcPronounSource,hasPendingPronouns:vcHasPendingPronouns}=$self.useProfilePronouns(arguments[0].user?.id),"
},
{
match: /text:\i\.\i.Messages.USER_PROFILE_PRONOUNS/,
replace: '$&+(vcHasPendingPronouns?"":` (${vcPronounSource})`)'
replace: '$&+(vcPronoun==null||vcHasPendingPronouns?"":` (${vcPronounSource})`)'
},
{
match: /(\.pronounsText.+?children:)(\i)/,
replace: "$1vcHasPendingPronouns?$2:vcPronoun"
replace: "$1(vcPronoun==null||vcHasPendingPronouns)?$2:vcPronoun"
}
]
}