-
Notifications
You must be signed in to change notification settings - Fork 598
Conversation
Awesome work @MikeShi42 ! It could default to 0 and that way people still have all the power they need just in case. |
Also: Is there any verification of input we can do? i.e. checking if |
@Schmavery we can def do some client side checking as well (sorry the code is hackish). It seems like FB will happily take the invalid input and just toss it out when rendering in terms of errors, it would be nice for the library to tell the user that their mention is 'invalid'. As for the fromIndex, are you thinking of it being an optional property in the passed in object? It seems like a good idea, and along that lines we can also include a toIndex for more flexibility. Additionally, how do you feel about the documentation? I know the API I've created is a bit bulkier than other fields so I had some trouble trying to explain it well and just attached an example which hopefully would clear things up. |
I think the example works well for docs. You can make a note in the description of the field to see below for an example (bonus points for making it link). I think it makes sense to just add the Yeah basically some error or warning when |
src/sendMessage.js
Outdated
const mention = msg.mentions[i]; | ||
|
||
const tag = mention.tag; | ||
if (typeof tag !== "string") |
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.
can you add curly braces :D
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.
yup c:
Thanks @MikeShi42 ! |
* Added mentions sendMessage handler + docs. * Mentions: Added fromIndex, checks and warnings
Added the ability to use mentions in the sendMessage object so that a bot can ping specific people.
Main issue is that tag location is determined with
indexOf
which is a bit scrappy. It provides a good balance of ease of use as the tag text can just be passed in, instead of the user having to figure out where the tag is in the string themselves. Can be changed to also explicitly take in beginning + ending index of the string as well.