Nadia.StoryArea (nadia v1.6.0)

View Source

Typed builders for Telegram story areas and their nested position and address objects.

Story-area percentage values are deliberately not range-limited. Telegram documents them as percentages but does not define a local validity range. Rotation is limited to 0 through 360 degrees.

Telegram's story-area documentation describes latitude and longitude in degrees without publishing bounds. Nadia applies the locally conventional geographic ranges of -90 through 90 latitude and -180 through 180 longitude so clearly invalid coordinates fail before a request is sent.

Builders omit nil options and preserve explicit false values. Typed lists passed to postStory or editStory are limited to 10 location, 5 suggested-reaction, 3 link, 3 weather, and 1 unique-gift area.

Summary

Types

t()

A typed story area, position, or location address. Its representation is opaque.

Functions

Builds a story area pointing to an HTTP, HTTPS, or tg:// URL.

Builds a story area pointing to a geographic location.

Builds a physical location address.

Builds a story area containing a suggested reaction.

Builds a story area pointing to a unique gift.

Builds a story area containing weather information.

Types

options()

@type options() :: keyword() | map()

t()

@opaque t()

A typed story area, position, or location address. Its representation is opaque.

variant()

@type variant() ::
  :position
  | :location_address
  | :location
  | :suggested_reaction
  | :link
  | :weather
  | :unique_gift

Functions

link(position, url)

@spec link(t(), binary()) :: t()

Builds a story area pointing to an HTTP, HTTPS, or tg:// URL.

location(position, latitude, longitude, options \\ [])

@spec location(t(), number(), number(), options()) :: t()

Builds a story area pointing to a geographic location.

location_address(country_code, options \\ [])

@spec location_address(binary(), options()) :: t()

Builds a physical location address.

position(x_percentage, y_percentage, width_percentage, height_percentage, rotation_angle, corner_radius_percentage)

@spec position(number(), number(), number(), number(), number(), number()) :: t()

Builds a story-area position.

All six values must be numeric. Percentage values may be negative or greater than 100; only rotation_angle is range-limited.

suggested_reaction(position, reaction, options \\ [])

@spec suggested_reaction(t(), Nadia.ReactionType.t(), options()) :: t()

Builds a story area containing a suggested reaction.

unique_gift(position, name)

@spec unique_gift(t(), binary()) :: t()

Builds a story area pointing to a unique gift.

weather(position, temperature, emoji, background_color)

@spec weather(t(), number(), binary(), non_neg_integer()) :: t()

Builds a story area containing weather information.