Last active
October 3, 2021 16:43
-
-
Save wrongbyte/7c3e74145fcfb25ab81d7450e7f57832 to your computer and use it in GitHub Desktop.
simplest bot ever
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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