mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-08 14:13:01 -04:00
ExpandedUserTags: Some Misc Fixes
This commit is contained in:
parent
f3646bd1ab
commit
b96f18d076
5 changed files with 19 additions and 7 deletions
|
@ -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",
|
|
@ -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;
|
|
@ -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"
|
||||||
}
|
},
|
||||||
});
|
});
|
Loading…
Add table
Add a link
Reference in a new issue