File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * Alias for awww command
3+ * @param {Client } client Discord server client
4+ * @param {Message } msg Command
5+ * @param {Array } args Command arguments
6+ */
7+ module . exports = async ( client , msg , args ) => {
8+ require ( './awww' ) ( client , msg , args ) ;
9+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * Alias for awww command
3+ * @param {Client } client Discord server client
4+ * @param {Message } msg Command
5+ * @param {Array } args Command arguments
6+ */
7+ module . exports = async ( client , msg , args ) => {
8+ require ( './awww' ) ( client , msg , args ) ;
9+ }
Original file line number Diff line number Diff line change 1+ const host = 'www.reddit.com' ;
2+ const endpoint = '/r/awww/random.json'
3+
4+ const { authenticatedGet } = require ( '../lib/Internet' ) ;
5+ const log = require ( 'log4js' ) . getLogger ( 'amy' ) ;
6+
7+ /**
8+ * Returns a random photo from /r/awww
9+ * @param {Client } client Discord server client
10+ * @param {Message } msg Command
11+ * @param {Array } args Arguments
12+ */
13+ module . exports = async ( client , msg , args ) => {
14+ try {
15+ authenticatedGet ( function ( data ) {
16+ if ( data
17+ && data . length > 0
18+ && data [ 0 ]
19+ && data [ 0 ] . data
20+ && data [ 0 ] . data . children
21+ && data [ 0 ] . data . children . length > 0
22+ && data [ 0 ] . data . children [ 0 ] . data
23+ && data [ 0 ] . data . children [ 0 ] . data . url_overridden_by_dest ) {
24+ const link = data [ 0 ] . data . children [ 0 ] . data . url_overridden_by_dest ;
25+ if ( link . startsWith ( 'https://www.reddit.com' ) ) {
26+ msg . channel . send ( `Check out this Reddit gallery (auto-gallery coming soon!): ${ link } ` ) ;
27+ } else {
28+ msg . channel . send ( link ) ;
29+ }
30+ } else {
31+ msg . channel . send ( "That didn't work... try again?" ) ;
32+ }
33+ } , host , endpoint , { } , {
34+ 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)'
35+ } ) ;
36+ } catch ( err ) {
37+ log . error ( `While trying to grab a Reddit battlestation I got ${ err } ` ) ;
38+ }
39+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * Alias for awww command
3+ * @param {Client } client Discord server client
4+ * @param {Message } msg Command
5+ * @param {Array } args Command arguments
6+ */
7+ module . exports = async ( client , msg , args ) => {
8+ require ( './awww' ) ( client , msg , args ) ;
9+ }
Original file line number Diff line number Diff line change 11{
22 "name" : " amy" ,
3- "version" : " 3.0.5 " ,
3+ "version" : " 3.1.0 " ,
44 "description" : " Your personal assisstant, reimagined" ,
55 "author" : " Gideon Tong <gideon@gideontong.com>" ,
66 "main" : " index.js" ,
You can’t perform that action at this time.
0 commit comments