Skip to content

shipany.bot.actions.timeout_action

shipany.bot.actions.timeout_action package

Submodules

shipany.bot.actions.timeout_action.v1 module

pydantic model shipany.bot.actions.timeout_action.v1.TimeoutAction

Bases: BaseModel

Action to set a timeout.

Human-readable durations are supported. The following examples are valid:

  • 5 mins
  • 1 hr
  • 3 weeks 4 days 12 hrs 30 mins 5 secs
  • 1:24

Payload samples

  • Set a timeout of 5 minutes:
    {
    "name": "TimeoutAction@1",
    "duration": "5 mins",
    "emit-event": "timeout",
    "scope": ["chat"]
    }
  • Set a timeout of 1 hour:
    {
    "name": "TimeoutAction@1",
    "duration": "1 hr",
    "scope": ["chat"]
    }

Pydantic model parameters

field duration : str [Required]

Duration of the timeout. Can be any human-readable duration like 5 hrs, 34 mins, 56 secs.

  • Validated by:
    • _parse_duration

field emit_event : str [Required] (alias ‘emit-event’)

Event to emit when the timeout is reached. If not providepd, the default event is timeout.

field scope : list[Scope] [Required]

List of scopes where the timeout is active. The timeout is global if not provided

property delta : relativedelta

Return the duration as a dateutil.relativedelta object.

Default granularity is seconds.

  • Returns: Duration as a relativedelta object.
  • Return type: relativedelta
  • Raises: ValueError — If the duration cannot be parsed.

Module contents