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

ChatAttachment class improvement suggestion #44

Closed
LeeHyKu opened this issue Jul 1, 2020 · 2 comments · Fixed by #111
Closed

ChatAttachment class improvement suggestion #44

LeeHyKu opened this issue Jul 1, 2020 · 2 comments · Fixed by #111
Labels
approved Issue approved and have plan to fix or enhancement dev Issue related to development branch

Comments

@LeeHyKu
Copy link
Contributor

LeeHyKu commented Jul 1, 2020

current code

export class ChatAttachment {
  readAttachment(json:any):void

how to use

let a = new ChatAttachment();
a.readAttachment(JSON);
chat.replyTemplate(new AttachmentTemplate(a));

if readAttachment function returns 'this' or ChatAttachment class has 'static builder(factory)', it can be used like this:

chat.replyTemplate(new AttachmentTemplate(new ChatAttachment().readAttachment(JSON)));

or

chat.replyTemplate(new AttachmentTemplate(ChatAttachment.BuildAttachment(JSON)));
@LeeHyKu
Copy link
Contributor Author

LeeHyKu commented Jul 1, 2020

or this:

chat.replyTemplate(ChatAttachment.fromJson(JSON).template) //get function

@storycraft
Copy link
Owner

storycraft commented Jul 2, 2020

There are planned improvements for attachments. Was supposed to be updated already. But delayed due to low priority for enhancements. The problem is that nested objects are too messy.

Current design

new CustomAttachment(new CustomInfo(/*very long arguments*/), content);

Inner contents(AttachmentContent) can be improved like this

new CustomAttachment({ message: 'link', type: CustomType.FEED, /* e.t.c. */ }, { /* contents */ });

This suggestion is unsafe because attachment counts, types are determined by chat type.

chat.replyTemplate(ChatAttachment.fromJson(JSON).template);

@storycraft storycraft mentioned this issue Jul 6, 2020
50 tasks
@storycraft storycraft added the approved Issue approved and have plan to fix or enhancement label Jul 17, 2020
@storycraft storycraft mentioned this issue Jan 31, 2021
4 tasks
storycraft added a commit that referenced this issue Feb 6, 2021
Reducing code size appending attachment on ChatBuilder. #44
@storycraft storycraft added the dev Issue related to development branch label Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Issue approved and have plan to fix or enhancement dev Issue related to development branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants