Class StopCommand

java.lang.Object
io.github.yvasyliev.forwarder.telegram.bot.service.command.StopCommand
All Implemented Interfaces:
MessageCommand

@Service("/stop") public class StopCommand extends Object implements MessageCommand
Stops the bot and sends a shutdown message to the chat. This command can only be executed by users with the ADMIN role.
  • Constructor Summary

    Constructors
    Constructor
    Description
    StopCommand(SendMessageMapper sendMessageMapper, org.telegram.telegrambots.meta.generics.TelegramClient telegramClient, org.springframework.context.ApplicationContext applicationContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(org.telegram.telegrambots.meta.api.objects.message.Message message)
    Executes the command with the provided message.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StopCommand

      public StopCommand(SendMessageMapper sendMessageMapper, org.telegram.telegrambots.meta.generics.TelegramClient telegramClient, org.springframework.context.ApplicationContext applicationContext)
  • Method Details

    • execute

      @PreAuthorize("hasRole('ADMIN')") public void execute(org.telegram.telegrambots.meta.api.objects.message.Message message) throws org.telegram.telegrambots.meta.exceptions.TelegramApiException
      Description copied from interface: MessageCommand
      Executes the command with the provided message.
      Specified by:
      execute in interface MessageCommand
      Parameters:
      message - the Telegram message to process
      Throws:
      org.telegram.telegrambots.meta.exceptions.TelegramApiException - if an error occurs while processing the message