Fix TypingTweaks

This commit is contained in:
Vendicated 2025-07-01 22:36:25 +02:00
parent 468b290d28
commit 18274e4f0e
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -45,14 +45,16 @@ const settings = definePluginSettings({
}
});
export function buildSeveralUsers({ a, b, count }: { a: string, b: string, count: number; }) {
return [
export const buildSeveralUsers = ErrorBoundary.wrap(({ a, b, count }: { a: string, b: string, count: number; }) => {
return (
<>
<strong key="0">{a}</strong>,
", ",
<strong key="1">{b}</strong>,
`, and ${count} others are typing...`
];
}
</>
);
}, { noop: true });
interface Props {
user: User;
@ -96,11 +98,12 @@ export default definePlugin({
patches: [
{
find: "#{intl::THREE_USERS_TYPING}",
group: true,
replacement: [
{
// Style the indicator and add function call to modify the children before rendering
match: /(?<=children:\[(\i)\.length>0.{0,200}?"aria-atomic":!0,children:)\i(?<=guildId:(\i).+?)/,
replace: "$self.renderTypingUsers({ users: $1, guildId: $2, children: $& })"
match: /(?<=children:\[(\i)\.length>0.{0,300}?"aria-atomic":!0,children:)\i/,
replace: "$self.renderTypingUsers({ users: $1, guildId: arguments[0]?.channel?.guild_id, children: $& })"
},
{
// Changes the indicator to keep the user object when creating the list of typing users