stuff
This commit is contained in:
parent
9a1d464c0f
commit
cb4d45f9a1
|
@ -4417,6 +4417,11 @@
|
|||
settingsToolbar: "settingsToolbar-wu4yfQ",
|
||||
toolbar: "toolbar-hRzFw-"
|
||||
};
|
||||
DiscordClassModules.OwnerTag = {
|
||||
adminIcon: "admin-Kv1Hp_",
|
||||
managementIcon: "management-3fF_o8",
|
||||
ownerIcon: "owner-FfFh3B-"
|
||||
};
|
||||
DiscordClassModules.PinDMs = {
|
||||
dragPreview: "dragPreview-nXiByA",
|
||||
dmChannelPinned: "pinned-0lM4wD",
|
||||
|
@ -4815,6 +4820,9 @@
|
|||
_oldtitlebarenabled: ["OldTitleBar", "oldTitleBarEnabled"],
|
||||
_oldtitlebarsettingstoolbar: ["OldTitleBar", "settingsToolbar"],
|
||||
_oldtitlebartoolbar: ["OldTitleBar", "toolbar"],
|
||||
_ownertagadminicon: ["OwnerTag", "adminIcon"],
|
||||
_ownertagmanagementicon: ["OwnerTag", "managementIcon"],
|
||||
_ownertagownericon: ["OwnerTag", "ownerIcon"],
|
||||
_pindmsdragpreview: ["PinDMs", "dragPreview"],
|
||||
_pindmsdmchannelpinned: ["PinDMs", "dmChannelPinned"],
|
||||
_pindmsdmchannelplaceholder: ["PinDMs", "dmChannelPlaceholder"],
|
||||
|
@ -11052,7 +11060,7 @@
|
|||
delete e.returnvalue.props.userId;
|
||||
};
|
||||
|
||||
const ContextMenuTypes = ["UserSettingsCog", "User", "Developer", "Slate", "GuildFolder", "GroupDM", "SystemMessage", "Message", "Native", "Guild", "Channel"];
|
||||
const ContextMenuTypes = ["UserSettingsCog", "User", "Developer", "Slate", "GuildFolder", "GroupDM", "SystemMessage", "Message", "Native", "Role", "Guild", "Channel"];
|
||||
const QueuedComponents = BDFDB.ArrayUtils.removeCopies([].concat(ContextMenuTypes.map(n => n + "ContextMenu"), ["GuildHeaderContextMenu", "MessageOptionContextMenu", "MessageOptionToolbar"]));
|
||||
InternalBDFDB.addContextListeners = function (plugin) {
|
||||
plugin = plugin == BDFDB && InternalBDFDB || plugin;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,8 +3,9 @@
|
|||
var OwnerTag = (_ => {
|
||||
const userTypes = {
|
||||
NONE: 0,
|
||||
ADMIN: 1,
|
||||
OWNER: 2
|
||||
MANAGEMENT: 1,
|
||||
ADMIN: 2,
|
||||
OWNER: 3
|
||||
};
|
||||
|
||||
var settings = {}, inputs = {};
|
||||
|
@ -12,7 +13,7 @@ var OwnerTag = (_ => {
|
|||
return class OwnerTag {
|
||||
getName () {return "OwnerTag";}
|
||||
|
||||
getVersion () {return "1.3.0";}
|
||||
getVersion () {return "1.3.1";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -20,7 +21,7 @@ var OwnerTag = (_ => {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["BotTag","BotTag style is now properly inverted on the userpopout if the user is playing a game etc."]]
|
||||
"added":[["Management Crown/Tag","Added a third tag for people with the server management permission"]]
|
||||
};
|
||||
|
||||
this.patchedModules = {
|
||||
|
@ -35,8 +36,11 @@ var OwnerTag = (_ => {
|
|||
|
||||
initConstructor () {
|
||||
this.css = `
|
||||
${BDFDB.dotCN.memberownericon}.admin-crown {
|
||||
color: #b3b3b3;
|
||||
${BDFDB.dotCN.memberownericon + BDFDB.dotCN._ownertagadminicon} {
|
||||
color: #c0c0c0;
|
||||
}
|
||||
${BDFDB.dotCN.memberownericon + BDFDB.dotCN._ownertagmanagementicon} {
|
||||
color: #ef7f32;
|
||||
}
|
||||
${BDFDB.dotCNS.message + BDFDB.dotCN.memberownericon} {
|
||||
top: 2px;
|
||||
|
@ -58,27 +62,58 @@ var OwnerTag = (_ => {
|
|||
addInMemberList: {value:true, inner:true, description:"Member List"},
|
||||
addInUserPopout: {value:true, inner:true, description:"User Popouts"},
|
||||
addInUserProfile: {value:true, inner:true, description:"User Profile Modal"},
|
||||
useRoleColor: {value:true, inner:false, description:"Use the Rolecolor instead of the default blue."},
|
||||
useBlackFont: {value:false, inner:false, description:"Instead of darkening the Rolecolor on bright colors use black font."},
|
||||
useCrown: {value:false, inner:false, description:"Use the Crown Icon instead of the OwnerTag."},
|
||||
hideNativeCrown: {value:true, inner:false, description:"Hide the native Crown Icon (not the Plugin one)."},
|
||||
addForAdmins: {value:false, inner:false, description:"Also add an Admin Tag for any user with Admin rights."},
|
||||
ignoreBotAdmins: {value:false, inner:false, description:"Do not add the Admin tag for bots with Admin rights."}
|
||||
useRoleColor: {value:true, inner:false, description:"Use the Rolecolor instead of the default blue"},
|
||||
useBlackFont: {value:false, inner:false, description:"Instead of darkening the Rolecolor on bright colors use black font"},
|
||||
useCrown: {value:false, inner:false, description:"Use the Crown Icon instead of the OwnerTag"},
|
||||
hideNativeCrown: {value:true, inner:false, description:"Hide the native Crown Icon (not the Plugin one)"},
|
||||
addForAdmins: {value:false, inner:false, description:"Also add an Admin Tag for any user with admin permissions"},
|
||||
addForManagement: {value:false, inner:false, description:"Also add a Management Tag for any user with server manage permissions"},
|
||||
ignoreBotAdmins: {value:false, inner:false, description:"Do not add the Admin/Management tag for bots"}
|
||||
},
|
||||
inputs: {
|
||||
ownTagName: {value:"Owner", description:"Owner Tag Text for Owners"},
|
||||
ownAdminTagName: {value:"Admin", description:"Owner Tag Text for Admins"}
|
||||
ownTagName: {value:"Owner", description:"Tag Text for Owners"},
|
||||
ownAdminTagName: {value:"Admin", description:"Tag Text for Admins"},
|
||||
ownModeratorTagName: {value:"Management", description:"Tag Text for Management"}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
getSettingsPanel () {
|
||||
getSettingsPanel (collapseStates = {}) {
|
||||
if (!window.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
let inputs = BDFDB.DataUtils.get(this, "inputs");
|
||||
let settingsPanel, settingsItems = [], innerItems = [];
|
||||
|
||||
for (let key in inputs) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
|
||||
title: "Settings",
|
||||
collapseStates: collapseStates,
|
||||
children: Object.keys(settings).map(key => !this.defaults.settings[key].inner && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
value: settings[key]
|
||||
}))
|
||||
}));
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
|
||||
title: "Tag Settings",
|
||||
collapseStates: collapseStates,
|
||||
children: [BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
|
||||
className: BDFDB.disCN.marginbottom4,
|
||||
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H3,
|
||||
children: "Add Tags in:"
|
||||
})].concat(Object.keys(settings).map(key => this.defaults.settings[key].inner && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
value: settings[key]
|
||||
})))
|
||||
}));
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
|
||||
title: "Tag Text Settings",
|
||||
collapseStates: collapseStates,
|
||||
children: Object.keys(inputs).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "TextInput",
|
||||
plugin: this,
|
||||
|
@ -86,23 +121,7 @@ var OwnerTag = (_ => {
|
|||
label: this.defaults.inputs[key].description,
|
||||
basis: "50%",
|
||||
value: inputs[key]
|
||||
}));
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
|
||||
className: BDFDB.disCN.marginbottom8
|
||||
}));
|
||||
for (let key in settings) (!this.defaults.settings[key].inner ? settingsItems : innerItems).push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "Switch",
|
||||
plugin: this,
|
||||
keys: ["settings", key],
|
||||
label: this.defaults.settings[key].description,
|
||||
value: settings[key]
|
||||
}));
|
||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelInner, {
|
||||
title: "Add Owner Tag in:",
|
||||
first: settingsItems.length == 0,
|
||||
last: true,
|
||||
children: innerItems
|
||||
}))
|
||||
}));
|
||||
|
||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
|
||||
|
@ -231,14 +250,27 @@ var OwnerTag = (_ => {
|
|||
}
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let member = settings.useRoleColor ? (BDFDB.LibraryModules.MemberStore.getMember(channel.guild_id, user.id) || {}) : {};
|
||||
let isOwner = userType == userTypes.OWNER;
|
||||
let tag = null;
|
||||
if (settings.useCrown) {
|
||||
let label = isOwner ? (channel.type == BDFDB.DiscordConstants.ChannelTypes.GROUP_DM ? BDFDB.LanguageUtils.LanguageStrings.GROUP_OWNER : BDFDB.LanguageUtils.LanguageStrings.GUILD_OWNER) : BDFDB.LanguageUtils.LanguageStrings.ADMINISTRATOR;
|
||||
let label, className;
|
||||
switch (userType) {
|
||||
case userTypes.OWNER:
|
||||
label = channel.type == BDFDB.DiscordConstants.ChannelTypes.GROUP_DM ? BDFDB.LanguageUtils.LanguageStrings.GROUP_OWNER : BDFDB.LanguageUtils.LanguageStrings.GUILD_OWNER;
|
||||
className = BDFDB.disCN._ownertagownericon;
|
||||
break;
|
||||
case userTypes.ADMIN:
|
||||
label = BDFDB.LanguageUtils.LanguageStrings.ADMINISTRATOR;
|
||||
className = BDFDB.disCN._ownertagadminicon;
|
||||
break;
|
||||
case userTypes.MANAGEMENT:
|
||||
label = BDFDB.LanguageUtils.LanguageStrings.MODERATION;
|
||||
className = BDFDB.disCN._ownertagmanagementicon;
|
||||
break;
|
||||
}
|
||||
tag = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
|
||||
text: label,
|
||||
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
||||
className: BDFDB.disCNS.memberownericon + (isOwner ? "owner-crown" : "admin-crown"),
|
||||
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.memberownericon, className),
|
||||
name: BDFDB.LibraryComponents.SvgIcon.Names.CROWN,
|
||||
"aria-label": label
|
||||
})
|
||||
|
@ -268,8 +300,10 @@ var OwnerTag = (_ => {
|
|||
if (!channel) return userTypes.NONE;
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id);
|
||||
let isOwner = channel.ownerId == user.id || guild && guild.ownerId == user.id;
|
||||
if (!(isOwner || (settings.addForAdmins && BDFDB.UserUtils.can("ADMINISTRATOR", user.id) && !(settings.ignoreBotAdmins && user.bot)))) return userTypes.NONE;
|
||||
return isOwner ? userTypes.OWNER : userTypes.ADMIN;
|
||||
if (isOwner) return userTypes.OWNER;
|
||||
else if (settings.addForAdmins && BDFDB.UserUtils.can("ADMINISTRATOR", user.id) && !(settings.ignoreBotAdmins && user.bot)) return userTypes.ADMIN;
|
||||
else if (settings.addForManagement && BDFDB.UserUtils.can("MANAGE_GUILD", user.id) && !(settings.ignoreBotAdmins && user.bot)) return userTypes.MANAGEMENT;
|
||||
return userTypes.NONE;
|
||||
}
|
||||
|
||||
forceUpdateAll () {
|
||||
|
|
Loading…
Reference in New Issue