forceOwnerCrown: fix (#1858)
This commit is contained in:
parent
3917193e8f
commit
06b4dffa62
|
@ -27,18 +27,17 @@ export default definePlugin({
|
||||||
authors: [Devs.D3SOX, Devs.Nickyux],
|
authors: [Devs.D3SOX, Devs.Nickyux],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
// This is the logic where it decides whether to render the owner crown or not
|
find: "AVATAR_DECORATION_PADDING:",
|
||||||
find: ".MULTIPLE_AVATAR",
|
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(\i)=(\i)\.isOwner,/,
|
match: /,isOwner:(\i),/,
|
||||||
replace: "$1=$self.isGuildOwner($2),"
|
replace: ",_isOwner:$1=$self.isGuildOwner(e),"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
isGuildOwner(props: { user: User, channel: Channel, guildId?: string; }) {
|
isGuildOwner(props: { user: User, channel: Channel, isOwner: boolean, guildId?: string; }) {
|
||||||
if (!props?.user?.id) return false;
|
if (!props?.user?.id) return props.isOwner;
|
||||||
if (props.channel?.type === 3 /* GROUP_DM */)
|
if (props.channel?.type === 3 /* GROUP_DM */)
|
||||||
return false;
|
return props.isOwner;
|
||||||
|
|
||||||
// guild id is in props twice, fallback if the first is undefined
|
// guild id is in props twice, fallback if the first is undefined
|
||||||
const guildId = props.guildId ?? props.channel?.guild_id;
|
const guildId = props.guildId ?? props.channel?.guild_id;
|
||||||
|
|
Loading…
Reference in a new issue