Answer the question
In order to leave comments, you need to log in
How to receive and send a message?
I'm having trouble with one little problem. How can I implement it so that when I write the word "Submit" I have the admins(update);
If I do it through if , then my admins(update) is not executed, and the place of this is executed by member(update)
Message message = update.getMessage();
this.message = message;
if (message != null && message.hasText()) {
switch (message.getText()){
case "/start":
Long chatId = update.getMessage().getChatId();
this.chatId = chatId;
databaseHandler.recordChatId(chatId);
System.out.println("Этап старт");
sendMsg(update.getMessage(), "Введите Тэг");
break;
case "/admins":
if (update.getMessage().getChatId() == Const.TG_ADMIN_PANEL){
sendMsg(update.getMessage(), "Выполнен вход в админ панель");
admins(update);
System.out.println(message);
} else sendMsg(update.getMessage(), "Вы не админ");
break;
default:
member(update);
}
}
Answer the question
In order to leave comments, you need to log in
Good afternoon!
Firstly, it is better to frame the code with the code tag, and not throw it off as a screen.
admins is not executed, since this branch is not executed, but default is executed instead.
See what comes in message.getText()
Note that you have /start in the first branch, and admins in the second (without the slash). Maybe you're typing admins with a slash, which is why it doesn't match?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question