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).

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

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: 218 / 312
Version history: 3 change(s)
Referenced in: [show references]