aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'juick-xmpp/src/main')
-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);