MessageFactory Sınıf
Botun döndürebileceği çeşitli ileti türlerinin biçimlendirmesine yardımcı olmak için tasarlanmış bir yardımcı program işlevleri kümesi.
Oluşturucu
MessageFactory()
Yöntemler
| attachment |
Ek içeren tek bir ileti etkinliği döndürür. message = MessageFactory.attachment(CardFactory.hero_card(HeroCard(title='White T-Shirt', images=[CardImage(url= 'https://example.com/whiteShirt.jpg' )], buttons=[CardAction(title='buy')]))) await context.send_activity(ileti) |
| carousel |
Döngü düzeni kullanarak bir dizi eki görüntüleyen bir ileti döndürür. message = MessageFactory.carousel([CardFactory.hero_card(HeroCard(title='title1', images=[CardImage(url='imageUrl1')], buttons=[CardAction(title='button1')])), CardFactory.hero_card(HeroCard(title='title2', images=[CardImage(url='imageUrl2')], buttons=[CardAction(title='button2')])), CardFactory.hero_card(HeroCard(title='title3', images=[CardImage(url='imageUrl3')], buttons=[CardAction(title='button3')]))]) await context.send_activity(ileti) |
| content_url |
Kullanıcıya tek bir görüntü veya video görüntüleyecek bir ileti döndürür. message = MessageFactory.content_url('https://example.com/hawaii.jpg', 'image/jpeg', 'Hawaii Trip', 'Aile tatilimizden bir fotoğraf.') await context.send_activity(ileti) |
| list |
Bir dizi eki liste biçiminde görüntüleyecek bir ileti döndürür. message = MessageFactory.list([CardFactory.hero_card(HeroCard(title='title1', images=[CardImage(url='imageUrl1')], buttons=[CardAction(title='button1')])), CardFactory.hero_card(HeroCard(title='title2', images=[CardImage(url='imageUrl2')], buttons=[CardAction(title='button2')])), CardFactory.hero_card(HeroCard(title='title3', images=[CardImage(url='imageUrl3')], buttons=[CardAction(title='button3')]))]) await context.send_activity(ileti) |
| suggested_actions |
Bir dizi önerilen eylem ve isteğe bağlı metin içeren bir ileti döndürür. message = MessageFactory.suggested_actions([CardAction(title='a', type=ActionTypes.im_back, value='a'), CardAction(title='b', type=ActionTypes.im_back, value='b'), CardAction(title='c', type=ActionTypes.im_back, value='c')], 'Renk seçin') await context.send_activity(ileti) |
| text |
Basit bir kısa mesaj döndürür. message = MessageFactory.text('Greetings from example message') await context.send_activity(message) |
attachment
Ek içeren tek bir ileti etkinliği döndürür.
message = MessageFactory.attachment(CardFactory.hero_card(HeroCard(title='White T-Shirt', images=[CardImage(url= 'https://example.com/whiteShirt.jpg' )],
buttons=[CardAction(title='buy')])))
await context.send_activity(ileti)
static attachment(attachment: Attachment, text: str = None, speak: str = None, input_hint: InputHints | str = None)
Parametreler
| Name | Description |
|---|---|
|
attachment
Gerekli
|
|
|
text
|
Default value: None
|
|
speak
|
Default value: None
|
|
input_hint
|
Default value: None
|
carousel
Döngü düzeni kullanarak bir dizi eki görüntüleyen bir ileti döndürür.
message = MessageFactory.carousel([CardFactory.hero_card(HeroCard(title='title1', images=[CardImage(url='imageUrl1')], buttons=[CardAction(title='button1')])),
CardFactory.hero_card(HeroCard(title='title2', images=[CardImage(url='imageUrl2')], buttons=[CardAction(title='button2')])),
CardFactory.hero_card(HeroCard(title='title3', images=[CardImage(url='imageUrl3')], buttons=[CardAction(title='button3')]))])
await context.send_activity(ileti)
static carousel(attachments: List[Attachment], text: str = None, speak: str = None, input_hint: InputHints | str = None) -> Activity
Parametreler
| Name | Description |
|---|---|
|
attachments
Gerekli
|
|
|
text
|
Default value: None
|
|
speak
|
Default value: None
|
|
input_hint
|
Default value: None
|
content_url
Kullanıcıya tek bir görüntü veya video görüntüleyecek bir ileti döndürür.
message = MessageFactory.content_url('https://example.com/hawaii.jpg', 'image/jpeg', 'Hawaii Trip', 'Aile tatilimizden bir fotoğraf.')
await context.send_activity(ileti)
static content_url(url: str, content_type: str, name: str = None, text: str = None, speak: str = None, input_hint: InputHints | str = None)
Parametreler
| Name | Description |
|---|---|
|
url
Gerekli
|
|
|
content_type
Gerekli
|
|
|
name
|
Default value: None
|
|
text
|
Default value: None
|
|
speak
|
Default value: None
|
|
input_hint
|
Default value: None
|
list
Bir dizi eki liste biçiminde görüntüleyecek bir ileti döndürür.
message = MessageFactory.list([CardFactory.hero_card(HeroCard(title='title1', images=[CardImage(url='imageUrl1')], buttons=[CardAction(title='button1')])),
CardFactory.hero_card(HeroCard(title='title2', images=[CardImage(url='imageUrl2')], buttons=[CardAction(title='button2')])),
CardFactory.hero_card(HeroCard(title='title3', images=[CardImage(url='imageUrl3')], buttons=[CardAction(title='button3')]))])
await context.send_activity(ileti)
static list(attachments: List[Attachment], text: str = None, speak: str = None, input_hint: InputHints | str = None) -> Activity
Parametreler
| Name | Description |
|---|---|
|
attachments
Gerekli
|
|
|
text
|
Default value: None
|
|
speak
|
Default value: None
|
|
input_hint
|
Default value: None
|
suggested_actions
Bir dizi önerilen eylem ve isteğe bağlı metin içeren bir ileti döndürür.
message = MessageFactory.suggested_actions([CardAction(title='a', type=ActionTypes.im_back, value='a'), CardAction(title='b', type=ActionTypes.im_back, value='b'), CardAction(title='c', type=ActionTypes.im_back, value='c')], 'Renk seçin')
await context.send_activity(ileti)
static suggested_actions(actions: List[CardAction], text: str = None, speak: str = None, input_hint: InputHints | str = InputHints.accepting_input) -> Activity
Parametreler
| Name | Description |
|---|---|
|
actions
Gerekli
|
|
|
text
|
Default value: None
|
|
speak
|
Default value: None
|
|
input_hint
|
Default value: InputHints.accepting_input
|
text
Basit bir kısa mesaj döndürür.
message = MessageFactory.text('Greetings from example message') await context.send_activity(message)
static text(text: str, speak: str = None, input_hint: InputHints | str = InputHints.accepting_input) -> Activity
Parametreler
| Name | Description |
|---|---|
|
text
Gerekli
|
|
|
speak
|
Default value: None
|
|
input_hint
|
Default value: InputHints.accepting_input
|