-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
send message type image #1690
send message type image #1690
Conversation
@@ -302,6 +313,27 @@ class WhatsAppCloudApiService(private val apiClient: WhatsAppCloudApiClient) { | |||
} | |||
} | |||
|
|||
private fun replaceWithRealMassageImageId( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private fun replaceWithRealMassageImageId( | |
private fun replaceWithRealMessageImageId( |
@@ -328,7 +340,7 @@ fun <T : Bus<T>> T.whatsAppCloudTextParameterTemplate( | |||
typeParameter: CharSequence?, | |||
textButton: CharSequence? | |||
): TextParameter = TextParameter( | |||
type = ParameterType.valueOf(translate(typeParameter).toString()), | |||
type = ParameterType.valueOf((typeParameter).toString()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this change is a duplicate of #1683
|
||
data class WhatsAppCloudSendBotImageMessage( | ||
data class WhatsAppCloudSendBotImageMessage ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this extra space intended?
val image: WhatsAppCloudBotImage, | ||
override val recipientType: WhatsAppCloudBotRecipientType, | ||
override val to: String, | ||
) : WhatsAppCloudSendBotMessage(WhatsAppCoudBotMessageType.image) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semi-related to this PR: this class name has a typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je ne pense pas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WhatsAppCoudBotMessageType
instead of WhatsAppCloudBotMessageType
?
|
||
override fun toGenericMessage(): GenericMessage = | ||
GenericMessage( | ||
texts = mapOf(GenericMessage.TEXT_PARAM to "image"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GenericMessage
class has a dedicated attachments
field for this purpose, you can refer to WebModels#WebImage.toGenericMessage
for an example:
tock/bot/connector-web/src/main/kotlin/WebModels.kt
Lines 58 to 65 in 6cd5158
fun WebImage.toGenericMessage(): GenericMessage { | |
return GenericMessage( | |
texts = mapNotNullValues( | |
GenericMessage.TITLE_PARAM to title.toString(), | |
), | |
attachments = listOf(Attachment(file.url, attachmentType(file.url))) | |
) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this can be done in a future PR
fun BotBus.whatsAppCloudImage( | ||
id: String, | ||
link: String? = null, | ||
caption: String? = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a CharSequence
, so that we can translate it?
d530156
to
667c11f
Compare
667c11f
to
c3e8d5f
Compare
c3e8d5f
to
61d4a7c
Compare
* send message type image * send message type image --------- Co-authored-by: BENKACI Amira <[email protected]>
#1592