Skip to content

Instantly share code, notes, and snippets.

@tt024
Last active March 10, 2023 02:59
Show Gist options
  • Save tt024/fe708778efd7d1bbe0920c7e0897b271 to your computer and use it in GitHub Desktop.
Save tt024/fe708778efd7d1bbe0920c7e0897b271 to your computer and use it in GitHub Desktop.
Discord.JS - Send random cat pics
const Discord = require("discord.js");
const client = new Discord.Client();
const {get} = require("snekfetch");
const TOKEN = 'YOUR_BOT_TOKEN_HERE'
const PREFIX = ";;";
client.on('message', message => {
if (message.content.startsWith(PREFIX + 'cat')) {
try {
get('https://aws.random.cat/meow').then(response => {
message.channel.send({files: [{attachment: response.body.file, name: `cat.${response.body.file.split('.')[4]}`}]});
console.log('random cat picture');
})
} catch (e) {
console.log('error!');
}
};
});
client.login(TOKEN);
// from https://github.com/trrb
@Deveroonie
Copy link

what can i use instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment