TypingTweaks: fix crash on non en-US locales (#463)

This commit is contained in:
Nick 2023-01-31 00:35:52 -05:00 committed by GitHub
parent 62f7e4d45c
commit 8f4e8d0a9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -66,10 +66,18 @@ export default definePlugin({
},
// Changes indicator to format message with the typing users
{
find: ',"SEVERAL_USERS_TYPING","',
find: '"SEVERAL_USERS_TYPING":"',
replacement: {
match: /(\i)\((\i),"SEVERAL_USERS_TYPING",".+?"\)/,
replace: "$1($2,\"SEVERAL_USERS_TYPING\",\"**!!{a}!!**, **!!{b}!!**, and {c} others are typing...\")"
match: /("SEVERAL_USERS_TYPING"):".+?"/,
replace: "$1:\"**!!{a}!!**, **!!{b}!!**, and {c} others are typing...\""
},
predicate: () => settings.store.alternativeFormatting
},
{
find: ",\"SEVERAL_USERS_TYPING\",\"",
replacement: {
match: /(\i)\((\i),("SEVERAL_USERS_TYPING"),".+?"\)/,
replace: "$1($2,$3,\"**!!{a}!!**, **!!{b}!!**, and {c} others are typing...\")"
},
predicate: () => settings.store.alternativeFormatting
},
@ -78,7 +86,7 @@ export default definePlugin({
find: "getCooldownTextStyle",
replacement: {
match: /(\i)\.length\?.\..\.Messages\.THREE_USERS_TYPING.format\(\{a:(\i),b:(\i),c:.}\).+?SEVERAL_USERS_TYPING/,
replace: "$&.format({a:$2,b:$3,c:$1.length})"
replace: "$&.format({a:$2,b:$3,c:$1.length-2})"
},
predicate: () => settings.store.alternativeFormatting
}
@ -105,7 +113,7 @@ export default definePlugin({
size={Avatar.Sizes.SIZE_16}
src={user.getAvatarURL(guildId, 128)}/>
</div>}
{user.username}
{GuildMemberStore.getNick(guildId!, user.id) || user.username}
</strong>;
}, { noop: true })
});