diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-23 14:29:55 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-23 14:29:55 +0800 |
commit | 98c4fe9410c9144c26f389cf5290574f778d7967 (patch) | |
tree | bc7e51c51e05dc164fe56a258fc09d70a3723c54 | |
parent | 645f68eedcd17edb7209fa12fdcff099460cba93 (diff) | |
download | SoopyV2-98c4fe9410c9144c26f389cf5290574f778d7967.tar.gz SoopyV2-98c4fe9410c9144c26f389cf5290574f778d7967.tar.bz2 SoopyV2-98c4fe9410c9144c26f389cf5290574f778d7967.zip |
+meta
+ potentially fix links in g chat
+ if you are using sbgbot shows links eg for images in g chat again
-rw-r--r-- | src/features/guild/index.js | 20 | ||||
-rw-r--r-- | src/metadata.json | 6 | ||||
-rw-r--r-- | src/utils/utils.js | 2 |
3 files changed, 20 insertions, 8 deletions
diff --git a/src/features/guild/index.js b/src/features/guild/index.js index d7897c3..3fe0cdb 100644 --- a/src/features/guild/index.js +++ b/src/features/guild/index.js @@ -23,7 +23,7 @@ class Guild extends Feature { //&r&2Guild > &6[MVP&0++&6] zZzSNOW &e[STAFF]&f: &r@niftynathan7, niftynathan7's weight: 20 087 (#1 198) (Skill: 8 771, Slayer: 1 263, Dungeons: 10 053) ,.,,,..,.,,.,,,....,,,,,,,,,..,,,,,..,,,..,,,.,,.,,.,..,,....,,....,,..,.&r //&r&2Guild > &6[MVP&4++&6] Soopyboo32 &e[STAFF]&f: &rasd&r //&r&2Guild > &6[MVP&1++&6] niftynathan7 &e[E]&f: &r@Soopyboo32, Soopyboo32's networth: $8 424 131 866 (#2 592) ,..,...,....,.,,,....,,,...,,,,,,,..,,.,,..,,.,.,,,.........,.....,,,,.....,..,,...,.,.,...,.,&r - let ev = this.registerChat('&r&2Guild > ${player}&f: &r${msg}&r', (player, msg, event) => { + let ev = this.registerChat(/^&r&2Guild > ([\w\W]+?)&f: &r([\w\W]+)&r/, (player, msg, event) => { if (msg.includes("[ITEM:")) return if (player.includes(":")) return; //stop people sending weard messages to troll using this @@ -45,9 +45,21 @@ class Guild extends Feature { message = `&2B${this.shortenPrefix.getValue() ? "" : "ridge"} > &7⤷&f ${msg.trim()}` } } else { - if (msg.match(/^@\w+, [\w\W]+[,.]+$/)) { - let [_, name2, reply] = msg.match(/^@(\w+?), ([\w\W]+?)[,.]+$/) - message = `&2B${this.shortenPrefix.getValue() ? "" : "ridge"} > &b${name2} &7⤷&f ${reply.trim()}` + if (msg.match(/^@(\w+?), ([\w\W]+?) \[GBot:([0-9]+)\] [,. ]+$/)) { + let [_, name2, reply, gBotId] = msg.match(/^@(\w+?), ([\w\W]+?) \[GBot:([0-9]+)\] [,. ]+$/) + fetch("http://soopy.dev/api/botdown/" + gBotId).json().then(m => { + let message = new Message(`&2B${this.shortenPrefix.getValue() ? "" : "ridge"} > &b${name2} &7⤷&f `) + + m.forEach(c => { + let component = new TextComponent(c.text) + if (c.click) component.setClick(c.click.action, c.click.value) + if (c.hover) component.setHover(c.hover.action, c.hover.value) + message.addTextComponent(component) + }) + + message.chat() + }) + return } else { message = `&2G${this.shortenPrefix.getValue() ? "" : "uild"} > ${rank}${ign}${grank || ""}&f: ${msg}` } diff --git a/src/metadata.json b/src/metadata.json index 74bbd2b..ca11756 100644 --- a/src/metadata.json +++ b/src/metadata.json @@ -1,12 +1,12 @@ { - "$schema": "../CTAutocomplete/schema.json", + "$schema": "../../CTAutocomplete/schema.json", "creator": "Soopyboo32", "author": "Soopyboo32", "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.164", - "versionId": 291, + "version": "2.1.165", + "versionId": 292, "requires": [ "soopyApis", "soopyAddonsData", diff --git a/src/utils/utils.js b/src/utils/utils.js index 1f6cd6e..015643d 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -130,7 +130,7 @@ let utils = { return c }, ["&" + color]).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("&" + color + "&n" + a + "&" + color + ' ').setHover("show_text", "Click to open " + a.trim().replace(/^(?:[&§][0-9a-fmn])+|(?:[&§][0-9a-fmn])+$/g, "")).setClick("open_url", a.trim()) + return new TextComponent("&" + color + "&n" + a + "&" + color + ' ').setHover("show_text", "Click to open " + a.trim().replace(/^(?:[&§][0-9a-fmn])+|(?:[&§][0-9a-fmn])+$/g, "")).setClick("open_url", a.trim().replace(/[&§][0-9a-fmn]/g, "")) } else { return new TextComponent(a + ' ') } |