Esempio n. 1
0
  /** Class constructor */
  public TinkerBot() {
    // Initialize globals
    data = Storage.readStorage("data.bin");
    con = new ConnectionManager(new Profile(data.botName));
    command_char = "!";
    users = new HashMap<String, User>();
    announcer = null;
    announcerStr = null;
    announcerPeriod = -1;
    announcerRunning = false;
    awayList = new ArrayList<String>();

    // Start TinkerBot
    con.requestConnection(data.server).addIRCEventListener(this);

    new Timer()
        .scheduleAtFixedRate(
            new TimerTask() {
              @Override
              public void run() {
                cmdSave();
              }
            },
            60 * 500,
            60 * 500); // save data every 30 seconds
  }
Esempio n. 2
0
 /** Save command */
 private void cmdSave() {
   Storage.writeStorage("data.bin", data);
 }
Esempio n. 3
0
 /** Quit command */
 private void cmdQuit() {
   Storage.writeStorage("data.bin", data);
   con.quit();
   System.exit(0);
 }