How to use the monochrome-bot.SettingsConverters.stringToFloat function in monochrome-bot

To help you get started, we’ve selected a few monochrome-bot 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 mistval / kotoba / src / bot_settings.js View on Github external
};

const availableFontsAllowedValuesString = `Enter the number of the font you want from below.\n\n${fontDescriptionList}\n\nNote that some fonts support more kanji than others. You may see me fall back to a different font for kanji that isn't supported by your chosen font.`;

module.exports = [
  {
    userFacingName: 'Quiz',
    children:
    [
      {
        userFacingName: 'Answer time limit',
        description: 'This setting controls how many seconds players have to answer a quiz question before I say time\'s up and move on to the next question.',
        allowedValuesDescription: 'A number between 5 and 120 (in seconds)',
        uniqueId: 'quiz/japanese/answer_time_limit',
        defaultUserFacingValue: '16',
        convertUserFacingValueToInternalValue: SettingsConverters.stringToFloat,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.createRangeValidator(5, 120),
      },
      {
        userFacingName: 'Score limit',
        description: 'This setting controls how many points the quiz game stops at. When a player scores this many points, the game stops and they win.',
        allowedValuesDescription: 'A whole number between 1 and 10000',
        uniqueId: 'quiz/japanese/score_limit',
        defaultUserFacingValue: '10',
        convertUserFacingValueToInternalValue: SettingsConverters.stringToInt,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.createRangeValidator(1, 10000),
      },
      {
        userFacingName: 'Unanswered question limit',
        description: 'This setting controls how many questions in a row are allowed to go unanswered before the game stops. The intended purpose for this is to automatically end games that players abandon.',
github mistval / kotoba / bot / src / bot_settings.js View on Github external
allowedValuesDescription: 'A number between 1 and 30',
        uniqueId: 'shiritori/bot_turn_minimum_wait',
        serverOnly: false,
        defaultUserFacingValue: '2.75',
        convertUserFacingValueToInternalValue: SettingsConverters.stringToFloat,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.createRangeValidator(1, 30),
      },
      {
        userFacingName: 'Bot turn maximum wait',
        description: 'This setting controls the maximum amount of time (in seconds) that the bot will wait before giving its answer.',
        allowedValuesDescription: 'A number between 1 and 30',
        uniqueId: 'shiritori/bot_turn_maximum_wait',
        serverOnly: false,
        defaultUserFacingValue: '4.75',
        convertUserFacingValueToInternalValue: SettingsConverters.stringToFloat,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.createRangeValidator(1, 30),
      },
      {
        userFacingName: 'Answer time limit',
        description: 'This setting controls the amount of time (in seconds) that players have to give their answer. This does not apply to the bot player.',
        allowedValuesDescription: 'A number between 5 and 300',
        uniqueId: 'shiritori/answer_time_limit',
        serverOnly: false,
        defaultUserFacingValue: '40',
        convertUserFacingValueToInternalValue: SettingsConverters.stringToFloat,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.createRangeValidator(5, 300),
      },
    ],
  },
github mistval / kotoba / bot / src / bot_settings.js View on Github external
});

const availableFontsAllowedValuesString = `Enter the number of the font you want from below.\n\n${fontDescriptionList}\n\nNote that some fonts support more kanji than others. You may see me fall back to a different font for kanji that isn't supported by your chosen font.`;

module.exports = [
  {
    userFacingName: 'Quiz',
    children:
    [
      {
        userFacingName: 'Answer time limit',
        description: 'This setting controls how many seconds players have to answer a quiz question before I say time\'s up and move on to the next question.',
        allowedValuesDescription: 'A number between 5 and 120 (in seconds)',
        uniqueId: 'quiz/japanese/answer_time_limit',
        defaultUserFacingValue: '16',
        convertUserFacingValueToInternalValue: SettingsConverters.stringToFloat,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.createRangeValidator(5, 120),
      },
      {
        userFacingName: 'Score limit',
        description: 'This setting controls how many points the quiz game stops at. When a player scores this many points, the game stops and they win.',
        allowedValuesDescription: 'A whole number between 1 and 10000',
        uniqueId: 'quiz/japanese/score_limit',
        defaultUserFacingValue: '10',
        convertUserFacingValueToInternalValue: SettingsConverters.stringToInt,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.createRangeValidator(1, 10000),
      },
      {
        userFacingName: 'Unanswered question limit',
        description: 'This setting controls how many questions in a row are allowed to go unanswered before the game stops. The intended purpose for this is to automatically end games that players abandon.',
github mistval / kotoba / src / bot_settings.js View on Github external
userFacingName: 'Furigana background color',
        description: 'This setting controls the background color of the text produced by the furigana command.',
        allowedValuesDescription: 'Figure out the red, blue, and green components of the color you want and enter a value like this: **rgb(100, 50, 10)** (that\'s red 100, green 50, and blue 10). You can use [a tool like this](https://www.w3schools.com/colors/colors_rgb.asp) to get the color you want. Play around with the sliders, and then copy the **rgb(x,y,z)** value that it shows you. Each color component must be a whole number between 0 and 255. (rgba works too)',
        uniqueId: 'furigana_background_color',
        defaultUserFacingValue: 'rgb(54, 57, 62)',
        convertUserFacingValueToInternalValue: SettingsConverters.toString,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: validateRGBorRGBA,
      },
      {
        userFacingName: 'Furigana font size',
        description: 'This setting controls the font size of the main text of the furigana command. The size of the furigana text (above the main text) is this value divided by two.',
        allowedValuesDescription: 'A number between 10 and 80 (in font size points)',
        uniqueId: 'furigana_main_font_size',
        defaultUserFacingValue: '40',
        convertUserFacingValueToInternalValue: SettingsConverters.stringToFloat,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.createRangeValidator(20, 80),
      },
      {
        userFacingName: 'Furigana font',
        description: 'This setting controls the font used for the furigana command.',
        allowedValuesDescription: availableFontsAllowedValuesString,
        uniqueId: 'furigana_font',
        defaultUserFacingValue: 'Yu Mincho',
        convertUserFacingValueToInternalValue: SettingsConverters.createMapConverter(
          fontForInput,
          true,
        ),
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.isMappable,
      },