From fed56ecf208886690fa4aaa4b786dd38f2589b2a Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Sat, 18 Nov 2023 18:31:04 +0100 Subject: [PATCH] Formatting and new request --- .../BetterFriendList.plugin.js | 2 +- Plugins/BetterNsfwTag/BetterNsfwTag.plugin.js | 11 +++- .../BetterSearchPage.plugin.js | 11 +++- Plugins/CharCounter/CharCounter.plugin.js | 11 +++- Plugins/ChatAliases/ChatAliases.plugin.js | 13 ++-- Plugins/ChatFilter/ChatFilter.plugin.js | 17 ++++-- .../ClickableMentions.plugin.js | 11 +++- .../CompleteTimestamps.plugin.js | 15 +++-- Plugins/CustomQuoter/CustomQuoter.plugin.js | 15 +++-- .../CustomStatusPresets.plugin.js | 11 +++- .../DisplayServersAsChannels.plugin.js | 13 ++-- Plugins/EditChannels/EditChannels.plugin.js | 25 +++++--- Plugins/EditRoles/EditRoles.plugin.js | 11 +++- Plugins/EditServers/EditServers.plugin.js | 11 +++- Plugins/EditUsers/EditUsers.plugin.js | 27 ++++---- .../EmojiStatistics/EmojiStatistics.plugin.js | 11 +++- .../FriendNotifications.plugin.js | 27 ++++---- .../GameActivityToggle.plugin.js | 23 ++++--- .../GoogleSearchReplace.plugin.js | 61 ++++++++++--------- .../HideMutedCategories.plugin.js | 11 +++- .../ImageUtilities/ImageUtilities.plugin.js | 55 +++++++++-------- .../LastMessageDate/LastMessageDate.plugin.js | 13 ++-- .../MessageUtilities.plugin.js | 35 ++++++----- .../NotificationSounds.plugin.js | 11 +++- Plugins/OldTitleBar/OldTitleBar.plugin.js | 15 +++-- .../OpenSteamLinksInApp.plugin.js | 11 +++- Plugins/PersonalPins/PersonalPins.plugin.js | 13 ++-- Plugins/PluginRepo/PluginRepo.plugin.js | 15 +++-- Plugins/QuickMention/QuickMention.plugin.js | 11 +++- .../ReadAllNotificationsButton.plugin.js | 17 ++++-- .../RemoveBlockedUsers.plugin.js | 15 +++-- .../RemoveNicknames/RemoveNicknames.plugin.js | 23 ++++--- .../RevealAllSpoilers.plugin.js | 11 +++- Plugins/ServerCounter/ServerCounter.plugin.js | 11 +++- Plugins/ServerDetails/ServerDetails.plugin.js | 29 +++++---- Plugins/ServerFolders/ServerFolders.plugin.js | 13 ++-- Plugins/ServerHider/ServerHider.plugin.js | 11 +++- .../ShowBadgesInChat.plugin.js | 11 +++- .../ShowConnections/ShowConnections.plugin.js | 11 +++- Plugins/SpellCheck/SpellCheck.plugin.js | 19 +++--- .../SplitLargeMessages.plugin.js | 17 ++++-- .../SpotifyControls/SpotifyControls.plugin.js | 27 ++++---- Plugins/StaffTag/StaffTag.plugin.js | 39 ++++++------ Plugins/ThemeRepo/ThemeRepo.plugin.js | 15 +++-- .../TimedLightDarkMode.plugin.js | 11 +++- .../TopRoleEverywhere.plugin.js | 19 +++--- Plugins/Translator/Translator.plugin.js | 23 ++++--- Plugins/UserNotes/UserNotes.plugin.js | 11 +++- .../WriteUpperCase/WriteUpperCase.plugin.js | 13 ++-- 49 files changed, 550 insertions(+), 312 deletions(-) diff --git a/Plugins/BetterFriendList/BetterFriendList.plugin.js b/Plugins/BetterFriendList/BetterFriendList.plugin.js index 70d445df6b..f7d2bd602f 100644 --- a/Plugins/BetterFriendList/BetterFriendList.plugin.js +++ b/Plugins/BetterFriendList/BetterFriendList.plugin.js @@ -80,7 +80,7 @@ module.exports = (_ => { this.defaults = { general: { addTotalAmount: {value: true, description: "Adds total Amount for All/Requested/Blocked"}, - addFavorizedCategory: {value: true, description: "Adds Favorites Category"}, + addFavorizedCategory: {value: true, description: "Adds Favorites Category"}, addHiddenCategory: {value: true, description: "Adds Hidden Category"}, addSortOptions: {value: true, description: "Adds Sort Options"}, addMutualGuild: {value: true, description: "Adds mutual Servers in Friend List"} diff --git a/Plugins/BetterNsfwTag/BetterNsfwTag.plugin.js b/Plugins/BetterNsfwTag/BetterNsfwTag.plugin.js index 7b54b8465e..cf82ba8290 100644 --- a/Plugins/BetterNsfwTag/BetterNsfwTag.plugin.js +++ b/Plugins/BetterNsfwTag/BetterNsfwTag.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/BetterSearchPage/BetterSearchPage.plugin.js b/Plugins/BetterSearchPage/BetterSearchPage.plugin.js index f629562d8b..5226936e7a 100644 --- a/Plugins/BetterSearchPage/BetterSearchPage.plugin.js +++ b/Plugins/BetterSearchPage/BetterSearchPage.plugin.js @@ -27,9 +27,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/CharCounter/CharCounter.plugin.js b/Plugins/CharCounter/CharCounter.plugin.js index afff4269b4..453fe8506f 100644 --- a/Plugins/CharCounter/CharCounter.plugin.js +++ b/Plugins/CharCounter/CharCounter.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/ChatAliases/ChatAliases.plugin.js b/Plugins/ChatAliases/ChatAliases.plugin.js index cd380be46a..9d9caae662 100644 --- a/Plugins/ChatAliases/ChatAliases.plugin.js +++ b/Plugins/ChatAliases/ChatAliases.plugin.js @@ -27,9 +27,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -69,7 +74,7 @@ module.exports = (_ => { regex: {value: false, description: "Handles the Word Value as a RegExp String"} }, general: { - addContextMenu: {value: true, inner: false, description: "Adds a Context Menu Entry to more freely add new Aliases"} + addContextMenu: {value: true, inner: false, description: "Adds a Context Menu Entry to more freely add new Aliases"} }, places: { normal: {value: true, inner: true, description: "Normal Message Textarea"}, diff --git a/Plugins/ChatFilter/ChatFilter.plugin.js b/Plugins/ChatFilter/ChatFilter.plugin.js index 9ab93efe73..be1a543962 100644 --- a/Plugins/ChatFilter/ChatFilter.plugin.js +++ b/Plugins/ChatFilter/ChatFilter.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -70,14 +75,14 @@ module.exports = (_ => { onLoad () { this.defaults = { replaces: { - blocked: {value: "~~BLOCKED~~", description: "Default Replacement Value for blocked Messages: "}, - censored: {value: "$!%&%!&", description: "Default Replacement Value for censored Messages: "} + blocked: {value: "~~BLOCKED~~", description: "Default Replacement Value for blocked Messages: "}, + censored: {value: "$!%&%!&", description: "Default Replacement Value for censored Messages: "} }, general: { addContextMenu: {value: true, description: "Adds a Context Menu Entry to faster add new blocked/censored Words"}, targetMessages: {value: true, description: "Checks Messages for blocked/censored Words"}, targetStatuses: {value: true, description: "Checks Custom Statuses for blocked/censored Words"}, - targetOwn: {value: true, description: "Filters/Blocks your own Messages/Custom Status"} + targetOwn: {value: true, description: "Filters/Blocks your own Messages/Custom Status"} } }; diff --git a/Plugins/ClickableMentions/ClickableMentions.plugin.js b/Plugins/ClickableMentions/ClickableMentions.plugin.js index 3d743907ae..cf4c01a0e6 100644 --- a/Plugins/ClickableMentions/ClickableMentions.plugin.js +++ b/Plugins/ClickableMentions/ClickableMentions.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js b/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js index a949eadd25..001f9f2f8d 100644 --- a/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js +++ b/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -74,8 +79,8 @@ module.exports = (_ => { markup: {value: true, description: "Markup Timestamp Tooltips"} }, dates: { - timestampDate: {value: {}, description: "Chat Timestamps"}, - tooltipDate: {value: {}, description: "Tooltip Timestamps"} + timestampDate: {value: {}, description: "Chat Timestamps"}, + tooltipDate: {value: {}, description: "Tooltip Timestamps"} } }; diff --git a/Plugins/CustomQuoter/CustomQuoter.plugin.js b/Plugins/CustomQuoter/CustomQuoter.plugin.js index 0d3cefd6f1..7c808f08d6 100644 --- a/Plugins/CustomQuoter/CustomQuoter.plugin.js +++ b/Plugins/CustomQuoter/CustomQuoter.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -110,8 +115,8 @@ module.exports = (_ => { this.defaults = { general: { - autoAddNewLine: {value: true, description: "Try to add New Lines before/after Quotes"}, - holdShiftToolbar: {value: false, description: "Need to hold Shift on a Message to show Quick Quote"}, + autoAddNewLine: {value: true, description: "Try to add New Lines before/after Quotes"}, + holdShiftToolbar: {value: false, description: "Need to hold Shift on a Message to show Quick Quote"}, alwaysCopy: {value: false, description: "Always copy Quote to Clipboard without holding Shift"} }, dates: { diff --git a/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js b/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js index 831bf75835..a80b82001c 100644 --- a/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js +++ b/Plugins/CustomStatusPresets/CustomStatusPresets.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/DisplayServersAsChannels/DisplayServersAsChannels.plugin.js b/Plugins/DisplayServersAsChannels/DisplayServersAsChannels.plugin.js index 183badc529..aaed06628d 100644 --- a/Plugins/DisplayServersAsChannels/DisplayServersAsChannels.plugin.js +++ b/Plugins/DisplayServersAsChannels/DisplayServersAsChannels.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -66,7 +71,7 @@ module.exports = (_ => { }, amounts: { serverListWidth: {value: 240, min: 45, description: "Server List Width in px: "}, - serverElementHeight: {value: 32, min: 16, description: "Server Element Height in px: "} + serverElementHeight: {value: 32, min: 16, description: "Server Element Height in px: "} } }; diff --git a/Plugins/EditChannels/EditChannels.plugin.js b/Plugins/EditChannels/EditChannels.plugin.js index 7505285a8b..dac2a0d035 100644 --- a/Plugins/EditChannels/EditChannels.plugin.js +++ b/Plugins/EditChannels/EditChannels.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -67,20 +72,20 @@ module.exports = (_ => { }, places: { chatTextarea: {value: true, description: "Chat Textarea"}, - chatWindow: {value: true, description: "Messages"}, - mentions: {value: true, description: "Mentions"}, + chatWindow: {value: true, description: "Messages"}, + mentions: {value: true, description: "Mentions"}, channelList: {value: true, description: "Channel/Group List"}, channelHeader: {value: true, description: "Channel/Group Header"}, - recentDms: {value: true, description: "Group Notifications"}, + recentDms: {value: true, description: "Group Notifications"}, recentMentions: {value: true, description: "Recent Mentions Popout"}, - threads: {value: true, description: "Thread Overview"}, + threads: {value: true, description: "Thread Overview"}, autocompletes: {value: true, description: "Autocomplete Menu"}, - auditLog: {value: true, description: "Audit Log"}, - inviteLog: {value: true, description: "Invite Log"}, + auditLog: {value: true, description: "Audit Log"}, + inviteLog: {value: true, description: "Invite Log"}, quickSwitcher: {value: true, description: "Quick Switcher"}, searchResults: {value: true, description: "Search Results"}, searchPopout: {value: true, description: "Search Popout"}, - appTitle: {value: true, description: "Discord App Title (Channels)"} + appTitle: {value: true, description: "Discord App Title (Channels)"} } }; diff --git a/Plugins/EditRoles/EditRoles.plugin.js b/Plugins/EditRoles/EditRoles.plugin.js index b3147857d6..0fd657d6f5 100644 --- a/Plugins/EditRoles/EditRoles.plugin.js +++ b/Plugins/EditRoles/EditRoles.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/EditServers/EditServers.plugin.js b/Plugins/EditServers/EditServers.plugin.js index 64bb81f5b4..0791bddc5d 100644 --- a/Plugins/EditServers/EditServers.plugin.js +++ b/Plugins/EditServers/EditServers.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/EditUsers/EditUsers.plugin.js b/Plugins/EditUsers/EditUsers.plugin.js index b401b2d6a6..732491d72c 100644 --- a/Plugins/EditUsers/EditUsers.plugin.js +++ b/Plugins/EditUsers/EditUsers.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -67,8 +72,8 @@ module.exports = (_ => { dms: {value: true, description: "Direct Messages"}, }, places: { - contextMenu: {value: true, description: "User ContextMenu"}, - chatTextarea: {value: true, description: "Chat Textarea"}, + contextMenu: {value: true, description: "User ContextMenu"}, + chatTextarea: {value: true, description: "Chat Textarea"}, chatWindow: {value: true, description: "Messages"}, reactions: {value: true, description: "Reactions"}, mentions: {value: true, description: "Mentions"}, @@ -83,12 +88,12 @@ module.exports = (_ => { inviteList: {value: true, description: "Invite List"}, activity: {value: true, description: "Activity Page"}, userPopout: {value: true, description: "User Popouts"}, - userProfile: {value: true, description: "User Profile Modal"}, - autocompletes: {value: true, description: "Autocomplete Menu"}, - guildSettings: {value: true, description: "Server Settings"}, - quickSwitcher: {value: true, description: "Quick Switcher"}, - searchPopout: {value: true, description: "Search Popout"}, - userAccount: {value: true, description: "Your Account Information"}, + userProfile: {value: true, description: "User Profile Modal"}, + autocompletes: {value: true, description: "Autocomplete Menu"}, + guildSettings: {value: true, description: "Server Settings"}, + quickSwitcher: {value: true, description: "Quick Switcher"}, + searchPopout: {value: true, description: "Search Popout"}, + userAccount: {value: true, description: "Your Account Information"}, appTitle: {value: true, description: "Discord App Title (DMs)"} } }; diff --git a/Plugins/EmojiStatistics/EmojiStatistics.plugin.js b/Plugins/EmojiStatistics/EmojiStatistics.plugin.js index 8d40a369ea..5623f17f9c 100644 --- a/Plugins/EmojiStatistics/EmojiStatistics.plugin.js +++ b/Plugins/EmojiStatistics/EmojiStatistics.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/FriendNotifications/FriendNotifications.plugin.js b/Plugins/FriendNotifications/FriendNotifications.plugin.js index 348c41b10b..77dd65fbc4 100644 --- a/Plugins/FriendNotifications/FriendNotifications.plugin.js +++ b/Plugins/FriendNotifications/FriendNotifications.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -222,11 +227,11 @@ module.exports = (_ => { this.defaults = { general: { - addOnlineCount: {value: true, description: "Adds an Online Friend Counter to the Server List (Click to open Time Log)"}, - showDiscriminator: {value: false, description: "Adds the User Discriminator"}, - showTimestamp: {value: false, description: "Adds the Timestamp"}, + addOnlineCount: {value: true, description: "Adds an Online Friend Counter to the Server List (Click to open Time Log)"}, + showDiscriminator: {value: false, description: "Adds the User Discriminator"}, + showTimestamp: {value: false, description: "Adds the Timestamp"}, muteOnDND: {value: false, description: "Does not notify you when you are in DnD Status"}, - openOnClick: {value: false, description: "Opens the DM when you click a Notification"} + openOnClick: {value: false, description: "Opens the DM when you click a Notification"} }, notificationStrings: { online: {value: "$user changed status to '$status'"}, @@ -235,18 +240,18 @@ module.exports = (_ => { playing: {value: "$user started playing '$game'"}, listening: {value: "$user started listening to '$song'"}, streaming: {value: "$user started streaming '$game'"}, - screensharing: {value: "$user started screensharing"}, + screensharing: {value: "$user started screensharing"}, offline: {value: "$user changed status to '$status'"}, login: {value: "$user just logged in '$status'"}, custom: {value: "$user changed status to '$custom'"} }, notificationSounds: {}, dates: { - logDate: {value: {}, description: "Log Timestamp"}, + logDate: {value: {}, description: "Log Timestamp"}, }, amounts: { - toastTime: {value: 5, min: 1, description: "Amount of Seconds a Toast Notification stays on Screen: "}, - checkInterval: {value: 10, min: 5, description: "Checks Users every X Seconds: "} + toastTime: {value: 5, min: 1, description: "Amount of Seconds a Toast Notification stays on Screen: "}, + checkInterval: {value: 10, min: 5, description: "Checks Users every X Seconds: "} } }; diff --git a/Plugins/GameActivityToggle/GameActivityToggle.plugin.js b/Plugins/GameActivityToggle/GameActivityToggle.plugin.js index 5c445753f4..55fefa8ec9 100644 --- a/Plugins/GameActivityToggle/GameActivityToggle.plugin.js +++ b/Plugins/GameActivityToggle/GameActivityToggle.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -88,14 +93,14 @@ module.exports = (_ => { this.defaults = { general: { - showButton: {value: true, description: "Show Quick Toggle Button"}, - showItem: {value: false, description: "Show Quick Toggle Item"}, - playEnable: {value: true, description: "Play Enable Sound"}, - playDisable: {value: true, description: "Play Disable Sound"} + showButton: {value: true, description: "Show Quick Toggle Button"}, + showItem: {value: false, description: "Show Quick Toggle Item"}, + playEnable: {value: true, description: "Play Enable Sound"}, + playDisable: {value: true, description: "Play Disable Sound"} }, selections: { - enableSound: {value: "stream_started", description: "Enable Sound"}, - disableSound: {value: "stream_ended", description: "Disable Sound"} + enableSound: {value: "stream_started", description: "Enable Sound"}, + disableSound: {value: "stream_ended", description: "Disable Sound"} } }; diff --git a/Plugins/GoogleSearchReplace/GoogleSearchReplace.plugin.js b/Plugins/GoogleSearchReplace/GoogleSearchReplace.plugin.js index ec8f84a9dd..b2cdaade77 100644 --- a/Plugins/GoogleSearchReplace/GoogleSearchReplace.plugin.js +++ b/Plugins/GoogleSearchReplace/GoogleSearchReplace.plugin.js @@ -27,9 +27,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -64,31 +69,31 @@ module.exports = (_ => { onLoad () { this.defaults = { engines: { - _all: {value: true, name: BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL, url: null}, - Amazon: {value: false, name: "Amazon", url: "https://www.amazon.com/s?k="}, - Ask: {value: true, name: "Ask", url: "https://ask.com/web?q="}, - Bing: {value: true, name: "Bing", url: "https://www.bing.com/search?q="}, - Brave: {value: true, name: "Brave", url: "https://search.brave.com/search?q="}, - DogPile: {value: false, name: "DogPile", url: "http://www.dogpile.com/search/web?q="}, - DuckDuckGo: {value: true, name: "DuckDuckGo", url: "https://duckduckgo.com/?q="}, - Ecosia: {value: false, name: "Ecosia", url: "https://www.ecosia.org/search?q="}, - Facebook: {value: true, name: "Facebook", url: "https://www.facebook.com/search/top/?q="}, - GitHub: {value: false, name: "GitHub", url: "https://github.com/search?q="}, - Google: {value: true, name: "Google", url: "https://www.google.com/search?q="}, - GoogleScholar: {value: false, name: "Google Scholar", url: "https://scholar.google.com/scholar?q="}, - Linkedin: {value: false, name: "Linkedin", url: "https://www.linkedin.com/search/results/all/?keywords="}, - Pinterest: {value: true, name: "Pinterest", url: "https://www.pinterest.com/search/pins/?q="}, - Quora: {value: true, name: "Quora", url: "https://www.quora.com/search?q="}, - Qwant: {value: false, name: "Qwant", url: "https://www.qwant.com/?t=all&q="}, - Searx: {value: false, name: "Searx", url: "https://searx.info/?q="}, - StackOverflow: {value: true, name: "Stack Overflow", url: "https://stackoverflow.com/search?q="}, - Startpage: {value: false, name: "Startpage", url: "https://www.startpage.com/sp/search?q="}, - UrbanDictionary: {value: false, name: "Urban Dictionary", url: "https://www.urbandictionary.com/define.php?term="}, - Whoogle: {value: false, name: "Whoogle", url: "https://search.sethforprivacy.com/search?q="}, - WolframAlpha: {value: false, name: "Wolfram Alpha", url: "https://www.wolframalpha.com/input/?i="}, - Yahoo: {value: true, name: "Yahoo", url: "https://search.yahoo.com/search?p="}, - Yandex: {value: true, name: "Yandex", url: "https://yandex.com/search/?text="}, - YouTube: {value: false, name: "YouTube", url: "https://www.youtube.com/results?q="} + _all: {value: true, name: BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL, url: null}, + Amazon: {value: false, name: "Amazon", url: "https://www.amazon.com/s?k="}, + Ask: {value: true, name: "Ask", url: "https://ask.com/web?q="}, + Bing: {value: true, name: "Bing", url: "https://www.bing.com/search?q="}, + Brave: {value: true, name: "Brave", url: "https://search.brave.com/search?q="}, + DogPile: {value: false, name: "DogPile", url: "http://www.dogpile.com/search/web?q="}, + DuckDuckGo: {value: true, name: "DuckDuckGo", url: "https://duckduckgo.com/?q="}, + Ecosia: {value: false, name: "Ecosia", url: "https://www.ecosia.org/search?q="}, + Facebook: {value: true, name: "Facebook", url: "https://www.facebook.com/search/top/?q="}, + GitHub: {value: false, name: "GitHub", url: "https://github.com/search?q="}, + Google: {value: true, name: "Google", url: "https://www.google.com/search?q="}, + GoogleScholar: {value: false, name: "Google Scholar", url: "https://scholar.google.com/scholar?q="}, + Linkedin: {value: false, name: "Linkedin", url: "https://www.linkedin.com/search/results/all/?keywords="}, + Pinterest: {value: true, name: "Pinterest", url: "https://www.pinterest.com/search/pins/?q="}, + Quora: {value: true, name: "Quora", url: "https://www.quora.com/search?q="}, + Qwant: {value: false, name: "Qwant", url: "https://www.qwant.com/?t=all&q="}, + Searx: {value: false, name: "Searx", url: "https://searx.info/?q="}, + StackOverflow: {value: true, name: "Stack Overflow", url: "https://stackoverflow.com/search?q="}, + Startpage: {value: false, name: "Startpage", url: "https://www.startpage.com/sp/search?q="}, + UrbanDictionary: {value: false, name: "Urban Dictionary", url: "https://www.urbandictionary.com/define.php?term="}, + Whoogle: {value: false, name: "Whoogle", url: "https://search.sethforprivacy.com/search?q="}, + WolframAlpha: {value: false, name: "Wolfram Alpha", url: "https://www.wolframalpha.com/input/?i="}, + Yahoo: {value: true, name: "Yahoo", url: "https://search.yahoo.com/search?p="}, + Yandex: {value: true, name: "Yandex", url: "https://yandex.com/search/?text="}, + YouTube: {value: false, name: "YouTube", url: "https://www.youtube.com/results?q="} } }; } diff --git a/Plugins/HideMutedCategories/HideMutedCategories.plugin.js b/Plugins/HideMutedCategories/HideMutedCategories.plugin.js index 8eb6854ab4..db6efbc740 100644 --- a/Plugins/HideMutedCategories/HideMutedCategories.plugin.js +++ b/Plugins/HideMutedCategories/HideMutedCategories.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/ImageUtilities/ImageUtilities.plugin.js b/Plugins/ImageUtilities/ImageUtilities.plugin.js index 4e0f78be6b..dad30f6894 100644 --- a/Plugins/ImageUtilities/ImageUtilities.plugin.js +++ b/Plugins/ImageUtilities/ImageUtilities.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -65,8 +70,6 @@ module.exports = (_ => { var cachedImages; var eventTypes = {}; - const imgUrlReplaceString = "DEVILBRO_BD_REVERSEIMAGESEARCH_REPLACE_IMAGEURL"; - const rescaleOptions = { NONE: "No Resize", ORIGINAL: "Resize to Original Size", @@ -205,7 +208,7 @@ module.exports = (_ => { }, viewerSettings: { zoomMode: {value: true, description: "Enables Zoom Mode to zoom into Images while holding down your Mouse"}, - galleryMode: {value: true, description: "Enables Gallery Mode to quick-switch between Images"}, + galleryMode: {value: true, description: "Enables Gallery Mode to quick-switch between Images"}, details: {value: true, description: "Adds Image Details (Name, Size, Amount)"}, copyImage: {value: true, description: "Adds a 'Copy Image' Option"}, saveImage: {value: true, description: "Adds a 'Save Image as' Option"}, @@ -216,39 +219,39 @@ module.exports = (_ => { pixelMode: {value: false, label: "Uses Pixel Lens instead of a Blur Lens"}, clickMode: {value: false, label: "Click Image to zoom instead of holding the Mouse Button"}, lensSize: {value: 200, digits: 0, minValue: 50, maxValue: 5000, unit: "px", label: "context_lenssize"}, - zoomLevel: {value: 2, digits: 1, minValue: 1, maxValue: 20, unit: "x", label: "ACCESSIBILITY_ZOOM_LEVEL_LABEL"}, + zoomLevel: {value: 2, digits: 1, minValue: 1, maxValue: 20, unit: "x", label: "ACCESSIBILITY_ZOOM_LEVEL_LABEL"}, zoomSpeed: {value: 0.1, digits: 2, minValue: 0.01, maxValue: 1, unit: "", label: "context_zoomspeed"} }, rescaleSettings: { messages: {value: "NONE", description: "Messages"}, - imageViewer: {value: "NONE", description: "Image Viewer"} + imageViewer: {value: "NONE", description: "Image Viewer"} }, detailsSettings: { footnote: {value: true, description: "in the Image Description"}, tooltip: {value: false, description: "as a Hover Tooltip"}, - tooltipDelay: {value: 0, min: 0, description: "Image Tooltip Delay (in ms)"} + tooltipDelay: {value: 0, min: 0, description: "Image Tooltip Delay (in ms)"} }, places: { - userAvatars: {value: true, description: "User Avatars"}, - groupIcons: {value: true, description: "Group Icons"}, - guildIcons: {value: true, description: "Server Icons"}, - streamPreviews: {value: true, description: "Stream Previews"}, + userAvatars: {value: true, description: "User Avatars"}, + groupIcons: {value: true, description: "Group Icons"}, + guildIcons: {value: true, description: "Server Icons"}, + streamPreviews: {value: true, description: "Stream Previews"}, emojis: {value: true, description: "Custom Emojis/Emotes"} }, engines: { _all: {value: true, name: BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL, url: null}, - Baidu: {value: true, name: "Baidu", url: "http://image.baidu.com/pcdutu?queryImageUrl=" + imgUrlReplaceString}, - Bing: {value: true, name: "Bing", url: "https://www.bing.com/images/search?q=imgurl:" + imgUrlReplaceString + "&view=detailv2&iss=sbi&FORM=IRSBIQ"}, - Google: {value: true, name: "Google", url: "https://www.google.com/searchbyimage?sbisrc=cr_1&image_url=" + imgUrlReplaceString}, - GoogleLens: {value: true, name: "Google Lens", url: "https://lens.google.com/uploadbyurl?url=" + imgUrlReplaceString}, - ImgOps: {value: true, name: "ImgOps", raw: true, url: "https://imgops.com/specialized+reverse/" + imgUrlReplaceString}, - IQDB: {value: true, name: "IQDB", url: "https://iqdb.org/?url=" + imgUrlReplaceString}, - Reddit: {value: true, name: "Reddit", url: "http://karmadecay.com/search?q=" + imgUrlReplaceString}, - SauceNAO: {value: true, name: "SauceNAO", url: "https://saucenao.com/search.php?db=999&url=" + imgUrlReplaceString}, - Sogou: {value: true, name: "Sogou", url: "http://pic.sogou.com/ris?flag=1&drag=0&query=" + imgUrlReplaceString + "&flag=1"}, - TinEye: {value: true, name: "TinEye", url: "https://tineye.com/search?url=" + imgUrlReplaceString}, - WhatAnime: {value: true, name: "WhatAnime", url: "https://trace.moe/?url=" + imgUrlReplaceString}, - Yandex: {value: true, name: "Yandex", url: "https://yandex.com/images/search?url=" + imgUrlReplaceString + "&rpt=imageview"} + Baidu: {value: true, name: "Baidu", url: "http://image.baidu.com/pcdutu?queryImageUrl="}, + Bing: {value: true, name: "Bing", url: "https://www.bing.com/images/search?view=detailv2&iss=sbi&FORM=IRSBIQ&q=imgurl:"}, + Google: {value: true, name: "Google", url: "https://www.google.com/searchbyimage?sbisrc=cr_1&image_url="}, + GoogleLens: {value: true, name: "Google Lens", url: "https://lens.google.com/uploadbyurl?url="}, + ImgOps: {value: true, name: "ImgOps", raw: true, url: "https://imgops.com/specialized+reverse/"}, + IQDB: {value: true, name: "IQDB", url: "https://iqdb.org/?url="}, + Reddit: {value: true, name: "Reddit", url: "http://karmadecay.com/search?q="}, + SauceNAO: {value: true, name: "SauceNAO", url: "https://saucenao.com/search.php?db=999&url="}, + Sogou: {value: true, name: "Sogou", url: "http://pic.sogou.com/ris?flag=1&drag=0&flag=1&query="}, + TinEye: {value: true, name: "TinEye", url: "https://tineye.com/search?url="}, + WhatAnime: {value: true, name: "WhatAnime", url: "https://trace.moe/?url="}, + Yandex: {value: true, name: "Yandex", url: "https://yandex.com/images/search?rpt=imageview&url="} } }; @@ -922,7 +925,7 @@ module.exports = (_ => { persisting: true, action: event => { if (!event.shiftKey) BDFDB.ContextMenuUtils.close(instance); - BDFDB.DiscordUtils.openLink(this.defaults.engines[engineKeys[0]].url.replace(imgUrlReplaceString, encodeURIComponent(urlData.original)), { + BDFDB.DiscordUtils.openLink(this.defaults.engines[engineKeys[0]].url + encodeURIComponent(urlData.original), { minimized: event.shiftKey }); } diff --git a/Plugins/LastMessageDate/LastMessageDate.plugin.js b/Plugins/LastMessageDate/LastMessageDate.plugin.js index 24d5201aa2..bc4cb771ee 100644 --- a/Plugins/LastMessageDate/LastMessageDate.plugin.js +++ b/Plugins/LastMessageDate/LastMessageDate.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -133,7 +138,7 @@ module.exports = (_ => { this.defaults = { places: { - userPopout: {value: true, description: "User Popouts"}, + userPopout: {value: true, description: "User Popouts"}, userProfile: {value: true, description: "User Profile Modal"} }, dates: { diff --git a/Plugins/MessageUtilities/MessageUtilities.plugin.js b/Plugins/MessageUtilities/MessageUtilities.plugin.js index d3eec18886..c3272b1cd0 100644 --- a/Plugins/MessageUtilities/MessageUtilities.plugin.js +++ b/Plugins/MessageUtilities/MessageUtilities.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -69,22 +74,22 @@ module.exports = (_ => { onLoad () { this.defaults = { general: { - "addHints": {value: true, description: "Add Key Combo hints to Context Menus"}, - "clearOnEscape": {value: true, description: "Clear Chat Input when Escape is pressed"} + "addHints": {value: true, description: "Add Key Combo hints to Context Menus"}, + "clearOnEscape": {value: true, description: "Clear Chat Input when Escape is pressed"} }, toasts: {}, bindingsState: {}, bindings: { - "Edit_Message": {name: "Edit Message", func: this.doEdit, value: {click: 1, keycombo: []} }, - "Delete_Message": {name: "Delete Message", func: this.doDelete, value: {click: 0, keycombo: [46]} }, - "Pin/Unpin_Message": {name: "Pin/Unpin Message", func: this.doPinUnPin, value: {click: 0, keycombo: [17]} }, - "Reply_to_Message": {name: "Reply to Message", func: this.doReply, value: {click: 0, keycombo: [17,72]} }, - "React_to_Message": {name: "Open React Menu", func: this.doOpenReact, value: {click: 0, keycombo: [17,83]} }, - "Copy_Raw": {name: "Copy raw Message", func: this.doCopyRaw, value: {click: 0, keycombo: [17,68]} }, - "Copy_Link": {name: "Copy Message Link", func: this.doCopyLink, value: {click: 0, keycombo: [17,81]} }, - "__Quote_Message": {name: "Quote Message", func: this.doQuote, value: {click: 0, keycombo: [17,87]}, plugin: "CustomQuoter"}, - "__Note_Message": {name: "Note Message", func: this.doNote, value: {click: 0, keycombo: [16]}, plugin: "PersonalPins"}, - "__Translate_Message": {name: "Translate Message", func: this.doTranslate, value: {click: 0, keycombo: [20]}, plugin: "Translator"} + "Edit_Message": {name: "Edit Message", func: this.doEdit, value: {click: 1, keycombo: []}}, + "Delete_Message": {name: "Delete Message", func: this.doDelete, value: {click: 0, keycombo: [46]}}, + "Pin/Unpin_Message": {name: "Pin/Unpin Message", func: this.doPinUnPin, value: {click: 0, keycombo: [17]}}, + "Reply_to_Message": {name: "Reply to Message", func: this.doReply, value: {click: 0, keycombo: [17,72]}}, + "React_to_Message": {name: "Open React Menu", func: this.doOpenReact, value: {click: 0, keycombo: [17,83]}}, + "Copy_Raw": {name: "Copy raw Message", func: this.doCopyRaw, value: {click: 0, keycombo: [17,68]}}, + "Copy_Link": {name: "Copy Message Link", func: this.doCopyLink, value: {click: 0, keycombo: [17,81]}}, + "__Quote_Message": {name: "Quote Message", func: this.doQuote, plugin: "CustomQuoter", value: {click: 0, keycombo: [17,87]}}, + "__Note_Message": {name: "Note Message", func: this.doNote, plugin: "PersonalPins", value: {click: 0, keycombo: [16]}}, + "__Translate_Message": {name: "Translate Message", func: this.doTranslate, plugin: "Translator", value: {click: 0, keycombo: [20]}} } }; diff --git a/Plugins/NotificationSounds/NotificationSounds.plugin.js b/Plugins/NotificationSounds/NotificationSounds.plugin.js index b4aaa6268f..af886306f8 100644 --- a/Plugins/NotificationSounds/NotificationSounds.plugin.js +++ b/Plugins/NotificationSounds/NotificationSounds.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/OldTitleBar/OldTitleBar.plugin.js b/Plugins/OldTitleBar/OldTitleBar.plugin.js index e9b459e678..a596581d54 100644 --- a/Plugins/OldTitleBar/OldTitleBar.plugin.js +++ b/Plugins/OldTitleBar/OldTitleBar.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -122,8 +127,8 @@ module.exports = (_ => { this.defaults = { general: { - addToSettings: {value: true, description: "Adds a Titlebar to Settings Windows"}, - reloadButton: {value: true, description: "Adds a Reload Button to the Titlebar"} + addToSettings: {value: true, description: "Adds a Titlebar to Settings Windows"}, + reloadButton: {value: true, description: "Adds a Reload Button to the Titlebar"} } }; diff --git a/Plugins/OpenSteamLinksInApp/OpenSteamLinksInApp.plugin.js b/Plugins/OpenSteamLinksInApp/OpenSteamLinksInApp.plugin.js index 07a9174d6d..7e2fa76482 100644 --- a/Plugins/OpenSteamLinksInApp/OpenSteamLinksInApp.plugin.js +++ b/Plugins/OpenSteamLinksInApp/OpenSteamLinksInApp.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/PersonalPins/PersonalPins.plugin.js b/Plugins/PersonalPins/PersonalPins.plugin.js index 771957fa52..4049768bb7 100644 --- a/Plugins/PersonalPins/PersonalPins.plugin.js +++ b/Plugins/PersonalPins/PersonalPins.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -364,7 +369,7 @@ module.exports = (_ => { this.defaults = { choices: { - defaultFilter: {value: filterKeys[0], options: filterKeys, type: "filter", description: "Default choice tab"}, + defaultFilter: {value: filterKeys[0], options: filterKeys, type: "filter", description: "Default choice tab"}, defaultSort: {value: sortKeys[0], options: sortKeys, type: "sort", description: "Default sort choice"}, defaultOrder: {value: orderKeys[0], options: orderKeys, type: "order", description: "Default order choice"}, } diff --git a/Plugins/PluginRepo/PluginRepo.plugin.js b/Plugins/PluginRepo/PluginRepo.plugin.js index 09da84f6b1..4a42a2e88f 100644 --- a/Plugins/PluginRepo/PluginRepo.plugin.js +++ b/Plugins/PluginRepo/PluginRepo.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -584,8 +589,8 @@ module.exports = (_ => { startUpdated: {value: false, autoload: true, description: "Starts updated Plugins after Download"} }, filters: { - updated: {value: true, description: "Updated"}, - outdated: {value: true, description: "Outdated"}, + updated: {value: true, description: "Updated"}, + outdated: {value: true, description: "Outdated"}, downloadable: {value: true, description: "Downloadable"}, } }; diff --git a/Plugins/QuickMention/QuickMention.plugin.js b/Plugins/QuickMention/QuickMention.plugin.js index 522c60743e..e0bf5dc11e 100644 --- a/Plugins/QuickMention/QuickMention.plugin.js +++ b/Plugins/QuickMention/QuickMention.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js b/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js index 4eb028d97d..ee7618a054 100644 --- a/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js +++ b/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -139,9 +144,9 @@ module.exports = (_ => { confirmClear: {value: false, description: "Asks for your confirmation before clearing reads"} }, batch: { - guilds: {value: true, description: "unread Servers"}, - muted: {value: false, description: "muted unread Servers"}, - dms: {value: false, description: "unread DMs"} + guilds: {value: true, description: "unread Servers"}, + muted: {value: false, description: "muted unread Servers"}, + dms: {value: false, description: "unread DMs"} } }; diff --git a/Plugins/RemoveBlockedUsers/RemoveBlockedUsers.plugin.js b/Plugins/RemoveBlockedUsers/RemoveBlockedUsers.plugin.js index ed2c2955b2..a71115bd42 100644 --- a/Plugins/RemoveBlockedUsers/RemoveBlockedUsers.plugin.js +++ b/Plugins/RemoveBlockedUsers/RemoveBlockedUsers.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -73,12 +78,12 @@ module.exports = (_ => { mentions: {value: true, description: "Mentions"}, reactions: {value: true, description: "Reactions"}, threads: {value: true, description: "Threads"}, - autocompletes: {value: true, description: "Autocomplete Entries"}, + 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"}, activity: {value: true, description: "Activity Page"}, - channelList: {value: true, description: "Channel/Group List"}, + channelList: {value: true, description: "Channel/Group List"}, recentDms: {value: true, description: "Group Notifications"} } }; diff --git a/Plugins/RemoveNicknames/RemoveNicknames.plugin.js b/Plugins/RemoveNicknames/RemoveNicknames.plugin.js index 6914fa13b4..ef4220ae7c 100644 --- a/Plugins/RemoveNicknames/RemoveNicknames.plugin.js +++ b/Plugins/RemoveNicknames/RemoveNicknames.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -60,18 +65,18 @@ module.exports = (_ => { onLoad () { this.defaults = { general: { - replaceOwn: {value: false, description: "Replaces your own Name"}, + replaceOwn: {value: false, description: "Replaces your own Name"}, replaceBots: {value: true, description: "Replaces the Nickname of Bots"}, removeGlobal: {value: true, description: "Also removes global Displaynames"}, addNickname: {value: false, description: "Adds Nickname as Parentheses"}, swapPositions: {value: false, description: "Swaps the Position of Username and Nickname"}, }, places: { - chat: {value: true, description: "Messages"}, - mentions: {value: true, description: "Mentions"}, - voiceChat: {value: true, description: "Voice Channels"}, - memberList: {value: true, description: "Member List"}, - typing: {value: true, description: "Typing List"}, + chat: {value: true, description: "Messages"}, + mentions: {value: true, description: "Mentions"}, + voiceChat: {value: true, description: "Voice Channels"}, + memberList: {value: true, description: "Member List"}, + typing: {value: true, description: "Typing List"}, autocompletes: {value: true, description: "Autocomplete Menu"} } }; diff --git a/Plugins/RevealAllSpoilers/RevealAllSpoilers.plugin.js b/Plugins/RevealAllSpoilers/RevealAllSpoilers.plugin.js index 02ee6623b9..37da4eddf1 100644 --- a/Plugins/RevealAllSpoilers/RevealAllSpoilers.plugin.js +++ b/Plugins/RevealAllSpoilers/RevealAllSpoilers.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/ServerCounter/ServerCounter.plugin.js b/Plugins/ServerCounter/ServerCounter.plugin.js index 0cd4127d1a..c99c51bb3c 100644 --- a/Plugins/ServerCounter/ServerCounter.plugin.js +++ b/Plugins/ServerCounter/ServerCounter.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/ServerDetails/ServerDetails.plugin.js b/Plugins/ServerDetails/ServerDetails.plugin.js index 147be31816..f9ed02447f 100644 --- a/Plugins/ServerDetails/ServerDetails.plugin.js +++ b/Plugins/ServerDetails/ServerDetails.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -188,15 +193,15 @@ module.exports = (_ => { onlyShowOnShift: {value: false, description: "Only show the Details Tooltip, while holding 'Shift'"} }, items: { - icon: {value: true, description: "icon"}, - owner: {value: true, description: "GUILD_OWNER"}, + icon: {value: true, description: "icon"}, + owner: {value: true, description: "GUILD_OWNER"}, creationDate: {value: true, description: "creation_date"}, - joinDate: {value: true, description: "join_date"}, - members: {value: true, description: "MEMBERS"}, - channels: {value: true, description: "CHANNELS"}, - roles: {value: true, description: "ROLES"}, - boosts: {value: true, description: "boosts"}, - language: {value: true, description: "LANGUAGE"} + joinDate: {value: true, description: "join_date"}, + members: {value: true, description: "MEMBERS"}, + channels: {value: true, description: "CHANNELS"}, + roles: {value: true, description: "ROLES"}, + boosts: {value: true, description: "boosts"}, + language: {value: true, description: "LANGUAGE"} }, dates: { tooltipDates: {value: {}, description: "Tooltip Dates"} @@ -205,7 +210,7 @@ module.exports = (_ => { tooltipColor: {value: "", description: "Tooltip Color"} }, amounts: { - tooltipDelay: {value: 0, min: 0, max: 10, digits: 1, unit: "s", description: "Tooltip Delay"}, + tooltipDelay: {value: 0, min: 0, max: 10, digits: 1, unit: "s", description: "Tooltip Delay"}, tooltipWidth: {value: 300, min: 200, max: 600, digits: 0, unit: "px", description: "Tooltip Width"} } }; diff --git a/Plugins/ServerFolders/ServerFolders.plugin.js b/Plugins/ServerFolders/ServerFolders.plugin.js index 9e73a597a5..b268517d7a 100644 --- a/Plugins/ServerFolders/ServerFolders.plugin.js +++ b/Plugins/ServerFolders/ServerFolders.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -452,7 +457,7 @@ module.exports = (_ => { extraColumn: {value: true, description: "Moves the Servers from opened Folders into an extra Column"}, addSeparators: {value: true, description: "Adds Separators between Servers of different Folders in extra Column"}, addFolderIcon: {value: false, description: "Adds the Folder Icon on the top of the Server List in the extra Column"}, - addFolderBackground: {value: false, description: "Adds a Folder Background behind a Group of Servers in the extra Column"} + addFolderBackground: {value: false, description: "Adds a Folder Background behind a Group of Servers in the extra Column"} } }; diff --git a/Plugins/ServerHider/ServerHider.plugin.js b/Plugins/ServerHider/ServerHider.plugin.js index b5ef6eba5e..cf0eb3a304 100644 --- a/Plugins/ServerHider/ServerHider.plugin.js +++ b/Plugins/ServerHider/ServerHider.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js b/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js index d86430055f..e099c6312c 100644 --- a/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js +++ b/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/ShowConnections/ShowConnections.plugin.js b/Plugins/ShowConnections/ShowConnections.plugin.js index 69b6a21d48..1ebe2f7b15 100644 --- a/Plugins/ShowConnections/ShowConnections.plugin.js +++ b/Plugins/ShowConnections/ShowConnections.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/SpellCheck/SpellCheck.plugin.js b/Plugins/SpellCheck/SpellCheck.plugin.js index 178cfaf7cc..2d5276ab87 100644 --- a/Plugins/SpellCheck/SpellCheck.plugin.js +++ b/Plugins/SpellCheck/SpellCheck.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -69,14 +74,14 @@ module.exports = (_ => { this.defaults = { general: { - downloadDictionary: {value: false, description: "Use local Dictionary File (downloads Dictionary on first Usage)"} + downloadDictionary: {value: false, description: "Use local Dictionary File (downloads Dictionary on first Usage)"} }, choices: { - dictionaryLanguage: {value: "en", force: true, description: "Primary Language"}, - secondaryLanguage: {value: "-", force: false, description: "Secondary Language"} + dictionaryLanguage: {value: "en", force: true, description: "Primary Language"}, + secondaryLanguage: {value: "-", force: false, description: "Secondary Language"} }, amounts: { - maxSimilarAmount: {value: 6, min: 1, max: 30, description: "Maximal Amount of suggested Words"} + maxSimilarAmount: {value: 6, min: 1, max: 30, description: "Maximal Amount of suggested Words"} } }; diff --git a/Plugins/SplitLargeMessages/SplitLargeMessages.plugin.js b/Plugins/SplitLargeMessages/SplitLargeMessages.plugin.js index 04cab7e973..8921c9f10f 100644 --- a/Plugins/SplitLargeMessages/SplitLargeMessages.plugin.js +++ b/Plugins/SplitLargeMessages/SplitLargeMessages.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -63,11 +68,11 @@ module.exports = (_ => { onLoad () { this.defaults = { general: { - byNewlines: {value: false, description: "Try to split Messages on Newlines instead of Spaces", note: "This will stop Sentences from being cut, but might result in more Messages being sent"}, + byNewlines: {value: false, description: "Try to split Messages on Newlines instead of Spaces", note: "This will stop Sentences from being cut, but might result in more Messages being sent"}, }, amounts: { - splitCounter: {value: 0, description: "Messages will be split after roughly X Characters"}, - maxPages: {value: 0, description: "Maximum number of split pages", note: "(0 for unlimited) Pages beyond this count will be discarded"} + splitCounter: {value: 0, description: "Messages will be split after roughly X Characters"}, + maxPages: {value: 0, description: "Maximum number of split pages", note: "(0 for unlimited) Pages beyond this count will be discarded"} } }; diff --git a/Plugins/SpotifyControls/SpotifyControls.plugin.js b/Plugins/SpotifyControls/SpotifyControls.plugin.js index 3d2df9b835..05062d71e5 100644 --- a/Plugins/SpotifyControls/SpotifyControls.plugin.js +++ b/Plugins/SpotifyControls/SpotifyControls.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -439,19 +444,19 @@ module.exports = (_ => { this.defaults = { general: { - addBy: {value: true, description: "Adds the Word 'by' infront of the Author Name"}, + addBy: {value: true, description: "Adds the Word 'by' infront of the Author Name"}, addTimeline: {value: true, description: "Shows the Song Timeline in the Controls"}, addActivityButton: {value: true, description: "Shows the Activity Status Toggle Button in the Controls"}, doubleBack: {value: true, description: "Requires the User to press the Back Button twice to go to previous Track"} }, buttons: { - share: {value: {small: false, big: true}, icons: [""], description: "Share"}, - shuffle: {value: {small: false, big: true}, icons: [""], description: "Shuffle"}, - previous: {value: {small: true, big: true}, icons: [""], description: "Previous"}, - pauseplay: {value: {small: true, big: true}, icons: ["", ""], description: "Pause/Play"}, - next: {value: {small: true, big: true}, icons: [""], description: "Next"}, - repeat: {value: {small: false, big: true}, icons: ["", ""], description: "Repeat"}, - volume: {value: {small: false, big: true}, icons: ["", "", "", ""], description: "Volume"} + share: {value: {small: false, big: true}, icons: [""], description: "Share"}, + shuffle: {value: {small: false, big: true}, icons: [""], description: "Shuffle"}, + previous: {value: {small: true, big: true}, icons: [""], description: "Previous"}, + pauseplay: {value: {small: true, big: true}, icons: ["", ""], description: "Pause/Play"}, + next: {value: {small: true, big: true}, icons: [""], description: "Next"}, + repeat: {value: {small: false, big: true}, icons: ["", ""], description: "Repeat"}, + volume: {value: {small: false, big: true}, icons: ["", "", "", ""], description: "Volume"} } }; diff --git a/Plugins/StaffTag/StaffTag.plugin.js b/Plugins/StaffTag/StaffTag.plugin.js index 30a3fbe2dd..49f8d867b4 100644 --- a/Plugins/StaffTag/StaffTag.plugin.js +++ b/Plugins/StaffTag/StaffTag.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -103,18 +108,18 @@ module.exports = (_ => { this.defaults = { general: { - useCrown: {value: true, description: "Uses the Crown Icon instead of the Bot Tag Style"}, + useCrown: {value: true, description: "Uses the Crown Icon instead of the Bot Tag Style"}, useRoleColor: {value: true, description: "Uses the Role Color instead of the default Blurple"}, useBlackFont: {value: false, description: "Uses black Font instead of darkening the Role Color on bright Colors"}, - ignoreBots: {value: false, description: "Doesn't add the Owner/Admin/Management Tag for Bots"}, + ignoreBots: {value: false, description: "Doesn't add the Owner/Admin/Management Tag for Bots"}, ignoreMyself: {value: false, description: "Doesn't add the Owner/Admin/Management Tag for yourself"} }, tagTypes: { - owners: {value: true, description: "Server Owner Tag"}, + owners: {value: true, description: "Server Owner Tag"}, groupOwners: {value: true, description: "Group Owner Tag"}, threadCreators: {value: true, description: "Thread Creator Tag"}, forumCreators: {value: true, description: "Forum Creator Tag"}, - admins: {value: true, description: "Admin Tag (Admin Permissions)"}, + admins: {value: true, description: "Admin Tag (Admin Permissions)"}, managementG: {value: true, description: "Management Tag (Server Management)"}, managementC: {value: true, description: "Management Tag (Channel Management)"}, managementT: {value: true, description: "Management Tag (Threads Management)"}, @@ -125,19 +130,19 @@ module.exports = (_ => { managementM: {value: true, description: "Management Tag (Message Management)"} }, tagPlaces: { - chat: {value: true, description: "Messages"}, - memberList: {value: true, description: "Member List"}, - voiceList: {value: true, description: "Voice User List"}, - userPopout: {value: true, description: "User Popouts"}, + chat: {value: true, description: "Messages"}, + memberList: {value: true, description: "Member List"}, + voiceList: {value: true, description: "Voice User List"}, + userPopout: {value: true, description: "User Popouts"}, userProfile: {value: true, description: "User Profile Modal"}, }, customTitles: { - owner: {value: "", placeholder: "Owner", description: "Server Owner Tags"}, - groupOwner: {value: "", placeholder: "Group Owner", description: "Group Owner Tags"}, - forumCreator: {value: "", placeholder: "Creator", description: "Forum Creator Tags"}, - threadCreator: {value: "", placeholder: "Creator", description: "Thread Creator Tags"}, - admin: {value: "", placeholder: "Admin", description: "Admin Tags"}, - management: {value: "", placeholder: "Management", description: "Management Tags"} + owner: {value: "", placeholder: "Owner", description: "Server Owner Tags"}, + groupOwner: {value: "", placeholder: "Group Owner", description: "Group Owner Tags"}, + forumCreator: {value: "", placeholder: "Creator", description: "Forum Creator Tags"}, + threadCreator: {value: "", placeholder: "Creator", description: "Thread Creator Tags"}, + admin: {value: "", placeholder: "Admin", description: "Admin Tags"}, + management: {value: "", placeholder: "Management", description: "Management Tags"} } }; diff --git a/Plugins/ThemeRepo/ThemeRepo.plugin.js b/Plugins/ThemeRepo/ThemeRepo.plugin.js index 25b101ab09..b60b80e8bd 100644 --- a/Plugins/ThemeRepo/ThemeRepo.plugin.js +++ b/Plugins/ThemeRepo/ThemeRepo.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -725,8 +730,8 @@ module.exports = (_ => { startUpdated: {value: false, autoload: true, description: "Starts updated Themes after Download"} }, filters: { - updated: {value: true, description: "Updated"}, - outdated: {value: true, description: "Outdated"}, + updated: {value: true, description: "Updated"}, + outdated: {value: true, description: "Outdated"}, downloadable: {value: true, description: "Downloadable"}, } }; diff --git a/Plugins/TimedLightDarkMode/TimedLightDarkMode.plugin.js b/Plugins/TimedLightDarkMode/TimedLightDarkMode.plugin.js index 8e1cf5f846..2da65d1ab5 100644 --- a/Plugins/TimedLightDarkMode/TimedLightDarkMode.plugin.js +++ b/Plugins/TimedLightDarkMode/TimedLightDarkMode.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/TopRoleEverywhere/TopRoleEverywhere.plugin.js b/Plugins/TopRoleEverywhere/TopRoleEverywhere.plugin.js index 6391347c1f..b986f100e1 100644 --- a/Plugins/TopRoleEverywhere/TopRoleEverywhere.plugin.js +++ b/Plugins/TopRoleEverywhere/TopRoleEverywhere.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -65,13 +70,13 @@ module.exports = (_ => { includeColorless: {value: false, description: "Includes colorless Roles"}, showOwnerRole: {value: false, description: `Displays Role Tag of Server Owner as "${BDFDB.LanguageUtils.LanguageStrings.GUILD_OWNER}".`}, disableForBots: {value: false, description: "Disables Role Tag for Bots"}, - addUserId: {value: false, description: "Adds the User Id as a Tag to the Chat Window"}, + addUserId: {value: false, description: "Adds the User Id as a Tag to the Chat Window"}, userIdFirst: {value: false, description: "Places the User Id before the Role Tag"} }, places: { - chat: {value: true, description: "Chat Window"}, - memberList: {value: true, description: "Member List"}, - voiceList: {value: true, description: "Voice User List"}, + chat: {value: true, description: "Chat Window"}, + memberList: {value: true, description: "Member List"}, + voiceList: {value: true, description: "Voice User List"}, } }; diff --git a/Plugins/Translator/Translator.plugin.js b/Plugins/Translator/Translator.plugin.js index 903aa1a99e..1762c7893c 100644 --- a/Plugins/Translator/Translator.plugin.js +++ b/Plugins/Translator/Translator.plugin.js @@ -27,9 +27,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -385,17 +390,17 @@ module.exports = (_ => { this.defaults = { general: { addTranslateButton: {value: true, popout: false}, - usePerChatTranslation: {value: true, popout: false}, - sendOriginalMessage: {value: false, popout: true}, - showOriginalMessage: {value: false, popout: true} + usePerChatTranslation: {value: true, popout: false}, + sendOriginalMessage: {value: false, popout: true}, + showOriginalMessage: {value: false, popout: true} }, choices: {}, exceptions: { - wordStart: {value: ["!"], max: 1} + wordStart: {value: ["!"], max: 1} }, engines: { - translator: {value: "googleapi"}, - backup: {value: "----"} + translator: {value: "googleapi"}, + backup: {value: "----"} } }; for (let m in messageTypes) this.defaults.choices[messageTypes[m]] = {value: Object.keys(languageTypes).reduce((newObj, l) => (newObj[languageTypes[l]] = defaultLanguages[l], newObj), {})}; diff --git a/Plugins/UserNotes/UserNotes.plugin.js b/Plugins/UserNotes/UserNotes.plugin.js index db579fa60f..132bd71180 100644 --- a/Plugins/UserNotes/UserNotes.plugin.js +++ b/Plugins/UserNotes/UserNotes.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } diff --git a/Plugins/WriteUpperCase/WriteUpperCase.plugin.js b/Plugins/WriteUpperCase/WriteUpperCase.plugin.js index 38e932748b..f207839c9f 100644 --- a/Plugins/WriteUpperCase/WriteUpperCase.plugin.js +++ b/Plugins/WriteUpperCase/WriteUpperCase.plugin.js @@ -25,9 +25,14 @@ module.exports = (_ => { getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} downloadLibrary () { - require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { - if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); - else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); + BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => { + if (!r || r.status != 200) throw new Error(); + else return r.text(); + }).then(b => { + if (!b) throw new Error(); + else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); + }).catch(error => { + BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); }); } @@ -92,7 +97,7 @@ module.exports = (_ => { normal: {value: true, description: "Normal Message Textarea"}, edit: {value: true, description: "Edit Message Textarea"}, form: {value: true, description: "Upload Message Prompt"}, - quickmessage: {value: true, description: "Quick Message Textarea UserPopout"} + quickmessage: {value: true, description: "Quick Message Textarea UserPopout"} } };