aboutsummaryrefslogtreecommitdiff
path: root/features/globalSettings/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'features/globalSettings/index.js')
-rw-r--r--features/globalSettings/index.js37
1 files changed, 29 insertions, 8 deletions
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js
index c317eb4..25b2eaf 100644
--- a/features/globalSettings/index.js
+++ b/features/globalSettings/index.js
@@ -47,6 +47,7 @@ class GlobalSettings extends Feature {
this.reportErrorsSetting = new ToggleSetting("Send module errors to soopy server", "This will allow me to more effectivly fix them", false, "privacy_send_errors", this)
this.hideFallingBlocks = new ToggleSetting("Hide falling blocks", "NOTE: this may cause more lag because of render entity event", false, "hide_falling_sand", this)
+ this.twitchCommands = new ToggleSetting("Ingame twitch bot commands", "Allows u to use twitch bot commands ingame (eg -sa)", true, "twitch_commands_ingame", this)
this.privacySettings = [this.reportErrorsSetting]
@@ -84,11 +85,11 @@ class GlobalSettings extends Feature {
this.registerEvent("tick", this.fixNEU)
}
- try { //This enables links from soopymc.my.to to be shown in patcher image preview
+ try { //This enables links from soopy.dev to be shown in patcher image preview
let hasHost = false
for (let host of Java.type("gg.essential.util.TrustedHostsUtil").INSTANCE.getTrustedHosts()) {
- if (host.getName() === "soopymc") {
+ if (host.getName() === "soopy.dev") {
hasHost = true
}
}
@@ -97,9 +98,9 @@ class GlobalSettings extends Feature {
let TrustedHost = Java.type("gg.essential.api.utils.TrustedHostsUtil").TrustedHost
let TreeSet = Java.type("java.util.TreeSet")
let hosts = new TreeSet()
- hosts.add("soopymc.my.to")
+ hosts.add("soopy.dev")
- let host = new TrustedHost(124123, "soopymc", hosts)
+ let host = new TrustedHost(124123, "soopy.dev", hosts)
Java.type("gg.essential.util.TrustedHostsUtil").INSTANCE.addTrustedHost(host)
}
@@ -136,12 +137,32 @@ class GlobalSettings extends Feature {
cancel(e)
}
})
+
+ this.registerEvent("messageSent", (message, event) => {
+ if (!this.twitchCommands.getValue()) return
+
+ if (message.startsWith("-")) {
+ cancel(event)
+ fetch("http://soopy.dev/api/soopyv2/botcommand?m=" + encodeURIComponent(message.replace("-", "")) + "&u=" + Player.getName()).text(text => {
+ ChatLib.chat(this.FeatureManager.messagePrefix + "&7" + message)
+ let sendMessage = text
+ sendMessage = sendMessage.split(" ").map(a => {
+ if (a.match(/(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/igm)) {
+ return new TextComponent("&f&n" + a + ' ').setHover("show_text", "Click to open " + a).setClick("open_url", a)
+ } else {
+ return new TextComponent("&f" + a + ' ')
+ }
+ })
+ sendMessage.reduce((c, curr) => c.addTextComponent(curr), new Message().addTextComponent(new TextComponent(this.FeatureManager.messagePrefix))).chat()
+ })
+ }
+ })
}
// renderWebpage() {
// let url = this.getField(Client.currentGui.get(), f.linkText)
- // let image = renderLibs.getImage("https://soopymc.my.to/api/soopyv2/webpage?webpage=" + url)
+ // let image = renderLibs.getImage("https://soopy.dev/api/soopyv2/webpage?webpage=" + url)
// if (image) {
// let scale = Renderer.screen.getHeight() * 0.5 / image.getTextureHeight()
@@ -226,7 +247,7 @@ class GlobalSettings extends Feature {
this.currentPlayerOpen = uuid
this.currentPlayerNetworth = {}
- fetch("http://soopymc.my.to/api/v2/player_skyblock/" + uuid).json(data => {
+ fetch("http://soopy.dev/api/v2/player_skyblock/" + uuid).json(data => {
if (!data.success) return
if (this.currentPlayerOpen === data.data.uuid) {
@@ -257,13 +278,13 @@ class GlobalSettings extends Feature {
ChatLib.chat(this.FeatureManager.messagePrefix + "Finding senither weight for " + user)
- fetch("http://soopymc.my.to/api/v2/player/" + user).json(userData => {
+ fetch("http://soopy.dev/api/v2/player/" + user).json(userData => {
if (!userData.success) {
ChatLib.chat(this.FeatureManager.messagePrefix + "&cError loading data: " + userData.error.description)
return
}
- fetch("http://soopymc.my.to/api/v2/player_skyblock/" + userData.data.uuid).json(sbData => {
+ fetch("http://soopy.dev/api/v2/player_skyblock/" + userData.data.uuid).json(sbData => {
if (!sbData.success) {
ChatLib.chat(this.FeatureManager.messagePrefix + "&cError loading data: " + sbData.error.description)