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

58
LINES

< > TinyBrain | #1002017 - Eleutheria Main, including Slack Bot (LIVE)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (10762L/80K/229K).

!759

// Options for smaller heap with limit to allow other VMs to start on 1GB machine. Also, headless to allow image rendering on server.
static S vmArgs = "-Xmx256m -XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=10 -XX:+UseG1GC -verbose:gc -Djava.awt.headless=true";

// Options for smaller heap
//static S vmArgs = "-XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=10 -XX:+UseG1GC";

// Options for max speed & reactivity - some claim this might cause problems (https://developer.jboss.org/thread/228920?start=75&tstart=0)
//static S vmArgs = "-server -XX:+TieredCompilation";

// Options for max longterm throughput
//static S vmArgs = "-server";

// Homepage, Talk to Eleu, Web Auth, Cookies
static L<S> seedBots = litlist("#1003253", "#1002213", "#1002590", "#1002157");

sbool doSlack = false;

!include #1002268 // Slack Bot
!include #1002576 // Web Serving
!include #1002578 // Eleu Core

static boolean actuallyPost = true;
static S botUserName = "eleu_learns_to_think";
static L<S> actualBotUserNames = litlist("eleu", "connector");

static int webServerPort = 80; // set to 0 for no web serving
static int httpsPort = 443; // set to 0 for no https serving

p {
  becomeBotVMIfFirst();
  webInit();
  
  if (webServerPort != 0) pcall {
    serveHttp(webServerPort);
  }
  
  if (httpsPort != 0) pcall {
    File keystore = secretProgramFile(programID(), "keystore.jks");
    S pass = loadSecretTextFileMandatory("keystore-pass").trim();
    serveHttps(httpsPort, keystore, pass);
  }
  
  if (doSlack)
    initSlackBot();
  dediSay("Booting...");
  coreInit();
  
  for (S id : seedBots)
    call(getDispatcher(), "addSeedBot", id);
    
  dediSay("Yo, back online!");
  if (doSlack)
    slackBotLoop();
}

Author comment

Began life as a copy of #1001915

download  show line numbers  debug dex   

Travelled to 4 computer(s): cfunsshuasjs, jtubtzbbkimh, onxytkatvevr, tvejysmllsmz

No comments. add comment

Snippet ID: #1002017
Snippet name: Eleutheria Main, including Slack Bot (LIVE)
Eternal ID of this version: #1002017/2
Text MD5: 33589f4f68749a4108ddfff4c1087063
Transpilation MD5: 83178fbfd1ce518e5e705486f41f669c
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-10 04:49:20
Source code size: 1770 bytes / 58 lines
Pitched / IR pitched: No / No
Views / Downloads: 1256 / 5697
Version history: 1 change(s)
Referenced in: [show]