aboutsummaryrefslogtreecommitdiff
path: root/juick-commands/src/main/java/com/juick/command/Ping.java
blob: 7684af7ac35775f56094e50f3a426780e2618f85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.juick.command;

import com.juick.User;
import com.juick.server.protocol.ProtocolListener;
import org.springframework.stereotype.Component;

import java.util.regex.Pattern;

/**
 * @author ma1uta
 */
@Component
public class Ping implements Command {

    private static final Pattern PATTERN = Pattern.compile("^ping$", Pattern.CASE_INSENSITIVE);

    @Override
    public Pattern pattern() {
        return PATTERN;
    }

    @Override
    public String help() {
        return "PING - returns you a PONG";
    }

    @Override
    public String execute(User sender, ProtocolListener protocolListener, String command) {
        return "PONG";
    }
}