完成基本功能转移
This commit is contained in:
53
src/main/java/com/yutou/napcat/handle/Text.java
Normal file
53
src/main/java/com/yutou/napcat/handle/Text.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.yutou.napcat.handle;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
public class Text extends BaseHandle<Text.TextInfo> {
|
||||
|
||||
public Text() {
|
||||
super("text");
|
||||
}
|
||||
|
||||
public Text(String text) {
|
||||
super("text");
|
||||
data = new TextInfo(text + "\n");
|
||||
}
|
||||
|
||||
public Text(String text, boolean isNewLine) {
|
||||
super("text");
|
||||
if (isNewLine) {
|
||||
data = new TextInfo(text + "\n");
|
||||
} else {
|
||||
data = new TextInfo(text);
|
||||
}
|
||||
}
|
||||
|
||||
public Text(boolean isNewLine, String... text) {
|
||||
super("text");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : text) {
|
||||
sb.append(s);
|
||||
}
|
||||
if (isNewLine) {
|
||||
data = new TextInfo(sb + "\n");
|
||||
} else {
|
||||
data = new TextInfo(sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return data.text;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class TextInfo {
|
||||
String text;
|
||||
|
||||
public TextInfo(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user