idomoo ❤️ Discord
By: Dan Shamir
Tags: Discord Bot, Dynamic Video, Bots, Discord, Sass

The gaming community flourishes on discord servers, giving players a way to connect, make new friends, and share victory stories.

Each respectful Discord server has its own BOT, a way to issue commands and help users interact or get information in a chat-like environment.

a week ago I was building my own bot to help my son orgenzie his minecraft friends.

While I was coding I was thinking about a way to make the bot’s response much more exciting and even sharable, in order to pull users to my server, and then I got the idea of using Idomoo’s API to generate dynamic media as a response for the end-users.

Animated gifs are a thing.

everyone knows that in the land of text messaging and social posts animated gifs add a way of making static boring things look better and have a unique way of making things sharable.

in my test case, I wanted users who participate in the server chat channel to get a rank for each 50 text posts they make, a nice common leveling system.

but I didn't want them to get the default “GOOD JOB, YOU GOT TO LEVEL 1” message I get from all-most all the servers I use in my day to day discord usage.

Step 1: Create a basic video Scene for my animation

using after effects and Idomoo’s toolset I create a small nice animation and exported it to the IDM format (Idomoo dynamic scene format).

Here is the small animation I made:

Leveling up animation

the template uses the nickname of the user, the profile picture, and the level number, I also made the knight image dynamic to make the art change to reflect the level (max is 10).

example of level 2 notification

Step 2: adding the Idomoo API call to my bot.

i used a simple node.js server with discord.js for the bot framework.

the event to generate a gif for the user fires when a counter reaches a certain number, the main function then sends a simple Idomoo API call:

var userImage= message.author.displayAvatarURL(); var options = {

uri: 'https://usa-api.idomoo.com/api/v2/storyboards/generate’,

method: 'POST’,

json: true,

headers: {’Content-Type’: 'application/json’,’Authorization’:’Basic *******************************’},

body: {

"storyboard_id":"39123210",

"output":{

"gif":[

{

"height":250,

"start":0

}

]

},

"data":[

{

"key":"me",

"val":userImage

},

{

"key":"score",

"val":UserScore

},

{

"key":"username",

"val":userName

},

{

"key":"background",

"val":backgroundimage

}

]

}

}

request(options, function myCallback(err, res, body){

const exampleEmbed = new Discord.MessageEmbed()

.setColor(’#000000’)

.setTitle(’Way to go '+msg.author.username+’!!!!’)

.setImage(body.output.gif[0].links.url)

msg.channel.send(exampleEmbed);

})

the code above sends a storyboard API call to the Idomoo service with a specific id corresponding to the scene I made on the Idomoo platform, then it passes parameters to that scene where each parameter is identified with a key and is given a value.

userimage = the profile pic for that discord user.

userscore = is the level

username = the discord profile name

background = the image for that level

The response you get is a URL link to the newly created animated gif.

All that’s left is sending it back to the channel.

All in realtime and very simple to implement.