aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-01-30 14:23:50 +0300
committerGravatar Vitaly Takmazov2018-01-30 14:23:50 +0300
commit2d6e1dc76e659b78b3103af2bcf1b7f13db62f0a (patch)
tree30f46c54d5ecd5bdac3de17998425288b96908c7 /juick-xmpp/src/main/java/com/juick
parent1e5c0403d3339c40950106737ef17727d786f6d4 (diff)
xmpp: D #message
Diffstat (limited to 'juick-xmpp/src/main/java/com/juick')
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/JuickBot.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java b/juick-xmpp/src/main/java/com/juick/components/JuickBot.java
index 9855f958..42a5f8a6 100644
--- a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java
+++ b/juick-xmpp/src/main/java/com/juick/components/JuickBot.java
@@ -632,7 +632,30 @@ public class JuickBot implements StanzaListener, AutoCloseable {
}
return "Message not found";
}
+ @UserCommand(pattern = "^D #(\\d+)$", help = "D #1234 - Delete post", patternFlags = Pattern.CASE_INSENSITIVE)
+ public String commandDeletePost(User user, Jid from, String... args) {
+ int mid = Integer.valueOf(args[0]);
+ if (messagesService.deleteMessage(user.getUid(), mid)) {
+ return "Message deleted";
+ }
+ return "This is not your message";
+ }
+ @UserCommand(pattern = "^D #(\\d+)(\\.|\\-|\\/)(\\d+)$", help = "D #1234/5 - Delete comment", patternFlags = Pattern.CASE_INSENSITIVE)
+ public String commandDeleteReply(User user, Jid from, String... args) {
+ int mid = Integer.valueOf(args[0]);
+ int rid = Integer.valueOf(args[2]);
+ if (messagesService.deleteReply(user.getUid(), mid, rid)) {
+ return "Reply deleted";
+ } else {
+ return "This is not your reply";
+ }
+ }
+ /*
+ @UserCommand(pattern = "(^(D L|DL|D LAST)$", help = "D #1234/5 - Delete comment", patternFlags = Pattern.CASE_INSENSITIVE)
+ public String commandDeleteLast(User user, Jid from, String... args) {
+ }
+ */
void sendReply(Jid jidTo, String txt) {
Message reply = new Message();
reply.setFrom(jid);