Bifrucate commands between discord and twitch


I have a custom API that returns a response containing a twitch emote. It would be ideal if I could change this to a discord emoji if the request came from discord.


Hiya. You could do something with eval in the response:
$(eval if('$(provider)'=='twitch'){ 'twitch' } else if('$(provider)'=='discord'){ 'discord' })

Or you can send the $(provider) as GET parameter to your server and send back the right emoji based on the provider.


Brilliant. I didn’t know about provider. That’s ideal. Thanks!!!


No problem, thought I should add this info in case you didn’t know, the provider (and user/channel info) are automaticly send with each UrlFetch reqeust in the headers. See UrlFetch “Advanced Usage” for more info.