ForceOwnerCrown: Remove log spam
This commit is contained in:
parent
188d12d1a3
commit
998ce72f3b
@ -19,6 +19,7 @@
|
|||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { GuildStore } from "@webpack/common";
|
import { GuildStore } from "@webpack/common";
|
||||||
|
import { Channel, User } from "discord-types/general";
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "ForceOwnerCrown",
|
name: "ForceOwnerCrown",
|
||||||
@ -34,25 +35,15 @@ export default definePlugin({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
isGuildOwner(props) {
|
isGuildOwner(props: { user: User, channel: Channel, guildId?: string; }) {
|
||||||
// Check if channel is a Group DM, if so return false
|
if (!props?.user?.id) return false;
|
||||||
if (props?.channel?.type === 3) {
|
if (props.channel?.type === 3 /* GROUP_DM */)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
||||||
const userId = props?.user?.id;
|
const userId = props.user.id;
|
||||||
|
|
||||||
if (guildId && userId) {
|
return GuildStore.getGuild(guildId)?.ownerId === userId;
|
||||||
const guild = GuildStore.getGuild(guildId);
|
|
||||||
if (guild) {
|
|
||||||
return guild.ownerId === userId;
|
|
||||||
}
|
|
||||||
console.error("[ForceOwnerCrown] failed to get guild", { guildId, guild, props });
|
|
||||||
} else {
|
|
||||||
console.error("[ForceOwnerCrown] no guildId or userId", { guildId, userId, props });
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user