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 { Channel, Guild, Message, User } from "discord-types/general";
import { settings } from "./settings";
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 = [
{
name: "WEBHOOK",

View file

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

View file

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