This commit is contained in:
Mirco Wittrien 2022-09-27 13:19:16 +02:00
parent 7ce034f73a
commit b753bfa551
4 changed files with 12 additions and 12 deletions

View File

@ -571,7 +571,7 @@ module.exports = (_ => {
BDFDB.LogUtils.log(BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_started", ""), plugin);
if (Internal.settings.general.showToasts && !BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.showToasts)) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_started", `${plugin.name} v${plugin.version}`), {
disableInteractions: true,
barColor: BDFDB.DiscordConstants.Colors && BDFDB.DiscordConstants.Colors.STATUS_GREEN
barColor: BDFDB.DiscordConstants.Colors.STATUS_GREEN
});
if (plugin.css) BDFDB.DOMUtils.appendLocalStyle(plugin.name, plugin.css);
@ -588,7 +588,7 @@ module.exports = (_ => {
BDFDB.LogUtils.log(BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_stopped", ""), plugin);
if (Internal.settings.general.showToasts && !BDFDB.BDUtils.getSettings(BDFDB.BDUtils.settingsIds.showToasts)) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("toast_plugin_stopped", `${plugin.name} v${plugin.version}`), {
disableInteractions: true,
barColor: BDFDB.DiscordConstants.Colors && BDFDB.DiscordConstants.Colors.STATUS_RED
barColor: BDFDB.DiscordConstants.Colors.STATUS_RED
});
const url = Internal.getPluginURL(plugin);
@ -3168,7 +3168,7 @@ module.exports = (_ => {
BDFDB.MessageUtils = {};
BDFDB.MessageUtils.isSystemMessage = function (message) {
return message && message.type !== BDFDB.DiscordConstants.MessageTypes.DEFAULT && message.type !== BDFDB.DiscordConstants.MessageTypes.REPLY && (message.type !== BDFDB.DiscordConstants.MessageTypes.CHAT_INPUT_COMMAND || message.interaction == null);
return message && !BDFDB.DiscordConstants.MessageTypeGroups.USER_MESSAGE.has(message.type) && (message.type !== BDFDB.DiscordConstants.MessageTypes.CHAT_INPUT_COMMAND || message.interaction == null);
};
BDFDB.MessageUtils.rerenderAll = function (instant) {
BDFDB.TimeUtils.clear(BDFDB.MessageUtils.rerenderAll.timeout);
@ -4904,9 +4904,9 @@ module.exports = (_ => {
render() {
if (this.state.hasError) return Internal.LibraryModules.React.createElement("span", {
style: {
background: BDFDB.DiscordConstants && BDFDB.DiscordConstants.Colors && BDFDB.DiscordConstants.Colors.PRIMARY_DARK,
background: BDFDB.DiscordConstants.Colors.PRIMARY_DARK,
borderRadius: 5,
color: BDFDB.DiscordConstants && BDFDB.DiscordConstants.Colors && BDFDB.DiscordConstants.Colors.STATUS_RED,
color: BDFDB.DiscordConstants.Colors.STATUS_RED,
fontSize: 12,
fontWeight: 600,
padding: 6,
@ -7690,8 +7690,8 @@ module.exports = (_ => {
};
Internal.setDefaultProps(CustomComponents.Switch, {
size: CustomComponents.Switch.Sizes.DEFAULT,
uncheckedColor: BDFDB.DiscordConstants.Colors && BDFDB.DiscordConstants.Colors.PRIMARY_DARK_400,
checkedColor: BDFDB.DiscordConstants.Colors && BDFDB.DiscordConstants.Colors.BRAND
uncheckedColor: BDFDB.DiscordConstants.Colors.PRIMARY_DARK_400,
checkedColor: BDFDB.DiscordConstants.Colors.BRAND
});
CustomComponents.TabBar = reactInitialized && class BDFDB_TabBar extends Internal.LibraryModules.React.Component {

View File

@ -900,7 +900,7 @@ module.exports = (_ => {
processMessageContent (e) {
if (e.instance.props.message && this.settings.places.chatWindow && this.shouldChangeInChat(e.instance.props.message.channel_id)) {
if (!e.returnvalue) {
if (e.instance.props.message.type != BDFDB.DiscordConstants.MessageTypes.DEFAULT && e.instance.props.message.type != BDFDB.DiscordConstants.MessageTypes.REPLY) {
if (!BDFDB.DiscordConstants.MessageTypeGroups.USER_MESSAGE.has(message.type)) {
let message = new BDFDB.DiscordObjects.Message(Object.assign({}, e.instance.props.message, {author: this.getUserData(e.instance.props.message.author.id, true, false, e.instance.props.message.author)}));
let data = changedUsers[e.instance.props.message.author.id];
if (data) {

View File

@ -355,7 +355,7 @@ module.exports = (_ => {
doDelete ({messageDiv, message}, action, event) {
let deleteLink = messageDiv.parentElement.querySelector(BDFDB.dotCNS.messagelocalbotoperations + BDFDB.dotCN.anchor);
if (deleteLink) deleteLink.click();
else if (BDFDB.DiscordConstants.MessageTypesDeletable[message.type]) {
else if (BDFDB.DiscordConstants.MessageTypeGroups.DELETABLE.has(message.type)) {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
if (channel && (BDFDB.UserUtils.can("MANAGE_MESSAGES") || message.author.id == BDFDB.UserUtils.me.id)) {
BDFDB.LibraryModules.MessageUtils.deleteMessage(message.channel_id, message.id, message.state != BDFDB.DiscordConstants.MessageStates.SENT);
@ -382,7 +382,7 @@ module.exports = (_ => {
doPinUnPin ({messageDiv, message}, action, event) {
if (message.state == BDFDB.DiscordConstants.MessageStates.SENT) {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
if (channel && (BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("MANAGE_MESSAGES")) && (message.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT || message.type == BDFDB.DiscordConstants.MessageTypes.REPLY)) {
if (channel && (BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("MANAGE_MESSAGES")) && BDFDB.DiscordConstants.MessageTypeGroups.USER_MESSAGE.has(message.type)) {
if (message.pinned) {
BDFDB.LibraryModules.MessagePinUtils.unpinMessage(channel, message.id);
if (this.settings.toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.MESSAGE_UNPINNED), {type: "danger"});
@ -398,7 +398,7 @@ module.exports = (_ => {
doReply ({messageDiv, message}, action, event) {
if (message.state == BDFDB.DiscordConstants.MessageStates.SENT) {
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
if (channel && (BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("SEND_MESSAGES")) && (message.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT || message.type == BDFDB.DiscordConstants.MessageTypes.REPLY)) {
if (channel && (BDFDB.DMUtils.isDMChannel(channel.id) || BDFDB.UserUtils.can("SEND_MESSAGES")) && BDFDB.DiscordConstants.MessageTypeGroups.USER_MESSAGE.has(message.type)) {
BDFDB.LibraryModules.MessageManageUtils.replyToMessage(channel, message, {});
if (this.settings.toasts[action]) BDFDB.NotificationUtils.toast(this.formatToast(BDFDB.LanguageUtils.LanguageStrings.NOTIFICATION_REPLY), {type: "success"});
}

View File

@ -260,7 +260,7 @@ module.exports = (_ => {
}
let groupId, author;
for (let i in newStream) {
if (newStream[i].type == "MESSAGE" && (newStream[i].content.type.type == BDFDB.DiscordConstants.MessageTypes.DEFAULT || newStream[i].content.type.type == BDFDB.DiscordConstants.MessageTypes.REPLY) && groupId != newStream[i].groupId) {
if (newStream[i].type == "MESSAGE" && BDFDB.DiscordConstants.MessageTypeGroups.USER_MESSAGE.has(newStream[i].content.type) && groupId != newStream[i].groupId) {
if (author && author.id == newStream[i].content.author.id && author.username == newStream[i].content.author.username) newStream[i] = Object.assign({}, newStream[i], {groupId: groupId});
author = newStream[i].content.author;
}