Total Complexity | 2 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | package com.github.netkorp.overridebasiccommand.commands; |
||
11 | @TelegramCommand(name = "assistance", secure = false) |
||
12 | public class OwnHelpCommand extends AbstractSimpleCommand implements HelpCommand { |
||
13 | |||
14 | /** |
||
15 | * Processes the data sent by the users. |
||
16 | * |
||
17 | * @param update the received message. |
||
18 | * @param args the parameters passed to the command execution. |
||
19 | */ |
||
20 | @Override |
||
21 | public void execute(Update update, String[] args) { |
||
22 | StringJoiner stringJoiner = new StringJoiner(System.lineSeparator()); |
||
23 | stringJoiner.add("Commands:"); |
||
24 | commandManager.getAvailableNonSecureCommands() |
||
25 | .forEach(command -> stringJoiner.add(String.format("%s - <b>%s</b>", CommandManager.getCommandFullName(command), command.description()))); |
||
26 | bot.sendMessage(stringJoiner.toString(), update.getMessage().getChatId(), true); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Returns the command's description, used to be displayed in help message. |
||
31 | * |
||
32 | * @return the command's description. |
||
33 | */ |
||
34 | @Override |
||
35 | public String description() { |
||
36 | return "Displays an assistance message"; |
||
37 | } |
||
39 |