Safe Haskell | None |
---|---|
Language | Haskell2010 |
Calamity Interaction views
Synopsis
- module Calamity.Interactions.View
- module Calamity.Interactions.Utils
- module Calamity.Interactions.Eff
Documentation
module Calamity.Interactions.View
module Calamity.Interactions.Utils
module Calamity.Interactions.Eff
Interactions and Views
This module contains functions and types related to handling discord interactions.
The data models for components can be found in Calamity.Types.Model.Channel.Component
Examples
Displaying a View
let view =row
$ do a <-button
ButtonPrimary
"defer" b <-button
ButtonPrimary
"deferEph" c <-button
ButtonPrimary
"deferComp" d <-button
ButtonPrimary
"modal" pure (a, b, c, d) modalView = do a <-textInput
TextInputShort
"a" b <-textInput
TextInputParagraph
"b" pure (a, b) inrunView
view (tell
ctx) $ \(a, b, c, d) -> dowhen
a $ dovoid
defer
embed
$ threadDelay 1000000void
$followUp
@Text
"lol"when
b $ dovoid
deferEphemeral
embed
$ threadDelay 1000000void
$followUpEphemeral
@Text
"lol"when
c $ dovoid
deferComponent
embed
$ threadDelay 1000000void
$followUp
@Text
"lol"when
d $ dovoid
.async
$ dorunView
modalView (void
.pushModal
"lol") $ (a, b) -> doembed
$ print (a, b)void
$respond
("Thanks: " <> a <> " " <> b)endView
() pure ()