-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathnet_maclife_wechat_http_Bot_MissileLaunched_JustForFun.java
More file actions
47 lines (43 loc) · 1.79 KB
/
net_maclife_wechat_http_Bot_MissileLaunched_JustForFun.java
File metadata and controls
47 lines (43 loc) · 1.79 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.*;
import org.apache.commons.lang3.*;
import com.fasterxml.jackson.databind.*;
/**
* 当有人发位置消息时,回复一段“导弹已就位”/“导弹已发射”的搞笑文字。
* @author liuyan
*
*/
public class net_maclife_wechat_http_Bot_MissileLaunched_JustForFun extends net_maclife_wechat_http_Bot
{
@Override
public int OnGeoLocationMessageReceived
(
JsonNode jsonMessage,
JsonNode jsonFrom, String sFromAccount, String sFromName, boolean isFromMe,
JsonNode jsonTo, String sToAccount, String sToName, boolean isToMe,
JsonNode jsonReplyTo, String sReplyToAccount, String sReplyToName, boolean isReplyToRoom,
JsonNode jsonReplyTo_RoomMember, String sReplyToAccount_RoomMember, String sReplyToName_RoomMember,
JsonNode jsonReplyTo_Person, String sReplyToAccount_Person, String sReplyToName_Person,
String sLocation, String sLongtitude, String sLatitude
)
{
try
{
String sReply = null;
List<String> listReplies = net_maclife_wechat_http_BotApp.GetConfig ().getList (String.class, "bot.missile-launched.replies");
if (listReplies!=null && listReplies.size ()>0)
{
int iRandom = net_maclife_wechat_http_BotApp.random.nextInt (listReplies.size ());
sReply = listReplies.get (iRandom);
}
SendTextMessage (sReplyToAccount, sReplyToName, sReplyToAccount_RoomMember, sReplyToName_RoomMember, "经度: " + sLongtitude + "\n纬度: " + sLatitude + "\n位置: " + sLocation + (StringUtils.isEmpty (sReply) ? "" : "\n" + sReply));
return
net_maclife_wechat_http_BotEngine.BOT_CHAIN_PROCESS_MODE_MASK__PROCESSED
| net_maclife_wechat_http_BotEngine.BOT_CHAIN_PROCESS_MODE_MASK__CONTINUE;
}
catch (Exception e)
{
e.printStackTrace ();
}
return net_maclife_wechat_http_BotEngine.BOT_CHAIN_PROCESS_MODE_MASK__CONTINUE;
}
}