Module: LibDiscord::Mappers

Defined in:
lib/lib_discord/mappers.rb,
lib/lib_discord/mappers/channel_types.rb,
lib/lib_discord/mappers/sticker_types.rb,
lib/lib_discord/mappers/webhooks_types.rb,
lib/lib_discord/mappers/audit_log_events.rb,
lib/lib_discord/mappers/guild_mfa_levels.rb,
lib/lib_discord/mappers/guild_nsfw_levels.rb,
lib/lib_discord/mappers/interaction_types.rb,
lib/lib_discord/mappers/poll_layout_types.rb,
lib/lib_discord/mappers/guild_prompt_types.rb,
lib/lib_discord/mappers/user_premium_types.rb,
lib/lib_discord/mappers/guild_premium_tiers.rb,
lib/lib_discord/mappers/invite_target_types.rb,
lib/lib_discord/mappers/sticker_format_types.rb,
lib/lib_discord/mappers/channel_message_types.rb,
lib/lib_discord/mappers/user_visibility_types.rb,
lib/lib_discord/mappers/guild_onboarding_modes.rb,
lib/lib_discord/mappers/message_component_types.rb,
lib/lib_discord/mappers/channel_sort_order_types.rb,
lib/lib_discord/mappers/application_command_types.rb,
lib/lib_discord/mappers/guild_verification_levels.rb,
lib/lib_discord/mappers/interaction_context_types.rb,
lib/lib_discord/mappers/channel_forum_layout_types.rb,
lib/lib_discord/mappers/interaction_callback_types.rb,
lib/lib_discord/mappers/auto_moderation_event_types.rb,
lib/lib_discord/mappers/channel_video_quality_modes.rb,
lib/lib_discord/mappers/auto_moderation_action_types.rb,
lib/lib_discord/mappers/application_integration_types.rb,
lib/lib_discord/mappers/auto_moderation_trigger_types.rb,
lib/lib_discord/mappers/stage_instance_privacy_levels.rb,
lib/lib_discord/mappers/channel_message_activity_types.rb,
lib/lib_discord/mappers/guild_scheduled_event_statuses.rb,
lib/lib_discord/mappers/message_component_button_styles.rb,
lib/lib_discord/mappers/application_command_option_types.rb,
lib/lib_discord/mappers/guild_integration_expire_behaviors.rb,
lib/lib_discord/mappers/guild_scheduled_event_entity_types.rb,
lib/lib_discord/mappers/message_component_text_input_styles.rb,
lib/lib_discord/mappers/application_command_permission_types.rb,
lib/lib_discord/mappers/auto_moderation_keyword_preset_types.rb,
lib/lib_discord/mappers/guild_explicit_content_filter_levels.rb,
lib/lib_discord/mappers/guild_scheduled_event_privacy_levels.rb,
lib/lib_discord/mappers/guild_default_message_notification_levels.rb,
lib/lib_discord/mappers/application_role_connection_metadata_types.rb

Overview

The Mappers module contains constants that are mapped to integer-encoded values used for types, levels, and modes across various objects in Discord. These constants are here to provide meaningful descriptors to otherwise magical numbers.

Examples:

an application command

command_object = {
  name: "blep",
  type: LibDiscord::Mappers::ApplicationCommandTypes::CHAT_INPUT,
  description: "send a random adorable animal photo",
  options: [
    {
      name: "animal",
      type: LibDiscord::Mappers::ApplicationCommandOptionTypes::STRING,
      required: true,
      choices: [
        {
          name: "dog",
          value: "animal_dog"
        },
        {
          name: "cat",
          value: "animal_cat"
        },
        {
          name: "penguin",
          value: "animal_penguin"
        }
      ]
    },
    {
      name: "only_smol",
      description: "whether to show only baby animals",
      type: LibDiscord::Mappers::ApplicationCommandOptionTypes::BOOLEAN,
      required: false
    }
  ]
}

Defined Under Namespace

Modules: ApplicationCommandOptionTypes, ApplicationCommandPermissionTypes, ApplicationCommandTypes, ApplicationIntegrationTypes, ApplicationRoleConnectionMetadataTypes, AuditLogEvents, AutoModerationActionTypes, AutoModerationEventTypes, AutoModerationKeywordPresetTypes, AutoModerationTriggerTypes, ChannelForumLayoutTypes, ChannelMessageActivityTypes, ChannelMessageTypes, ChannelSortOrderTypes, ChannelTypes, ChannelVideoQualityModes, GuildDefaultMessageNotificationLevels, GuildExplicitContentFilterLevels, GuildIntegrationExpireBehaviors, GuildMfaLevels, GuildNsfwLevels, GuildOnboardingModes, GuildPremiumTiers, GuildPromptTypes, GuildScheduledEventEntityTypes, GuildScheduledEventPrivacyLevels, GuildScheduledEventStatuses, GuildVerificationLevels, InteractionCallbackTypes, InteractionContextTypes, InteractionTypes, InviteTargetTypes, MessageComponentButtonStyles, MessageComponentTextInputStyles, MessageComponentTypes, PollLayoutTypes, StageInstancePrivacyLevels, StickerFormatTypes, StickerTypes, UserPremiumTypes, UserVisibilityTypes, WebhookTypes