Update OwnerTag.plugin.js
This commit is contained in:
parent
4b9c8e1ab7
commit
8ef801e915
|
@ -3,7 +3,7 @@
|
|||
class OwnerTag {
|
||||
getName () {return "OwnerTag";}
|
||||
|
||||
getVersion () {return "1.1.8";}
|
||||
getVersion () {return "1.1.9";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,19 +11,23 @@ class OwnerTag {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"improved":[["Transparent colors","Added compatibility for (semi-)transparent colors"]]
|
||||
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
"MemberListItem":["componentDidMount","componentDidUpdate"],
|
||||
"MessageUsername":["componentDidMount","componentDidUpdate"],
|
||||
"UserPopout":["componentDidMount","componentDidUpdate"],
|
||||
"UserProfile":["componentDidMount","componentDidUpdate"],
|
||||
"StandardSidebarView":"componentWillUnmount"
|
||||
MemberListItem: "render",
|
||||
MessageUsername: "render",
|
||||
UserPopout: "componentDidMount",
|
||||
UserProfile: "componentDidMount"
|
||||
};
|
||||
}
|
||||
|
||||
initConstructor () {
|
||||
this.css = `
|
||||
${BDFDB.dotCN.memberownericon}.admin-crown {
|
||||
color: #b3b3b3;
|
||||
}
|
||||
`;
|
||||
this.defaults = {
|
||||
settings: {
|
||||
addInChatWindow: {value:true, inner:true, description:"Messages"},
|
||||
|
@ -46,28 +50,36 @@ class OwnerTag {
|
|||
getSettingsPanel () {
|
||||
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
var inputs = BDFDB.DataUtils.get(this, "inputs");
|
||||
var settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.titlesize18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
|
||||
for (let key in inputs) {
|
||||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCN.flexchild}" style="flex: 0 0 50%;">${this.defaults.inputs[key].description}</h3><div class="${BDFDB.disCNS.inputwrapper + BDFDB.disCNS.vertical + BDFDB.disCNS.flex2 + BDFDB.disCN.directioncolumn}" style="flex: 1 1 auto;"><input type="text" option="${key}" value="${inputs[key]}" placeholder="${this.defaults.inputs[key].value}" class="${BDFDB.disCNS.inputdefault + BDFDB.disCNS.input + BDFDB.disCN.titlesize16}"></div></div>`;
|
||||
}
|
||||
for (let key in settings) {
|
||||
if (!this.defaults.settings[key].inner) settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
|
||||
}
|
||||
settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 0 0 auto;">Add Owner Tag in:</h3></div><div class="BDFDB-settings-inner-list">`;
|
||||
for (let key in settings) {
|
||||
if (this.defaults.settings[key].inner) settingshtml += `<div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.titlesize16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.settings[key].description}</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${key}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[key] ? " checked" : ""}></div></div>`;
|
||||
}
|
||||
settingshtml += `</div>`;
|
||||
settingshtml += `</div></div>`;
|
||||
|
||||
let settingspanel = BDFDB.DOMUtils.create(settingshtml);
|
||||
|
||||
BDFDB.initElements(settingspanel, this);
|
||||
|
||||
BDFDB.ListenerUtils.add(this, settingspanel, "keyup", BDFDB.dotCN.input, () => {this.saveInputs(settingspanel);});
|
||||
|
||||
return settingspanel;
|
||||
let inputs = BDFDB.DataUtils.get(this, "inputs");
|
||||
let settingsitems = [], inneritems = [];
|
||||
|
||||
for (let key in inputs) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
type: "TextInput",
|
||||
plugin: this,
|
||||
keys: ["inputs", key],
|
||||
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.SettingsSwitch, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
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 BDFDB.PluginUtils.createSettingsPanel(this, settingsitems);
|
||||
}
|
||||
|
||||
//legacy
|
||||
|
@ -100,8 +112,6 @@ class OwnerTag {
|
|||
BDFDB.PluginUtils.init(this);
|
||||
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
|
||||
this.addHideCSS();
|
||||
}
|
||||
else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!");
|
||||
}
|
||||
|
@ -110,9 +120,7 @@ class OwnerTag {
|
|||
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
|
||||
this.stopping = true;
|
||||
|
||||
BDFDB.DOMUtils.remove(".owner-tag, .owner-tag-crown");
|
||||
|
||||
BDFDB.DOMUtils.removeLocalStyle(this.name + "HideCrown");
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
|
||||
BDFDB.PluginUtils.clear(this);
|
||||
}
|
||||
|
@ -121,81 +129,98 @@ class OwnerTag {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
saveInputs (settingspanel) {
|
||||
let inputs = {};
|
||||
for (let input of settingspanel.querySelectorAll(BDFDB.dotCN.input)) {
|
||||
inputs[input.getAttribute("option")] = input.value;
|
||||
}
|
||||
BDFDB.DataUtils.save(inputs, this, "inputs");
|
||||
this.SettingsUpdated = true;
|
||||
}
|
||||
|
||||
processMemberListItem (instance, wrapper, returnvalue) {
|
||||
if (instance.props && BDFDB.DataUtils.get(this, "settings", "addInMemberList")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.namecontainernamewrapper), "list", BDFDB.disCN.bottagmember, null);
|
||||
}
|
||||
|
||||
processUserPopout (instance, wrapper, returnvalue) {
|
||||
if (instance.props && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "popout", BDFDB.disCN.bottagnametag, wrapper);
|
||||
}
|
||||
|
||||
processUserProfile (instance, wrapper, returnvalue) {
|
||||
if (instance.props && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) this.addOwnerTag(instance.props.user, null, wrapper.querySelector(BDFDB.dotCN.nametag), "profile", BDFDB.disCNS.bottagnametag + BDFDB.disCN.userprofilebottag, wrapper);
|
||||
}
|
||||
|
||||
processMessageUsername (instance, wrapper, returnvalue, methodnames) {
|
||||
let message = BDFDB.ReactUtils.getValue(instance, "props.message");
|
||||
if (message && BDFDB.DataUtils.get(this, "settings", "addInChatWindow")) {
|
||||
let username = wrapper.querySelector(BDFDB.dotCN.messageusername);
|
||||
if (username) {
|
||||
let messagegroup = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagegroup, wrapper);
|
||||
this.addOwnerTag(message.author, message.channel_id, username.parentElement, "chat", BDFDB.DOMUtils.containsClass(messagegroup, BDFDB.disCN.messagegroupcozy) ? BDFDB.disCN.bottagmessagecozy : BDFDB.disCN.bottagmessagecompact, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
onSettingsClosed (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
BDFDB.DOMUtils.remove(".owner-tag, .owner-tag-crown");
|
||||
BDFDB.ModuleUtils.forceAllUpdates(this);
|
||||
this.addHideCSS();
|
||||
}
|
||||
}
|
||||
|
||||
addOwnerTag (info, channelid, wrapper, type, selector = "", container) {
|
||||
if (!info || !wrapper || !wrapper.parentElement) return;
|
||||
BDFDB.DOMUtils.remove(wrapper.querySelectorAll(".owner-tag, .owner-tag-crown"));
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelid || BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
if (!channel) return;
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id);
|
||||
processMemberListItem (e) {
|
||||
let usertype = this.getUserType(e.instance.props.user);
|
||||
if (usertype && BDFDB.DataUtils.get(this, "settings", "addInMemberList")) {
|
||||
this.injectOwnerTag(BDFDB.ReactUtils.getValue(e.returnvalue, "props.decorators.props.children"), e.instance.props.user, usertype, 1, BDFDB.disCN.bottagmember);
|
||||
}
|
||||
}
|
||||
|
||||
processMessageUsername (e) {
|
||||
let user = BDFDB.ReactUtils.getValue(e.instance, "props.message.author");
|
||||
let usertype = this.getUserType(user);
|
||||
if (usertype && BDFDB.DataUtils.get(this, "settings", "addInChatWindow")) {
|
||||
this.injectOwnerTag(BDFDB.ReactUtils.getValue(e.returnvalue, "props.children.props.children"), user, usertype, 2, e.instance.props.isCompact ? BDFDB.disCN.bottagmessagecompact : BDFDB.disCN.bottagmessagecozy);
|
||||
}
|
||||
}
|
||||
|
||||
processUserPopout (e) {
|
||||
let usertype = this.getUserType(e.instance.props.user);
|
||||
if (usertype && BDFDB.DataUtils.get(this, "settings", "addInUserPopout")) {
|
||||
let nameTag = e.node.querySelector(BDFDB.dotCN.nametag);
|
||||
let tagProps = BDFDB.ReactUtils.findProps(nameTag, {name:"DiscordTag", up:true});
|
||||
if (nameTag && tagProps) this.appendOwnerTag(nameTag, e.instance.props.user, usertype, ((tagProps.botClass || "") + " " + BDFDB.disCNS.bottagnametag).trim(), tagProps.invertBotTagColor);
|
||||
}
|
||||
}
|
||||
|
||||
processUserProfile (e) {
|
||||
let usertype = this.getUserType(e.instance.props.user);
|
||||
if (usertype && BDFDB.DataUtils.get(this, "settings", "addInUserProfil")) {
|
||||
let nameTag = e.node.querySelector(BDFDB.dotCN.nametag);
|
||||
let tagProps = BDFDB.ReactUtils.findProps(nameTag, {name:"DiscordTag", up:true});
|
||||
if (nameTag && tagProps) this.appendOwnerTag(nameTag, e.instance.props.user, usertype, ((tagProps.botClass || "") + " " + BDFDB.disCNS.bottagnametag).trim(), tagProps.invertBotTagColor);
|
||||
}
|
||||
}
|
||||
|
||||
injectOwnerTag (children, user, usertype, insertindex, tagclass = "", inverted = false) {
|
||||
if (!BDFDB.ArrayUtils.is(children) || !user) return;
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
let isowner = channel.ownerId == info.id || guild && guild.ownerId == info.id;
|
||||
if (!(isowner || (settings.addForAdmins && BDFDB.UserUtils.can("ADMINISTRATOR", info.id)))) return;
|
||||
let member = settings.useRoleColor ? (BDFDB.LibraryModules.MemberStore.getMember(channel.guild_id, info.id) || {}) : {};
|
||||
if (!settings.useCrown) {
|
||||
let tag = BDFDB.DOMUtils.create(`<span class="owner-tag ${isowner ? "owner-tag-owner" : "owner-tag-admin"} owner-${type}-tag ${(settings.useRoleColor ? "owner-tag-rolecolor " : "") + BDFDB.disCN.bottag + (selector ? (" " + selector) : "")}" style="order: 10 !important;">${BDFDB.DataUtils.get(this, "inputs", isowner ? "ownTagName" : "ownAdminTagName")}</span>`);
|
||||
let invert = container && container.firstElementChild && !(BDFDB.DOMUtils.containsClass(container.firstElementChild, BDFDB.disCN.userpopoutheadernormal) || BDFDB.DOMUtils.containsClass(container.firstElementChild, BDFDB.disCN.userprofiletopsectionnormal));
|
||||
BDFDB.DOMUtils.addClass(tag, invert ? BDFDB.disCN.bottaginvert : BDFDB.disCN.bottagregular);
|
||||
let EditUsersData = BDFDB.BDUtils.isPluginEnabled("EditUsers") ? BDFDB.BDUtils.getPlugin("EditUsers").getUserData(info.id, wrapper) : {};
|
||||
let tagcolor = BDFDB.ColorUtils.convert(EditUsersData.color1 || member.colorString, "RGBA");
|
||||
let isbright = BDFDB.ColorUtils.isBright(tagcolor);
|
||||
tagcolor = isbright ? (settings.useBlackFont ? tagcolor : BDFDB.ColorUtils.change(tagcolor, -0.3)) : tagcolor;
|
||||
tag.style.setProperty(invert ? "color" : "background-color", tagcolor, "important");
|
||||
if (isbright && settings.useBlackFont) tag.style.setProperty(invert ? "background-color" : "color", "black", "important");
|
||||
wrapper.insertBefore(tag, wrapper.querySelector(".TRE-tag,svg[name=MobileDevice]"));
|
||||
let [_, index] = BDFDB.ReactUtils.findChildren(settings.useCrown || settings.hideNativeCrown ? children : null, {props:[["text",[BDFDB.LanguageUtils.LanguageStrings.GROUP_OWNER, BDFDB.LanguageUtils.LanguageStrings.GUILD_OWNER]]]});
|
||||
if (index > -1) children[index] = null;
|
||||
children.splice(insertindex, 0, this.createOwnerTag(user, usertype, tagclass, inverted, settings));
|
||||
}
|
||||
|
||||
appendOwnerTag (parent, user, usertype, tagclass = "", inverted = false) {
|
||||
let renderWrapper = document.createElement("span");
|
||||
BDFDB.ReactUtils.render(this.createOwnerTag(user, usertype, tagclass, inverted), renderWrapper);
|
||||
parent.appendChild(renderWrapper);
|
||||
}
|
||||
|
||||
createOwnerTag (user, usertype, tagclass, inverted, settings = BDFDB.DataUtils.get(this, "settings")) {
|
||||
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 == 2;
|
||||
if (settings.useCrown) {
|
||||
let label = isowner ? (channel.type == 3 ? BDFDB.LanguageUtils.LanguageStrings.GROUP_OWNER : BDFDB.LanguageUtils.LanguageStrings.GUILD_OWNER) : BDFDB.LanguageUtils.LanguageStrings.ADMINISTRATOR;
|
||||
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
|
||||
text: label,
|
||||
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
|
||||
className: BDFDB.disCNS.memberownericon + (isowner ? "owner-crown" : "admin-crown"),
|
||||
name: BDFDB.LibraryComponents.SvgIcon.Names.CROWN,
|
||||
"aria-label": label
|
||||
})
|
||||
});
|
||||
}
|
||||
else {
|
||||
let crown = BDFDB.DOMUtils.create(`<svg name="Crown" class="owner-tag-crown ${isowner ? "owner-tag-owner" : "owner-tag-admin"} ${BDFDB.disCN.memberownericon}" aria-hidden="false" width="24" height="24" viewBox="0 0 16 16"><g fill="none" fill-rule="evenodd"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.6572 5.42868C13.8879 5.29002 14.1806 5.30402 14.3973 5.46468C14.6133 5.62602 14.7119 5.90068 14.6473 6.16202L13.3139 11.4954C13.2393 11.7927 12.9726 12.0007 12.6666 12.0007H3.33325C3.02725 12.0007 2.76058 11.792 2.68592 11.4954L1.35258 6.16202C1.28792 5.90068 1.38658 5.62602 1.60258 5.46468C1.81992 5.30468 2.11192 5.29068 2.34325 5.42868L5.13192 7.10202L7.44592 3.63068C7.46173 3.60697 7.48377 3.5913 7.50588 3.57559C7.5192 3.56612 7.53255 3.55663 7.54458 3.54535L6.90258 2.90268C6.77325 2.77335 6.77325 2.56068 6.90258 2.43135L7.76458 1.56935C7.89392 1.44002 8.10658 1.44002 8.23592 1.56935L9.09792 2.43135C9.22725 2.56068 9.22725 2.77335 9.09792 2.90268L8.45592 3.54535C8.46794 3.55686 8.48154 3.56651 8.49516 3.57618C8.51703 3.5917 8.53897 3.60727 8.55458 3.63068L10.8686 7.10202L13.6572 5.42868ZM2.66667 12.6673H13.3333V14.0007H2.66667V12.6673Z" fill="${isowner ? "currentColor" : "#b3b3b3"}"></path></svg>`);
|
||||
crown.addEventListener("mouseenter", () => {
|
||||
BDFDB.TooltipUtils.create(crown, isowner ? (channel.type == 3 ? BDFDB.LanguageUtils.LanguageStrings.GROUP_OWNER : BDFDB.LanguageUtils.LanguageStrings.GUILD_OWNER) : BDFDB.LanguageUtils.LanguageStrings.ADMINISTRATOR, {type: "top"});
|
||||
let tagcolor = BDFDB.ColorUtils.convert(member.colorString, "RGBA");
|
||||
let isbright = BDFDB.ColorUtils.isBright(tagcolor);
|
||||
tagcolor = isbright ? (settings.useBlackFont ? tagcolor : BDFDB.ColorUtils.change(tagcolor, -0.3)) : tagcolor;
|
||||
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.BotTag, {
|
||||
className: tagclass,
|
||||
tag: BDFDB.DataUtils.get(this, "inputs", isowner ? "ownTagName" : "ownAdminTagName"),
|
||||
invertColor: inverted,
|
||||
style: {
|
||||
backgroundColor: inverted ? (isbright && settings.useBlackFont ? "black" : null) : tagcolor,
|
||||
color: !inverted ? (isbright && settings.useBlackFont ? "black" : null) : tagcolor
|
||||
}
|
||||
});
|
||||
wrapper.insertBefore(crown, wrapper.querySelector(".TRE-tag,svg[name=MobileDevice]"));
|
||||
}
|
||||
}
|
||||
|
||||
addHideCSS () {
|
||||
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||
if (settings.hideNativeCrown || settings.useCrown) BDFDB.DOMUtils.appendLocalStyle(this.name + "HideCrown", `${BDFDB.dotCNS.member + BDFDB.dotCN.memberownericon}:not(.owner-tag-crown) {display: none;}`);
|
||||
else BDFDB.DOMUtils.removeLocalStyle(this.name + "HideCrown");
|
||||
|
||||
getUserType (user) {
|
||||
if (!user) return 0;
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
if (!channel) return 0;
|
||||
let guild = BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id);
|
||||
let isowner = channel.ownerId == user.id || guild && guild.ownerId == user.id;
|
||||
if (!(isowner || (BDFDB.DataUtils.get(this, "settings", "addForAdmins") && BDFDB.UserUtils.can("ADMINISTRATOR", user.id)))) return 0;
|
||||
return isowner ? 2 : 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue