Bug in customapijson


An issue with this recently was fixed here:

But I recently ran into another issue:
customapijson automatically adds a space after literal strings. For example:

!addcom jokes (customapijson https://icanhazdadjoke.com/slack {Test:} attachments.0.text)
Will print:
Test: To the guy who invented zero… thanks for nothing.
While it should print
Test:To the guy who invented zero… thanks for nothing.

as there is not space after ‘:’ in the literal string. This would have been expected if it was:
!addcom jokes (customapijson https://icanhazdadjoke.com/slack {Test: } attachments.0.text)

I was trying to combine an ID returned from json to a part of a link that was part of literal string but I wasn’t able to as this was adding a space.


This is how the was designed to function, it’s as accommodating to as many various services as possible and changing it is not feasible for one service.


What are the advantages of the current design compared to the proposed design?


Or having an option where it doesn’t automatically add spaces. In it’s current state, you can not create a link with part of an API response and I feel like this is a restriction that can be avoided


There are no advantages, it will just break for users who never includes a space in the brackets in the first place. Also, I did not write this system, I did remove the spaces which didn’t seem to break anything, but I have no idea if there was a reason for including them in the first place.

Feel free to use the script at your own risk. (bot-folder/scripts/commands/customCommands.js)
customCommands.js (47.3 KB)


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.