com.w4p.telegram.model.TelegramMessageCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-telegram Show documentation
Show all versions of spring-telegram Show documentation
Java TelegramBot for Spring Framework with async multithreading support
package com.w4p.telegram.model;
import lombok.Getter;
@Getter
public class TelegramMessageCommand {
private String cmd;
private String argument;
private boolean command = false;
public TelegramMessageCommand(String msg) {
if (msg != null && msg.startsWith("/")) {
this.command = true;
int idx = msg.indexOf(" ");
this.cmd = msg.substring(0, (idx != -1) ? idx:msg.length());
if (idx != -1) {
this.argument = msg.substring(idx + 1);
}
} else {
this.argument = msg;
}
}
public TelegramMessageCommand(String command, String argument) {
this.cmd = command;
this.argument = argument;
}
}