Skip to content

Commit 309a9f7

Browse files
author
Alvin Reyes
committed
Modified README.md to include annotation based response handler example
1 parent c565da2 commit 309a9f7

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,42 @@ actionFrameBuilder()
184184
.buildToContext();
185185
```
186186

187+
**Prefer annotations?**
188+
Alternatively, you can also use @BotMillDomain and @BotMillController to your designated method and create the reply.
189+
190+
```java
191+
@BotMillDomain
192+
public class SampleDomain extends AbstractDomain {
193+
194+
@BotMillController(event = EventType.TEXT_MESSAGE, text = "Hello")
195+
public void replyText() {
196+
reply(new LinkMessageReply() {
197+
@Override
198+
public LinkMessage processReply(Message message) {
199+
return LinkMessageBuilder.getInstance().setTitle("Title").setUrl("http://alvinjayreyes.com").setPicUrl("http://pad1.whstatic.com/images/9/9b/Get-the-URL-for-Pictures-Step-2-Version-4.jpg")
200+
.build();
201+
}
202+
});
203+
}
204+
205+
@BotMillController(event = EventType.TEXT_PATTERN, pattern = "(?i:hi)")
206+
public void replyText1() {
207+
reply(new LinkMessageReply() {
208+
@Override
209+
public LinkMessage processReply(Message message) {
210+
return LinkMessageBuilder.getInstance().setTitle("Title1").setUrl("http://alvinjayreyes.com").setPicUrl("http://pad1.whstatic.com/images/9/9b/Get-the-URL-for-Pictures-Step-2-Version-4.jpg")
211+
.build();
212+
}
213+
});
214+
}
215+
}
216+
217+
```
218+
219+
187220
**<h3>How to use it on other Java Frameworks</h3>**
188221

189-
The KikBotMillLoad class offers a set of static methods that can be accessto load Entry Points and catch WebHook URL POST Request.
222+
The KikBotMillLoad class offers a set of static methods that can be access to load Entry Points and catch WebHook URL POST Request.
190223

191224
```java
192225
// Call this upon initialization of your app (should only be called once)

0 commit comments

Comments
 (0)