How to use the readline-sync.keyInPause function in readline-sync

To help you get started, we’ve selected a few readline-sync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xynxynxyn / terminal-discord / index.js View on Github external
"[Config Error] right_bound requires max_name_length to be set"
    );
    console_out("[Config Error] max_name_length set to default value");
  }

  if (config["history_length"] > 100) {
    console_out(
      "[Config Error] history_length should be lower or equal to 100"
    );
    console_out("[Config Error] history_length set to 100");
  }

  // wait for userinput if inconsistency was found
  if (found_inconsistency) {
    rl.pause();
    rl_sync.keyInPause(" ");
    rl.resume();
  }

  return config;
}
github xynxynxyn / terminal-discord / index.js View on Github external
function init() {
  while (true) {
    guild = select_guild();
    if (guild === undefined) {
      console_out("No guild selected.\nShowing direct messages...");
      rl.pause();
      rl_sync.keyInPause(" ");
      rl.resume();
      channel = select_other();
      if (channel === undefined) {
        exit("No channel selected. Exiting...");
      } else {
        set_title("#" + channel_name());
        update_prompt();
        return;
      }
    }

    while (true) {
      channel = select_channel();
      if (channel === undefined) {
        break;
      }
github xynxynxyn / terminal-discord / index.js View on Github external
case "pm":
    case "dm":
    case "g":
    case "gr":
    case "group":
      new_channel = select_other();
      channel = new_channel === undefined ? channel : new_channel;
      update_prompt();
      clear_screen();
      history();
      break;
    case "i":
    case "info":
      channel_info();
      rl.pause();
      rl_sync.keyInPause(" ");
      rl.resume();
      clear_screen();
      update();
      break;
    case "b":
    case "block":
      hide_blocked = !hide_blocked;
      clear_screen();
      update();
      break;
    case "h":
    case "help":
      help_info();
      rl.pause();
      rl_sync.keyInPause(" ");
      rl.resume();
github xynxynxyn / terminal-discord / index.js View on Github external
function get_default_channel() {
  if (config["default_guild"] !== null && config["default_channel"] !== null) {
    guild = client.guilds.array()[config["default_guild"]];
    if (guild !== undefined) {
      channel = guild.channels.array()[config["default_channel"]];
      if (channel !== undefined) {
        if (channel.type !== "text") {
          console_out("[Config Error] the default channel is a voice channel");
          console_out(
            "[Config Error] set both default_channel and default_guild to null again to fix"
          );
          console_out(
            "[Config Error] then use the /info command to find out the channel indices"
          );
          rl.pause();
          rl_sync.keyInPause(" ");
          rl.resume();
          return false;
        }
        set_title("#" + channel_name());
        update_prompt();
        return true;
      }
    }
  }
  return false;
}