aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-08-25 19:58:07 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-08-25 19:58:07 +0800
commit68984c4463ff51d60e745d43bf51eb15540725d2 (patch)
tree48120c5cf481b341e8a192b6eef4ccddba022b6b /utils
parentee8f99633a66e12b1d0c6fb9daaedb2ba802b755 (diff)
downloadSoopyV2-68984c4463ff51d60e745d43bf51eb15540725d2.tar.gz
SoopyV2-68984c4463ff51d60e745d43bf51eb15540725d2.tar.bz2
SoopyV2-68984c4463ff51d60e745d43bf51eb15540725d2.zip
+ fix dungeon map
+ powder hud fixes + guild bridge formatting + meta
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/utils/utils.js b/utils/utils.js
index 15b5489..0e916ae 100644
--- a/utils/utils.js
+++ b/utils/utils.js
@@ -118,6 +118,23 @@ let utils = {
var result = [];
p(array, []);
return result;
+ },
+ toMessageWithLinks: function (text, color = "f") {
+ return text.split(" ").reduce((c, curr) => {
+ if (curr.match(/(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/igm)) {
+ c.push(curr)
+ c.push("&" + color)
+ } else {
+ c[c.length - 1] += (c[c.length - 1].length === 2 ? "" : " ") + curr
+ }
+ 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()).setClick("open_url", a.trim())
+ } else {
+ return new TextComponent(a + ' ')
+ }
+ }).reduce((c, curr) => c.addTextComponent(curr), new Message())
}
}