-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
115 lines (66 loc) · 2.88 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
const { Client } = require('discord.js');
const Color = `RANDOM`;
const Fetch = require("node-fetch");
const Discord = require('discord.js');
const { token, mid ,jid ,pid , nid} = require('./config.json');
const client = new Client({
disableMentions: 'everyone'
});
client.once('ready', () => {
console.log(`Hi! im ready `);
setInterval(async() => {
const channel = client.channels.cache.get(mid);
if (!channel) return console.log('No meme channel was found');
const Reds = [
"memes",
"meme",
"dankmemes",
];
const Rads = Reds[Math.floor(Math.random() * Reds.length)];
const res = await Fetch(`https://www.reddit.com/r/${Rads}/random/.json`);
const json = await res.json();
if (!json[0]) return message.channel.send(`Sorry but a error ocurred while sending the meme `);
const data = json[0].data.children[0].data;
const Embed = new Discord.MessageEmbed()
.setColor(Color)
.setURL(`https://reddit.com${data.permalink}`)
.setTitle(data.title)
.setDescription(`Author : ${data.author}`)
.setImage(data.url)
.setFooter(`${data.ups || 0} 👍 | ${data.downs || 0} 👎 | ${data.num_comments || 0} 💬`)
.setTimestamp();
await channel.send(Embed).catch(console.error)
}, 10000);
setInterval(async() => {
let nchannel = client.channels.cache.get(nid);
if (!nchannel) return console.log('No Nekos channel was found ');
const sub = [
"Cuteanimenekos",
"Waifu",
];
const Rads = sub[Math.floor(Math.random() * sub.length)];
const res = await Fetch(`https://www.reddit.com/r/${Rads}/random/.json`);
const json = await res.json();
if (!json[0]) return message.channel.send(`Sorry but a error ocurred while sending the neko `);
const data = json[0].data.children[0].data;
const Embed = new Discord.MessageEmbed()
.setColor(Color)
.setURL(`https://reddit.com${data.permalink}`)
.setTitle(data.title)
.setImage(data.url)
.setFooter(`${data.ups || 0} 👍 | ${data.downs || 0} 👎 | ${data.num_comments || 0} 💬`)
.setTimestamp();
return nchannel.send(Embed).catch(console.error)
}, 10000);
setInterval(async() => {
let pchannel = client.channels.cache.get(pid);
if(!pchannel){console.log("Wrong channel id provided or no channel id provided lol!")}
let Embed = new Discord.MessageEmbed()
.setColor(Color)
.setImage('https://source.unsplash.com/random')
await pchannel.send(Embed).catch(console.error) please give me credits
}, 10000);
});
client.login(token).catch(err => {
console.log('Lol a wrong token was provided try replacing or regenerating it?');
});