From 30ec92fd65c2f39e03dd4fd78c825de07752b5ae Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Fri, 17 Jan 2020 17:44:08 +0800 Subject: [PATCH] feat: add tellraw string Signed-off-by: MiaoWoo --- packages/common/src/tellraw.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/common/src/tellraw.ts b/packages/common/src/tellraw.ts index 7ccdd462..729b4648 100644 --- a/packages/common/src/tellraw.ts +++ b/packages/common/src/tellraw.ts @@ -88,7 +88,7 @@ class Tellraw { json() { if (!this.cache) { var temp = []; - this.parts.forEach(function(t) { + this.parts.forEach(t => { temp.push(t.convert()); }); this.cache = JSON.stringify(temp); @@ -96,6 +96,14 @@ class Tellraw { } return this.cache; } + + string() { + var temp = ''; + this.parts.forEach(t => { + temp += t.text + }); + return temp; + } } export default Tellraw