API Examples ยป Ichigo API

Ichigo API Examples

Some code examples on how to use the API.


Discord.js (^12.2.0) and Superagent (^5.2.2)
      
    const Discord = require("discord.js");
    const superagent = require("superagent");

    exports.run = async (bot, message, args) => {

        let user = message.guild.member(message.mentions.users.first() || message.guild.members.fetch(args[0]));
        if(!user) return message.channel.send("**Love ๐Ÿ’ž |** Please mention a user!");

        const {body} = await superagent
        .get(`https://ichigo.ntmnathan.com/gif/pat`);
        .set("Authorization", "Bearer YOUR_TOKEN");

        let patembed = new Discord.MessageEmbed()
        .setTitle('**Pat ๐Ÿ˜‡**')
        .setDescription(`**${message.author.username}** patted **${message.mentions.users.first().username}!**`)
        .setImage(body.url)
        .setColor("#e889e0")

        message.channel.send(patembed)
    }
      
    
      
    const { body } = await get('https://ichigo.ntmnathan.com/text/hangman')
    .set("Authorization", "Bearer YOUR_TOKEN");
    const word = body[Math.floor(Math.random() * body.length)]
    
    //Handle this somehow.
      
    
              
    const { MessageEmbed } = require("discord.js");
    const { get } = require("superagent");

    exports.run = async (bot, message, args) => {

        const { body } = await get(`https://ichigo.ntmnathan.com/generators/3000years`)
        .query({ image: `${message.author.displayAvatarURL({ format: 'png', dynamic: true, size: 2048 })}` })
        .set("Authorization", "Bearer YOUR_TOKEN");

       const embed = new MessageEmbed()
         .setTitle(`**3000 Years**`)
         .attachFiles({ attachment: body, name: "3000years.png" })
         .setImage("attachment://3000years.png")
         .setColor(`#ed8a5c`);

       message.channel.send(embed);

    }
        
       

Eris (^0.12.0) and Axios (^0.19.2)

        
    const axios = require('axios');
    exports.run = async function (client, msg, args) {

       let user = msg.mentions[0] || client.users.get(args[0]);
       if(!user) user = msg.author;

       let fetch = await axios.get('https://ichigo.ntmnathan.com/gif/pat', {
          params: {
            apiKey: 'YOUR_TOKEN'
          }
        })
        
        msg.channel.createMessage({embed: {
            color: client.config.colors.success,
            title: `**Pat :innocent:**`,
            url: fetch.data.url,
            image: {
              url: fetch.data.url
            }
        }});
    };      
        
        

        
    Coming Soon