Skip to content

Commit

Permalink
Update random.js
Browse files Browse the repository at this point in the history
Fixy wixy not numeric characters in limit parameter
  • Loading branch information
axotion authored Dec 11, 2018
1 parent a0b5c50 commit a551fab
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/commands/random.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,10 @@ async function find(message) {
if (args[0] !== undefined && args[0] > 10) {
message.reply(`I can't send you more than **10** messages :confused:`)
} else {
let res
if (args[0] == '') {
res = await axios.get(
`https://www.reddit.com/r/random/top.json?limit=1`
);
} else {
res = await axios.get(
`https://www.reddit.com/r/random/top.json?limit=${args[0]}`
);
}


const posts = res.data.data.children;
let res = await axios.get(
`https://www.reddit.com/r/random/top.json?limit=1`
);
const posts = res.data.data.children;
if (posts.lenght == 0) {
message.reply(`Nothing new in **${args[0]}** :confused: `);
return;
Expand Down

0 comments on commit a551fab

Please sign in to comment.