package com.juick.command; import com.juick.User; import com.juick.service.UserService; import lombok.Getter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.regex.Pattern; /** * @author ma1uta */ @Component @Getter public class Login implements Command { private static final Pattern PATTERN = Pattern.compile("^login$", Pattern.CASE_INSENSITIVE); private final UserService userService; @Autowired public Login(UserService userService) { this.userService = userService; } @Override public Pattern pattern() { return PATTERN; } @Override public String help() { return "LOGIN - log in to Juick website"; } @Override public String execute(User sender, MessageListener protocolListener, String command) { return "http://juick.com/login?hash=" + getUserService().getHashByUID(sender.getUid()); } }