Skip to content

Commit

Permalink
init push
Browse files Browse the repository at this point in the history
  • Loading branch information
supertick committed Dec 5, 2023
1 parent 7562b39 commit b38e50f
Show file tree
Hide file tree
Showing 21 changed files with 1,129 additions and 1,027 deletions.
17 changes: 9 additions & 8 deletions src/main/java/org/myrobotlab/programab/BotInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.alicebot.ab.Bot;
import org.myrobotlab.io.FileIO;
import org.myrobotlab.logging.LoggerFactory;
import org.myrobotlab.programab.handlers.sraix.MrlSraixHandler;
import org.myrobotlab.service.ProgramAB;
import org.slf4j.Logger;

Expand All @@ -23,7 +24,7 @@ public class BotInfo {

transient public final static Logger log = LoggerFactory.getLogger(BotInfo.class);

public String name;
public String botType;
public File path;
public Properties properties = new Properties();
private transient Bot bot;
Expand All @@ -36,16 +37,16 @@ public class BotInfo {
public String img;

public BotInfo(ProgramAB programab, File path) {
this.name = path.getName();
this.botType = path.getName();
this.path = path;
this.programab = programab;
programab.info("found bot %s", name);
programab.info("found bot %s", botType);
try {
FileInputStream fis = new FileInputStream(FileIO.gluePaths(path.getAbsolutePath(), "manifest.txt"));
properties.load(new InputStreamReader(fis, Charset.forName("UTF-8")));
log.info("loaded properties");
} catch (FileNotFoundException e) {
programab.warn("bot %s does not have a manifest.txt", name);
programab.warn("bot %s does not have a manifest.txt", botType);
} catch (Exception e) {
log.error("BotInfo threw", e);
}
Expand All @@ -61,13 +62,13 @@ public synchronized Bot getBot() {
if (bot == null) {
// lazy loading of bot - created on the first use
if (properties.containsKey("locale")) {
bot = new Bot(name, path.getAbsolutePath(), java.util.Locale.forLanguageTag((String) properties.get("locale")));
bot = new Bot(botType, path.getAbsolutePath(), java.util.Locale.forLanguageTag((String) properties.get("locale")));
bot.listener = programab;
} else {
if (programab.getLocaleTag() == null) {
bot = new Bot(name, path.getAbsolutePath());
bot = new Bot(botType, path.getAbsolutePath());
} else {
bot = new Bot(name, path.getAbsolutePath(), java.util.Locale.forLanguageTag(programab.getLocaleTag()));
bot = new Bot(botType, path.getAbsolutePath(), java.util.Locale.forLanguageTag(programab.getLocaleTag()));
}
bot.listener = programab;
}
Expand Down Expand Up @@ -130,7 +131,7 @@ public void removeProperty(String name2) {

@Override
public String toString() {
return String.format("%s - %s", name, path);
return String.format("%s - %s", botType, path);
}

}
211 changes: 0 additions & 211 deletions src/main/java/org/myrobotlab/programab/MrlSraixHandler.java

This file was deleted.

Loading

0 comments on commit b38e50f

Please sign in to comment.