Passed
Push — master ( 482350...d5f627 )
by Roannel Fernández
03:16
created

description()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
eloc 3
rs 10
cc 1
1
package com.github.netkorp.telegram.framework.commands.basic;
2
3
import com.github.netkorp.telegram.framework.annotations.TelegramCommand;
4
import com.github.netkorp.telegram.framework.commands.abstracts.AbstractSimpleCommand;
5
import com.github.netkorp.telegram.framework.condition.ExcludeCondition;
6
import org.springframework.context.annotation.Conditional;
7
import org.telegram.telegrambots.meta.api.objects.Update;
8
9
/**
10
 * Shows the chat identification for user who invoked the command.
11
 */
12
@TelegramCommand(name = "whoami", group = "Basic", secure = false)
13
@Conditional(ExcludeCondition.class)
14
public final class WhoAmICommand extends AbstractSimpleCommand {
15
16
    /**
17
     * Processes the data sent by the users.
18
     *
19
     * @param update the received message.
20
     * @param args   the parameters passed to the command execution.
21
     */
22
    @Override
23
    public void execute(Update update, String[] args) {
24
        Long idChat = update.getMessage().getChatId();
25
        bot.sendMessage(idChat.toString(), idChat);
26
    }
27
28
    /**
29
     * Returns the command's description, used to be displayed in help message.
30
     *
31
     * @return the command's description.
32
     */
33
    @Override
34
    public String description() {
35
        return "Shows the ID of the current chat.";
36
    }
37
}
38