{"action":"opened","issue":{"url":"https://api.github.com/repos/dirigeants/klasa/issues/181","repository_url":"https://api.github.com/repos/dirigeants/klasa","labels_url":"https://api.github.com/repos/dirigeants/klasa/issues/181/labels{/name}","comments_url":"https://api.github.com/repos/dirigeants/klasa/issues/181/comments","events_url":"https://api.github.com/repos/dirigeants/klasa/issues/181/events","html_url":"https://github.com/dirigeants/klasa/issues/181","id":296124350,"number":181,"title":"Bug: Prompting with cmdEditing","user":{"login":"kyranet","id":24852502,"avatar_url":"https://avatars0.githubusercontent.com/u/24852502?v=4","gravatar_id":"","url":"https://api.github.com/users/kyranet","html_url":"https://github.com/kyranet","followers_url":"https://api.github.com/users/kyranet/followers","following_url":"https://api.github.com/users/kyranet/following{/other_user}","gists_url":"https://api.github.com/users/kyranet/gists{/gist_id}","starred_url":"https://api.github.com/users/kyranet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyranet/subscriptions","organizations_url":"https://api.github.com/users/kyranet/orgs","repos_url":"https://api.github.com/users/kyranet/repos","events_url":"https://api.github.com/users/kyranet/events{/privacy}","received_events_url":"https://api.github.com/users/kyranet/received_events","type":"User","site_admin":false},"labels":[{"id":681910023,"url":"https://api.github.com/repos/dirigeants/klasa/labels/Bug:%20Confirmed","name":"Bug: Confirmed","color":"ffff00","default":false}],"state":"open","locked":false,"assignee":{"login":"bdistin","id":18535830,"avatar_url":"https://avatars2.githubusercontent.com/u/18535830?v=4","gravatar_id":"","url":"https://api.github.com/users/bdistin","html_url":"https://github.com/bdistin","followers_url":"https://api.github.com/users/bdistin/followers","following_url":"https://api.github.com/users/bdistin/following{/other_user}","gists_url":"https://api.github.com/users/bdistin/gists{/gist_id}","starred_url":"https://api.github.com/users/bdistin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdistin/subscriptions","organizations_url":"https://api.github.com/users/bdistin/orgs","repos_url":"https://api.github.com/users/bdistin/repos","events_url":"https://api.github.com/users/bdistin/events{/privacy}","received_events_url":"https://api.github.com/users/bdistin/received_events","type":"User","site_admin":false},"assignees":[{"login":"bdistin","id":18535830,"avatar_url":"https://avatars2.githubusercontent.com/u/18535830?v=4","gravatar_id":"","url":"https://api.github.com/users/bdistin","html_url":"https://github.com/bdistin","followers_url":"https://api.github.com/users/bdistin/followers","following_url":"https://api.github.com/users/bdistin/following{/other_user}","gists_url":"https://api.github.com/users/bdistin/gists{/gist_id}","starred_url":"https://api.github.com/users/bdistin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdistin/subscriptions","organizations_url":"https://api.github.com/users/bdistin/orgs","repos_url":"https://api.github.com/users/bdistin/repos","events_url":"https://api.github.com/users/bdistin/events{/privacy}","received_events_url":"https://api.github.com/users/bdistin/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-02-10T19:00:30Z","updated_at":"2018-02-10T19:00:30Z","closed_at":null,"author_association":"MEMBER","body":"### Describe the issue\r\n\r\nWhen [KlasaClientOptions.cmdEditing](https://klasa.js.org/#/docs/main/master/typedef/KlasaClientOptions) is set to true and command prompt are enabled (formerly known as `KlasaClientOptions.cmdPrompt` before the refactor), Klasa identifies message edits as new messages, therefore, prompts will identify command edits as the response (which is unwanted most of the time).\r\n\r\n**Proposal**: To fix this issue, we should check if the message received is the same as the one that triggered the prompt. In that case, return an invalid value (i.e. null). As throwing will be (in most cases) identified as the lack of a response. This will be handled by the developer (a notice should be made in the documentation via the JSDoc).\r\n\r\nIf the message is edited during Usage's prompt, Klasa should cancel the current command execution and re-parse it. That way, when you do:\r\n\r\n```bash\r\ns!conf set prefix\r\n```\r\n\r\nYou'll be prompted by Usage asking for the value to set. And then you edit it to:\r\n\r\n```bash\r\ns!conf set prefix m!\r\n```\r\n\r\nThat'll identify `s!conf set prefix m!` as the accepted value, in this case, making that the new prefix (in practice this will error as there's a maximum number of characters in the schema) and will run the same command but with `m!` as the value. This is pretty dangerous in some cases as, related to #180, ratelimits aren't applied during command parsing but after successful command run, so you could call the command multiple times with the prompt and edit them later, causing a fatal issue.\r\n\r\nTo counter this issue, I propose prompt cancellation when the captured message in [`Message#prompt()`](https://klasa.js.org/#/docs/main/master/class/KlasaMessage?scrollTo=prompt) is the same one as the message that called the prompt.\r\n\r\n### Further details\r\n\r\n- **discord.js version**: master\r\n- **node.js version**: 9.3.0\r\n- **Klasa version**: 0.5.0-dev\r\n- [ ] I have modified core files.\r\n- [x] I have tested the issue on latest master.\r\n"}}
{"actor":{"display_login":"kyranet"}}