Merge remote-tracking branch 'upstream/main'

This commit is contained in:
thororen1234 2024-08-01 13:51:48 -04:00
commit b013967b7b
20 changed files with 326 additions and 56 deletions

View file

@ -13,10 +13,10 @@ import definePlugin, { OptionType } from "@utils/types";
import { SelectedGuildStore, useState } from "@webpack/common";
import { User } from "discord-types/general";
export const settings = definePluginSettings({
hideAtSymbol: {
const settings = definePluginSettings({
showAtSymbol: {
type: OptionType.BOOLEAN,
description: "Whether the the @-symbol should be hidden.",
description: "Whether the the @ symbol should be displayed",
default: true
}
});
@ -32,7 +32,9 @@ export default definePlugin({
replace: "children:$self.renderUsername({username:$1,user:$2})"
}
}],
settings,
renderUsername: ErrorBoundary.wrap((props: { user: User, username: string; }) => {
const { user, username } = props;
const [isHovering, setIsHovering] = useState(false);
@ -49,9 +51,11 @@ export default definePlugin({
</span>
);
}, { noop: true })
});
function getUsernameString(username: string) {
if (settings.store.hideAtSymbol) return username;
return `@${username}`;
return settings.store.showAtSymbol
? `@${username}`
: username;
}