Skip to content
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

MEssage Util ExtractMessageContent #11

Open
viniciusverasdossantos opened this issue Apr 29, 2024 · 2 comments
Open

MEssage Util ExtractMessageContent #11

viniciusverasdossantos opened this issue Apr 29, 2024 · 2 comments
Assignees

Comments

@viniciusverasdossantos
Copy link

Message Util ExtractMessageContent

I need the ExtractMessageContent method. I tried to port the code to typescrypt but I was unable to evolve. I believe there is little missing. Can you help me finish?

public static Message ExtractMessageContent(Message content)
{
Message extractFromTemplateMessage(Message msg)
{
if (msg.ImageMessage!=null)
return new Message() { ImageMessage = msg.ImageMessage };
else if (msg.DocumentMessage != null)
return new Message() { DocumentMessage = msg.DocumentMessage };
else if (msg.VideoMessage!=null)
return new Message() { VideoMessage = msg.VideoMessage };
else if (msg.LocationMessage!=null)
return new Message() { LocationMessage = msg.LocationMessage };
else
{
//Todo:
return new Message(){};
}
}
content = NormalizeMessageContent(content);
if (content?.ButtonsMessage!=null)
return extractFromTemplateMessage(content.ButtonsMessage);
if (content?.TemplateMessage?.HydratedFourRowTemplate != null)
return extractFromTemplateMessage(content.ButtonsMessage);
if (content?.TemplateMessage?.HydratedFourRowTemplate!=null)
return extractFromTemplateMessage(content?.TemplateMessage?.HydratedFourRowTemplate);
if (content?.TemplateMessage?.HydratedTemplate != null)
return extractFromTemplateMessage(content?.TemplateMessage?.HydratedTemplate);
if (content?.TemplateMessage?.FourRowTemplate != null)
return extractFromTemplateMessage(content?.TemplateMessage?.FourRowTemplate);
return content;
}

@donaldjansen donaldjansen self-assigned this Apr 29, 2024
@donaldjansen
Copy link
Collaborator

I have added this to my TODOs

@renerlemes
Copy link

@viniciusverasdossantos se precisar de ajudar pra melhorar essa lib, tem meus dados de contato no meu perfil aqui do GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants