├── package.json ├── README.md ├── LICENSE └── index.js /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AutoMeme-Bot", 3 | "version": "1.0.0", 4 | "author": "Mihai_Cit", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "dependencies": { 10 | "discord.js": "^12.5.0", 11 | "got": "^11.8.1" 12 | }, 13 | "engines": { 14 | "node": "12.x" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## AutoMeme-Bot 👻🤣 2 | 3 | **Very Simple AutoMeme Bot bc yea** 4 | 5 | ### Requirements: 6 | ``` 7 | - discord.js | v12.5.1 8 | - got | v11.8.1 9 | ``` 10 | 11 | ### Setup: 12 | - Create a new application at https://discordapp.com/developers/applications 13 | - Turn it into a bot 14 | - Copy the token and put it in the main file `(index.js)` at `client.token('your bot token')` 15 | - `npm install` 16 | - `node index.js` 17 | 18 | ### Usage: 19 | ``` 20 | Turn On AutoMeme: !automeme 21 | Turn Off AutoMeme: Stop the bot or restart it (if you are on Glitch just put a empty space and delete it in any file) 22 | ``` 23 | 24 | ### Leave a Star ⭐ 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Mihai_Cit 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js"); 2 | const client = new Discord.Client(); 3 | const got = require("got"); 4 | 5 | client.on("ready", () => { 6 | console.log(`Logged in as ${client.user.tag}!`); 7 | }); 8 | 9 | client.on("message", message => { 10 | if(message.content === "!automeme") { 11 | if (!message.member.hasPermission("ADMINISTRATOR")) { 12 | return message.reply("you don't have permission") 13 | } 14 | 15 | message.channel.send("🔄 **| AutoMeme Starting... (`Please wait 20s`)**").then((msg) => { 16 | setTimeout(function(){ 17 | msg.edit("🔄 **| AutoMeme Starting... (`Please Wait 10s`)**") 18 | setTimeout(function(){ 19 | msg.edit("✅ **| AutoMeme Started**") 20 | }, 10000) 21 | }, 10000) 22 | }) //edit the message to look cool 23 | setInterval(() => { 24 | got("https://www.reddit.com/r/memes/random/.json").then(response => { 25 | const [list] = JSON.parse(response.body); 26 | const [post] = list.data.children; 27 | 28 | const permalink = post.data.permalink; 29 | const memeUrl = `https://reddit.com${permalink}`; 30 | const memeImage = post.data.url; 31 | const memeTitle = post.data.title; 32 | const memeUpvotes = post.data.ups; 33 | const memeNumComments = post.data.num_comments; 34 | 35 | const embed = new Discord.MessageEmbed() 36 | .setTitle(`${memeTitle}`) 37 | .setURL(`${memeUrl}`) 38 | .setColor("GREEN") 39 | .setImage(memeImage) 40 | .setFooter(`👍: ${memeUpvotes} | 💬: ${memeNumComments}`); 41 | 42 | message.channel.send(embed) 43 | }) 44 | }, 20000) //I recommend to put it above 20s to not abuse Discord Api lol 45 | 46 | } 47 | }); 48 | 49 | client.login("YOUR BOT TOKEN"); 50 | --------------------------------------------------------------------------------