Bifrucate commands between discord and twitch


#1

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.


#2

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.


#3

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


#4

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.