ExpandedUserTags: Some Misc Fixes

This commit is contained in:
thororen1234 2025-05-28 14:00:07 -04:00
parent f3646bd1ab
commit b96f18d076
No known key found for this signature in database
5 changed files with 19 additions and 7 deletions

View file

@ -9,9 +9,14 @@ import { GuildStore } from "@webpack/common";
import { RC } from "@webpack/types"; import { RC } from "@webpack/types";
import { Channel, Guild, Message, User } from "discord-types/general"; import { Channel, Guild, Message, User } from "discord-types/general";
import { settings } from "./settings";
import type { ITag } from "./types"; import type { ITag } from "./types";
export const isWebhook = (message: Message, user: User) => !!message?.webhookId && user.isNonUserBot(); export const isWebhook = (message: Message, user: User) => {
const isFollowed = message?.type === 0 && !!message?.messageReference && !settings.store.showWebhookTagFully;
return !!message?.webhookId && user.isNonUserBot() && !isFollowed;
};
export const tags = [ export const tags = [
{ {
name: "WEBHOOK", name: "WEBHOOK",

View file

@ -76,7 +76,7 @@ export default definePlugin({
renderNicknameIcon(props) { renderNicknameIcon(props) {
const tagId = this.getTag({ const tagId = this.getTag({
user: UserStore.getUser(props.userId), user: UserStore.getUser(props.userId),
channel: ChannelStore.getChannel(this.getChannelId()), channel: getCurrentChannel(),
channelId: this.getChannelId(), channelId: this.getChannelId(),
isChat: false isChat: false
}); });
@ -92,7 +92,7 @@ export default definePlugin({
message: props.message, message: props.message,
user: UserStore.getUser(props.message.author.id), user: UserStore.getUser(props.message.author.id),
channelId: props.message.channel_id, channelId: props.message.channel_id,
isChat: false isChat: true
}); });
return tagId && <Tag return tagId && <Tag
@ -146,9 +146,9 @@ export default definePlugin({
const perms = this.getPermissions(user, channel); const perms = this.getPermissions(user, channel);
for (const tag of tags) { for (const tag of tags) {
if (isChat && !settings.tagSettings[tag.name].showInChat) if (isChat && !settings.tagSettings[tag.name]?.showInChat)
continue; continue;
if (!isChat && !settings.tagSettings[tag.name].showInNotChat) if (!isChat && !settings.tagSettings[tag.name]?.showInNotChat)
continue; continue;
// If the owner tag is disabled, and the user is the owner of the guild, // If the owner tag is disabled, and the user is the owner of the guild,
@ -159,7 +159,9 @@ export default definePlugin({
user.id && user.id &&
isChat && isChat &&
!settings.tagSettings.OWNER.showInChat) || !settings.tagSettings.OWNER.showInChat) ||
(!isChat && (GuildStore.getGuild(channel?.guild_id)?.ownerId ===
user.id &&
!isChat &&
!settings.tagSettings.OWNER.showInNotChat) !settings.tagSettings.OWNER.showInNotChat)
) )
continue; continue;

View file

@ -96,9 +96,14 @@ export const settings = definePluginSettings({
default: false, default: false,
restartNeeded: true restartNeeded: true
}, },
showWebhookTagFully: {
description: "Show Webhook tag in followed channels like announcements",
type: OptionType.BOOLEAN,
default: false
},
tagSettings: { tagSettings: {
type: OptionType.COMPONENT, type: OptionType.COMPONENT,
component: SettingsComponent, component: SettingsComponent,
description: "fill me" description: "fill me"
} },
}); });