Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1029990 // gazelle_mathBot1_handlePost_2

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5761L/39K).

1  
svoid gazelle_mathBot1_handlePost_2(S _user, S _botToken, GazellePost post) {
2  
  LS groups = regexpGroupsIC("What is (\\d+)\\s*\\+\\s*(\\d+)", post.text);
3  
  if (empty(groups)) ret;
4  
  print("Processing post " + sfu(post));
5  
  BigInt result = plus(parseBigInt(first(groups)), parseBigInt(second(groups)));
6  
  print("Calculated result: " + result);
7  
  print(postJSONPage("https://gazelle.rocks/bot/createPost",
8  
    +_user, +_botToken, refs := post.id, text := "The result is " + result, type := "Answer", botInfo := "Math bot"));
9  
}

Author comment

Began life as a copy of #1029983

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1029990
Snippet name: gazelle_mathBot1_handlePost_2
Eternal ID of this version: #1029990/4
Text MD5: 09799189c71bcfe3d3f39c6989c42f26
Transpilation MD5: 096dbe7ff4c2897b71239d2a12d3cf04
Author: stefan
Category: javax / gazelle.rocks
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-10-27 10:29:37
Source code size: 532 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 158 / 240
Version history: 3 change(s)
Referenced in: [show references]