How to use the monochrome-bot.SettingsValidators.isMappable 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 / bot / src / bot_settings.js View on Github external
{
    userFacingName: 'Fonts',
    children:
    [
      {
        userFacingName: 'Quiz font',
        description: 'This setting controls the font used for text rendered for quizzes.',
        allowedValuesDescription: availableFontsAllowedValuesString,
        uniqueId: 'quiz_font',
        defaultUserFacingValue: 'Noto Sans CJK',
        convertUserFacingValueToInternalValue: SettingsConverters.createMapConverter(
          fontForInput,
          true,
        ),
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.isMappable,
      },
      {
        userFacingName: 'Quiz text font color',
        description: 'This setting controls the color of the text rendered for quizzes.',
        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: 'quiz_font_color',
        defaultUserFacingValue: 'rgb(0, 0, 0)',
        convertUserFacingValueToInternalValue: SettingsConverters.toString,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: validateRGBorRGBA,
      },
      {
        userFacingName: 'Quiz text background color',
        description: 'This setting controls the background color of the text rendered for quizzes.',
        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: 'quiz_background_color',
github mistval / kotoba / src / bot_settings.js View on Github external
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,
      },
    ],
  },
  {
    userFacingName: 'Dictionary',
    children:
    [
      {
        userFacingName: 'Display mode',
        description: 'This setting controls the default display mode for dictionary results. **big** shows multiple pages and multiple results per page. **small** only shows one result with up to three definitions.',
        allowedValuesDescription: 'Either **Big** or **Small**',
        uniqueId: 'dictionary/display_mode',
        serverOnly: false,
        defaultUserFacingValue: 'Big',
        convertUserFacingValueToInternalValue: SettingsConverters.toStringLowercase,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
github mistval / kotoba / src / bot_settings.js View on Github external
convertUserFacingValueToInternalValue: SettingsConverters.stringToFloat,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.createRangeValidator(20, 200),
      },
      {
        userFacingName: 'Quiz font',
        description: 'This setting controls the font used for text rendered for quizzes.',
        allowedValuesDescription: availableFontsAllowedValuesString,
        uniqueId: 'quiz_font',
        defaultUserFacingValue: 'Yu Mincho',
        convertUserFacingValueToInternalValue: SettingsConverters.createMapConverter(
          fontForInput,
          true,
        ),
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.isMappable,
      },
      {
        userFacingName: 'Furigana font color',
        description: 'This setting controls the 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_font_color',
        defaultUserFacingValue: 'rgb(192, 193, 194)',
        convertUserFacingValueToInternalValue: SettingsConverters.toString,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: validateRGBorRGBA,
      },
      {
        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',
github mistval / kotoba / bot / src / bot_settings.js View on Github external
convertUserFacingValueToInternalValue: SettingsConverters.stringToFloat,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.createRangeValidator(20, 200),
      },
      {
        userFacingName: 'Furigana font',
        description: 'This setting controls the font used for the furigana command.',
        allowedValuesDescription: availableFontsAllowedValuesString,
        uniqueId: 'furigana_font',
        defaultUserFacingValue: 'Noto Sans CJK',
        convertUserFacingValueToInternalValue: SettingsConverters.createMapConverter(
          fontForInput,
          true,
        ),
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: SettingsValidators.isMappable,
      },
      {
        userFacingName: 'Furigana font color',
        description: 'This setting controls the 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_font_color',
        defaultUserFacingValue: 'rgb(192, 193, 194)',
        convertUserFacingValueToInternalValue: SettingsConverters.toString,
        convertInternalValueToUserFacingValue: SettingsConverters.toString,
        validateInternalValue: validateRGBorRGBA,
      },
      {
        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',