RickvanLoo / discord-cli

Minimalistic Command-Line Interface for Discord
GNU General Public License v2.0
203 stars 32 forks source link

[General Architectural Ideas] #5

Open RickvanLoo opened 8 years ago

RickvanLoo commented 8 years ago
RickvanLoo commented 8 years ago

Message handling is currently quite dumb, it receives, checks and prints. If we want to have editing/deleting options or respect those options from the users of the official client we have to manipulate the output quite heavily. There is currently no way to check when the message has been posted and on which line it is when we are talking about an old one. So when a MessageChange or MessageDelete event comes in there is no way to check which line needs to be altered. There is currently also no written way to do this.

I suggest using a kind of in-memory database structure where messages are linked to an integer. It will only keep a configurable amount (default probably 20-50) in memory, and manipulate these. This needs forking and rewriting of the https://github.com/chzyer/readline/issues/26 lib, or writing an alternative solution that is based on the same kind of method log.Setoutput() @chzyer uses.