Fix TypingTweaks
This commit is contained in:
parent
468b290d28
commit
18274e4f0e
1 changed files with 13 additions and 10 deletions
|
|
@ -45,14 +45,16 @@ const settings = definePluginSettings({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export function buildSeveralUsers({ a, b, count }: { a: string, b: string, count: number; }) {
|
export const buildSeveralUsers = ErrorBoundary.wrap(({ a, b, count }: { a: string, b: string, count: number; }) => {
|
||||||
return [
|
return (
|
||||||
|
<>
|
||||||
<strong key="0">{a}</strong>,
|
<strong key="0">{a}</strong>,
|
||||||
", ",
|
", ",
|
||||||
<strong key="1">{b}</strong>,
|
<strong key="1">{b}</strong>,
|
||||||
`, and ${count} others are typing...`
|
`, and ${count} others are typing...`
|
||||||
];
|
</>
|
||||||
}
|
);
|
||||||
|
}, { noop: true });
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
user: User;
|
user: User;
|
||||||
|
|
@ -96,11 +98,12 @@ export default definePlugin({
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "#{intl::THREE_USERS_TYPING}",
|
find: "#{intl::THREE_USERS_TYPING}",
|
||||||
|
group: true,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// Style the indicator and add function call to modify the children before rendering
|
// 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).+?)/,
|
match: /(?<=children:\[(\i)\.length>0.{0,300}?"aria-atomic":!0,children:)\i/,
|
||||||
replace: "$self.renderTypingUsers({ users: $1, guildId: $2, children: $& })"
|
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
|
// Changes the indicator to keep the user object when creating the list of typing users
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue