コード例 #1
0
 def create_audio_card(self) -> Attachment:
     card = AudioCard(
         media=[MediaUrl(url="https://wavlist.com/wav/father.wav")],
         title="I am your father",
         subtitle="Star Wars: Episode V - The Empire Strikes Back",
         text=
         "The Empire Strikes Back (also known as Star Wars: Episode V – The Empire Strikes "
         "Back) is a 1980 American epic space opera film directed by Irvin Kershner. Leigh "
         "Brackett and Lawrence Kasdan wrote the screenplay, with George Lucas writing the "
         "film's story and serving as executive producer. The second installment in the "
         "original Star Wars trilogy, it was produced by Gary Kurtz for Lucasfilm Ltd. and "
         "stars Mark Hamill, Harrison Ford, Carrie Fisher, Billy Dee Williams, Anthony "
         "Daniels, David Prowse, Kenny Baker, Peter Mayhew and Frank Oz.",
         image=ThumbnailUrl(
             url=
             "https://upload.wikimedia.org/wikipedia/en/3/3c/SW_-_Empire_Strikes_Back.jpg"
         ),
         buttons=[
             CardAction(
                 type=ActionTypes.open_url,
                 title="Read more",
                 value=
                 "https://en.wikipedia.org/wiki/The_Empire_Strikes_Back",
             )
         ],
     )
     return CardFactory.audio_card(card)
コード例 #2
0
    def test_should_create_audio_card_attachment(self):
        media = [MediaUrl(url='https://example.org/media')]
        card = AudioCard(title='test', media=media)
        attachment = CardFactory.audio_card(card)

        assert_attachment(attachment, CardFactory.content_types.audio_card)
        assert attachment.content.title == 'test', 'wrong title.'
        assert_media(attachment.content.media, 1,
                     ['https://example.org/media'])
コード例 #3
0
    def test_should_create_audio_card_attachment(self):
        media = [MediaUrl(url="https://example.org/media")]
        card = AudioCard(title="test", media=media)
        attachment = CardFactory.audio_card(card)

        assert_attachment(attachment, CardFactory.content_types.audio_card)
        assert attachment.content.title == "test", "wrong title."
        assert_media(attachment.content.media, 1,
                     ["https://example.org/media"])
コード例 #4
0
 def create_audio_card(self) -> Attachment:
     card = AudioCard()
     card.media = [
         MediaUrl(url="https://wavlist.com/wav/apli-airconditioner.wav")
     ]
     card.subtitle = "Bot Framework Audio Card using python"
     card.title = "Lets play an audio"
     card.image = ThumbnailUrl(
         url="https://pypi.org/static/images/logo-small.6eef541e.svg")
     return CardFactory.audio_card(card)
コード例 #5
0
 def create_audio_card(url: str) -> Attachment:
     card = AudioCard(title="Audio Card",
                      media=[MediaUrl(url=url)],
                      autoloop=True)
     return CardFactory.audio_card(card)