fix forceOwnerCrown Plugin Spamming Errors in Console (#180)

Co-authored-by: Nico <nico@d3sox.me>
Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
Nickyux 2022-11-01 02:19:07 +01:00 committed by GitHub
parent 04d6f341ee
commit 1944f3957f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View file

@ -30,7 +30,7 @@ export default definePlugin({
authors: [ authors: [
Devs.Megu, Devs.Megu,
Devs.Ven, Devs.Ven,
{ name: "Nickyux", id: 427146305651998721n }, Devs.Nickyux,
{ name: "BanTheNons", id: 460478012794863637n }, { name: "BanTheNons", id: 460478012794863637n },
], ],
description: "Enable Access to Experiments in Discord!", description: "Enable Access to Experiments in Discord!",

View file

@ -26,7 +26,7 @@ waitFor(["getGuild"], m => GuildStore = m);
export default definePlugin({ export default definePlugin({
name: "ForceOwnerCrown", name: "ForceOwnerCrown",
description: "Force the owner crown next to usernames even if the server is large.", description: "Force the owner crown next to usernames even if the server is large.",
authors: [Devs.D3SOX], authors: [Devs.D3SOX, Devs.Nickyux],
patches: [ patches: [
{ {
// This is the logic where it decides whether to render the owner crown or not // This is the logic where it decides whether to render the owner crown or not
@ -38,6 +38,11 @@ export default definePlugin({
}, },
], ],
isGuildOwner(props) { isGuildOwner(props) {
// Check if channel is a Group DM, if so return false
if (props?.channel?.type === 3) {
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;

View file

@ -88,5 +88,9 @@ export const Devs = Object.freeze({
D3SOX: { D3SOX: {
name: "D3SOX", name: "D3SOX",
id: 201052085641281538n id: 201052085641281538n
},
Nickyux: {
name: "Nickyux",
id: 427146305651998721n
} }
}); });