Skip to content

Instantly share code, notes, and snippets.

@wrongbyte
Last active October 3, 2021 16:43
Show Gist options
  • Select an option

  • Save wrongbyte/7c3e74145fcfb25ab81d7450e7f57832 to your computer and use it in GitHub Desktop.

Select an option

Save wrongbyte/7c3e74145fcfb25ab81d7450e7f57832 to your computer and use it in GitHub Desktop.
simplest bot ever
// Get random anime quotes by sending 'quote'
// requires nodeJS v >= 16
const Discord = require('discord.js');
const axios = require('axios');
const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MESSAGES']});
async function getAnimeQuote(){
let res = await axios.get('https://animechan.vercel.app/api/random');
quote = res.data.quote
character = res.data.character
return `> "${quote}", ${character}`
}
// Just to see when you're connected
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('messageCreate', msg => {
if (msg.content === 'quote') {
getAnimeQuote().then((quote)=>{
msg.reply(quote);
})
}
});
client.login(process.env.TOKEN);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment