-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3d8471
commit 7adc55a
Showing
5 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Alias for awww command | ||
* @param {Client} client Discord server client | ||
* @param {Message} msg Command | ||
* @param {Array} args Command arguments | ||
*/ | ||
module.exports = async (client, msg, args) => { | ||
require('./awww')(client, msg, args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Alias for awww command | ||
* @param {Client} client Discord server client | ||
* @param {Message} msg Command | ||
* @param {Array} args Command arguments | ||
*/ | ||
module.exports = async (client, msg, args) => { | ||
require('./awww')(client, msg, args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const host = 'www.reddit.com'; | ||
const endpoint = '/r/awww/random.json' | ||
|
||
const { authenticatedGet } = require('../lib/Internet'); | ||
const log = require('log4js').getLogger('amy'); | ||
|
||
/** | ||
* Returns a random photo from /r/awww | ||
* @param {Client} client Discord server client | ||
* @param {Message} msg Command | ||
* @param {Array} args Arguments | ||
*/ | ||
module.exports = async (client, msg, args) => { | ||
try { | ||
authenticatedGet(function (data) { | ||
if (data | ||
&& data.length > 0 | ||
&& data[0] | ||
&& data[0].data | ||
&& data[0].data.children | ||
&& data[0].data.children.length > 0 | ||
&& data[0].data.children[0].data | ||
&& data[0].data.children[0].data.url_overridden_by_dest) { | ||
const link = data[0].data.children[0].data.url_overridden_by_dest; | ||
if (link.startsWith('https://www.reddit.com')) { | ||
msg.channel.send(`Check out this Reddit gallery (auto-gallery coming soon!): ${link}`); | ||
} else { | ||
msg.channel.send(link); | ||
} | ||
} else { | ||
msg.channel.send("That didn't work... try again?"); | ||
} | ||
}, host, endpoint, {}, { | ||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)' | ||
}); | ||
} catch (err) { | ||
log.error(`While trying to grab a Reddit battlestation I got ${err}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Alias for awww command | ||
* @param {Client} client Discord server client | ||
* @param {Message} msg Command | ||
* @param {Array} args Command arguments | ||
*/ | ||
module.exports = async (client, msg, args) => { | ||
require('./awww')(client, msg, args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "amy", | ||
"version": "3.0.5", | ||
"version": "3.1.0", | ||
"description": "Your personal assisstant, reimagined", | ||
"author": "Gideon Tong <[email protected]>", | ||
"main": "index.js", | ||
|