plugins
This commit is contained in:
parent
52b211691c
commit
97d40e991a
|
@ -2,7 +2,7 @@
|
|||
* @name EditChannels
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 4.2.8
|
||||
* @version 4.2.9
|
||||
* @description Allows you to locally edit Channels
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,12 +17,12 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "EditChannels",
|
||||
"author": "DevilBro",
|
||||
"version": "4.2.8",
|
||||
"version": "4.2.9",
|
||||
"description": "Allows you to locally edit Channels"
|
||||
},
|
||||
"changeLog": {
|
||||
"fixed": {
|
||||
"New Mention Style": ""
|
||||
"Group DMs": "Fixed some stuff in Group DMs"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -118,6 +118,8 @@ module.exports = (_ => {
|
|||
}
|
||||
};
|
||||
|
||||
this.patchPriority = 9;
|
||||
|
||||
this.css = `
|
||||
${BDFDB.dotCN.messagespopoutchannelname}:hover > span[style*="color"],
|
||||
${BDFDB.dotCN.recentmentionschannelname}:hover > span[style*="color"],
|
||||
|
@ -127,21 +129,7 @@ module.exports = (_ => {
|
|||
`;
|
||||
}
|
||||
|
||||
onStart () {
|
||||
// REMOVE 16.05.2021
|
||||
let oldData = BDFDB.DataUtils.load(this);
|
||||
if (oldData.settings) {
|
||||
this.settings.general = BDFDB.ObjectUtils.filter(oldData.settings, k => k.indexOf("changeIn") == -1, true);
|
||||
this.settings.places = Object.entries(BDFDB.ObjectUtils.filter(oldData.settings, k => k.indexOf("changeIn") == 0, true)).reduce((n, p) => {
|
||||
let k = p[0].replace("changeIn", "");
|
||||
n[k[0].toLowerCase() + k.slice(1)] = p[1];
|
||||
return n;
|
||||
}, {});
|
||||
BDFDB.DataUtils.save(this.settings.general, this, "general");
|
||||
BDFDB.DataUtils.save(this.settings.places, this, "places");
|
||||
BDFDB.DataUtils.remove(this, "settings");
|
||||
}
|
||||
|
||||
onStart () {
|
||||
let observer = new MutationObserver(_ => {this.changeAppTitle();});
|
||||
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name: "appTitleObserver", instance: observer}, {childList: true});
|
||||
|
||||
|
@ -274,9 +262,8 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
processChannelEditorContainer (e) {
|
||||
if (!e.instance.props.disabled && e.instance.props.channel && BDFDB.ChannelUtils.isTextChannel(e.instance.props.channel) && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL && this.settings.places.chatTextarea) {
|
||||
let data = changedChannels[e.instance.props.channel.id];
|
||||
e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${data && data.name || e.instance.props.channel.name}`);
|
||||
if (!e.instance.props.disabled && e.instance.props.channel && (BDFDB.ChannelUtils.isTextChannel(e.instance.props.channel) || e.instance.props.channel.isGroupDM()) && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL && this.settings.places.chatTextarea) {
|
||||
if (changedChannels[e.instance.props.channel.id] && changedChannels[e.instance.props.channel.id].name) e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${changedChannels[e.instance.props.channel.id].name}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,7 +311,7 @@ module.exports = (_ => {
|
|||
let channelName = BDFDB.ReactUtils.findChild(e.instance, {name: ["Title", "ChannelName"]});
|
||||
if (channelName) {
|
||||
if (channelName.props.children) {
|
||||
channelName.props.children = channel.isGroupDM() ? this.getGroupName(channel.id) : this.getChannelData(channel.id).name;
|
||||
if (changedChannels[channel.id] && changedChannels[channel.id].name) channelName.props.children = channel.isGroupDM() ? this.getGroupName(channel.id) : this.getChannelData(channel.id).name;
|
||||
this.changeChannelColor(channelName, channel.id);
|
||||
}
|
||||
if (channelName.props.channel) channelName.props.channel = this.getChannelData(channel.id);
|
||||
|
@ -419,8 +406,10 @@ module.exports = (_ => {
|
|||
|
||||
processDirectMessage (e) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && this.settings.places.recentDms) {
|
||||
let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ListItemTooltip"});
|
||||
if (tooltip) tooltip.props.text = this.getGroupName(e.instance.props.channel.id);
|
||||
if (changedChannels[e.instance.props.channel.id] && changedChannels[e.instance.props.channel.id].name) {
|
||||
let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ListItemTooltip"});
|
||||
if (tooltip) tooltip.props.text = this.getGroupName(e.instance.props.channel.id);
|
||||
}
|
||||
let avatar = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: c => c && c.props && !isNaN(parseInt(c.props.id))});
|
||||
if (avatar && typeof avatar.props.children == "function") {
|
||||
let childrenRender = avatar.props.children;
|
||||
|
@ -435,7 +424,9 @@ module.exports = (_ => {
|
|||
|
||||
processPrivateChannel (e) {
|
||||
if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && this.settings.places.channelList) {
|
||||
e.returnvalue.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(e.instance.props.channel.id)});
|
||||
if (changedChannels[e.instance.props.channel.id] && changedChannels[e.instance.props.channel.id].name) {
|
||||
e.returnvalue.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(e.instance.props.channel.id)});
|
||||
}
|
||||
this.changeChannelColor(e.returnvalue.props.name, e.instance.props.channel.id, {modify: BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "hovered", "selected", "hasUnreadMessages", "muted")});
|
||||
e.returnvalue.props.name = [e.returnvalue.props.name];
|
||||
e.returnvalue.props.avatar.props.src = this.getGroupIcon(e.instance.props.channel.id);
|
||||
|
@ -583,11 +574,13 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
changeAppTitle () {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let title = document.head.querySelector("title");
|
||||
if (title) {
|
||||
if (BDFDB.ChannelUtils.isTextChannel(channel)) BDFDB.DOMUtils.setText(title, "#" + this.getChannelData(channel.id, this.settings.places.appTitle).name);
|
||||
else if (channel && channel.isGroupDM()) BDFDB.DOMUtils.setText(title, this.getGroupName(channel.id, this.settings.places.appTitle));
|
||||
if (this.settings.places.appTitle) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
||||
let title = document.head.querySelector("title");
|
||||
if (title && changedChannels[channel.id] && changedChannels[channel.id].name) {
|
||||
if (BDFDB.ChannelUtils.isTextChannel(channel)) BDFDB.DOMUtils.setText(title, "#" + this.getChannelData(channel.id).name);
|
||||
else if (channel && channel.isGroupDM()) BDFDB.DOMUtils.setText(title, this.getGroupName(channel.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -655,8 +648,8 @@ module.exports = (_ => {
|
|||
return new BDFDB.DiscordObjects.Channel(channel);
|
||||
}
|
||||
|
||||
getGroupName (channelId, change = true) {
|
||||
let channel = this.getChannelData(channelId, change);
|
||||
getGroupName (channelId) {
|
||||
let channel = this.getChannelData(channelId);
|
||||
if (channel.name) return channel.name;
|
||||
let recipients = channel.recipients.map(BDFDB.LibraryModules.UserStore.getUser).filter(n => n);
|
||||
return recipients.length > 0 ? recipients.map(u => u.toString()).join(", ") : BDFDB.LanguageUtils.LanguageStrings.UNNAMED;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @name NotificationSounds
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 3.6.0
|
||||
* @version 3.6.1
|
||||
* @description Allows you to replace the native Sounds with custom Sounds
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,8 +17,13 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "NotificationSounds",
|
||||
"author": "DevilBro",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.1",
|
||||
"description": "Allows you to replace the native Sounds with custom Sounds"
|
||||
},
|
||||
"changeLog": {
|
||||
"added": {
|
||||
"Replies": "Same as @here/@everyone/role mentions a new sub type for replies was added, this allows you to set a custom sound for only replies or mute reply pings"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -68,11 +73,14 @@ module.exports = (_ => {
|
|||
|
||||
var currentDevice = defaultDevice, createdAudios = {}, repatchIncoming;
|
||||
|
||||
const message1Types = ["dm", "mentioned", "reply", "role", "everyone", "here"];
|
||||
|
||||
/* NEVER CHANGE THE SRC LINKS IN THE PLUGIN FILE, TO ADD NEW SOUNDS ADD THEM IN THE SETTINGS GUI IN THE PLUGINS PAGE */
|
||||
const types = {
|
||||
"message1": {implemented: true, name: "New Chat Message", src: "/assets/dd920c06a01e5bb8b09678581e29d56f.mp3", mute: true, focus: null, include: true},
|
||||
"dm": {implemented: true, name: "Direct Message", src: "/assets/84c9fa3d07da865278bd77c97d952db4.mp3", mute: true, focus: true, include: false},
|
||||
"mentioned": {implemented: true, name: "Mentioned", src: "/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute: true, focus: true, include: false},
|
||||
"reply": {implemented: true, name: "Mentioned (reply)", src: "/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute: true, focus: true, include: false},
|
||||
"role": {implemented: true, name: "Mentioned (role)", src: "/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute: true, focus: true, include: false},
|
||||
"everyone": {implemented: true, name: "Mentioned (@everyone)", src: "/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute: true, focus: true, include: false},
|
||||
"here": {implemented: true, name: "Mentioned (@here)", src: "/assets/a5f42064e8120e381528b14fd3188b72.mp3", mute: true, focus: true, include: false},
|
||||
|
@ -234,8 +242,8 @@ module.exports = (_ => {
|
|||
}
|
||||
else if (BDFDB.LibraryModules.MentionUtils.isRawMessageMentioned(message, BDFDB.UserUtils.me.id)) {
|
||||
if (message.mentions.length && !this.isSuppressMentionEnabled(guildId, message.channel_id) && !(choices.mentioned.focus && document.hasFocus() && BDFDB.LibraryModules.LastChannelStore.getChannelId() == message.channel_id)) for (let mention of message.mentions) if (mention.id == BDFDB.UserUtils.me.id) {
|
||||
this.fireEvent("mentioned");
|
||||
this.playAudio("mentioned");
|
||||
this.fireEvent(message.message_reference ? "reply" : "mentioned");
|
||||
this.playAudio(message.message_reference ? "reply" : "mentioned");
|
||||
return;
|
||||
}
|
||||
if (guildId && message.mention_roles.length && !BDFDB.LibraryModules.MutedUtils.isSuppressRolesEnabled(guildId, message.channel_id) && !(choices.role.focus && document.hasFocus() && BDFDB.LibraryModules.LastChannelStore.getChannelId() == message.channel_id)) {
|
||||
|
@ -270,12 +278,13 @@ module.exports = (_ => {
|
|||
e.stopOriginalMethodCall();
|
||||
BDFDB.TimeUtils.timeout(_ => {
|
||||
if (type == "message1") {
|
||||
if (firedEvents["dm"]) firedEvents["dm"] = false;
|
||||
else if (firedEvents["mentioned"]) firedEvents["mentioned"] = false;
|
||||
else if (firedEvents["role"]) firedEvents["role"] = false;
|
||||
else if (firedEvents["everyone"]) firedEvents["everyone"] = false;
|
||||
else if (firedEvents["here"]) firedEvents["here"] = false;
|
||||
else this.playAudio(type);
|
||||
let called = false;
|
||||
for (let subType of message1Types) if (firedEvents[subType]) {
|
||||
delete firedEvents[subType];
|
||||
called = true;
|
||||
break;
|
||||
}
|
||||
if (!called) this.playAudio(type);
|
||||
}
|
||||
else this.playAudio(type);
|
||||
});
|
||||
|
@ -686,7 +695,7 @@ module.exports = (_ => {
|
|||
|
||||
fireEvent (type) {
|
||||
firedEvents[type] = true;
|
||||
BDFDB.TimeUtils.timeout(_ => {firedEvents[type] = false;},3000);
|
||||
BDFDB.TimeUtils.timeout(_ => delete firedEvents[type], 3000);
|
||||
}
|
||||
};
|
||||
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @name RemoveBlockedMessages
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 1.2.6
|
||||
* @version 1.2.7
|
||||
* @description Removes blocked Messages/Users
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,12 +17,12 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "RemoveBlockedMessages",
|
||||
"author": "DevilBro",
|
||||
"version": "1.2.6",
|
||||
"version": "1.2.7",
|
||||
"description": "Removes blocked Messages/Users"
|
||||
},
|
||||
"changeLog": {
|
||||
"fixed": {
|
||||
"New Messages Bar": "No longer shows on newly added blocked Messages"
|
||||
"Group DMs": "Fixed some stuff in Group DMs"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -84,7 +84,9 @@ module.exports = (_ => {
|
|||
autocompletes: {value: true, description: "Autocomplete Entries"},
|
||||
memberList: {value: true, description: "Members in List"},
|
||||
voiceList: {value: true, description: "Members in Voice List"},
|
||||
voiceChat: {value: true, description: "Members in Voice Chat"}
|
||||
voiceChat: {value: true, description: "Members in Voice Chat"},
|
||||
channelList: {value: true, description: "Channel/Group List"},
|
||||
recentDms: {value: true, description: "Group Notifications"}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -107,6 +109,8 @@ module.exports = (_ => {
|
|||
Reactions: "render",
|
||||
MemberListItem: "render",
|
||||
VoiceUser: "render",
|
||||
DirectMessage: "render",
|
||||
PrivateChannel: "render",
|
||||
UserMention: "default",
|
||||
RichUserMention: "UserMention"
|
||||
}
|
||||
|
@ -116,6 +120,10 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
onStart () {
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.ChannelStore, "getChannel", {after: e => {
|
||||
if (e.returnValue && e.returnValue.isGroupDM()) return new BDFDB.DiscordObjects.Channel(Object.assign({}, e.returnValue, {rawRecipients: e.returnValue.rawRecipients.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id)), recipients: e.returnValue.recipients.filter(id => !id || !BDFDB.LibraryModules.RelationshipStore.isBlocked(id))}))
|
||||
}});
|
||||
|
||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.RelationshipUtils, "addRelationship", {after: e => {
|
||||
if (e.methodArguments[2] == BDFDB.DiscordConstants.RelationshipTypes.BLOCKED) this.forceUpdateAll();
|
||||
}});
|
||||
|
@ -390,8 +398,22 @@ module.exports = (_ => {
|
|||
if (this.settings.places.voiceList && e.instance.props.user && BDFDB.LibraryModules.RelationshipStore.isBlocked(e.instance.props.user.id)) return null;
|
||||
}
|
||||
|
||||
processDirectMessage (e) {
|
||||
if (e.instance.props.channel && !e.instance.props.channel.name && e.instance.props.channel.isGroupDM() && this.settings.places.recentDms) {
|
||||
let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ListItemTooltip"});
|
||||
if (tooltip) tooltip.props.text = this.getGroupName(e.instance.props.channel.id);
|
||||
}
|
||||
}
|
||||
|
||||
processPrivateChannel (e) {
|
||||
if (this.settings.places.memberList && e.instance.props.channel && e.instance.props.channel.isGroupDM()) e.instance.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, e.instance.props.channel, {rawRecipients: e.instance.props.channel.rawRecipients.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryModules.RelationshipStore.isBlocked(id))}));
|
||||
if (this.settings.places.channelList && e.instance.props.channel && e.instance.props.channel.isGroupDM()) {
|
||||
if (!e.returnvalue) {
|
||||
e.instance.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, e.instance.props.channel, {rawRecipients: e.instance.props.channel.rawRecipients.filter(n => !n || !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryModules.RelationshipStore.isBlocked(id))}));
|
||||
}
|
||||
else {
|
||||
if (!e.instance.props.channel.name) e.returnvalue.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(e.instance.props.channel.id)});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processPrivateChannelCallParticipants (e) {
|
||||
|
@ -419,6 +441,13 @@ module.exports = (_ => {
|
|||
children: ["@" + BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER]
|
||||
});
|
||||
}
|
||||
|
||||
getGroupName (channelId) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
||||
if (channel.name) return channel.name;
|
||||
let recipients = channel.recipients.map(BDFDB.LibraryModules.UserStore.getUser).filter(n => n && !BDFDB.LibraryModules.RelationshipStore.isBlocked(n.id));
|
||||
return recipients.length > 0 ? recipients.map(u => u.toString()).join(", ") : BDFDB.LanguageUtils.LanguageStrings.UNNAMED;
|
||||
}
|
||||
};
|
||||
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue