-
Notifications
You must be signed in to change notification settings - Fork 0
/
calls.ts
40 lines (33 loc) · 825 Bytes
/
calls.ts
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
const axios = require("axios");
interface api {
data: {
data: {
children: [
{
data: {
url: string;
};
}
];
};
};
}
async function getMeme1(): Promise<string> {
let randInt: number = Math.floor(Math.random() * 25);
const res1: api = await axios.request({
method: "get",
url: "https://www.reddit.com/r/Animemes/top/.json",
});
let url = res1.data.data.children[randInt].data.url;
return url;
}
async function getWaifu1(): Promise<string> {
let randInt = Math.floor(Math.random() * 25);
const res1: api = await axios.request({
method: "get",
url: "https://www.reddit.com/r/Animewallpaper/top/.json",
});
let url = res1.data.data.children[randInt].data.url;
return url;
}
module.exports = { getMeme1, getWaifu1 };