diff --git a/commands/strain.js b/commands/strain.js new file mode 100644 index 0000000..db5bf51 --- /dev/null +++ b/commands/strain.js @@ -0,0 +1,22 @@ +const axios = require('axios').default; +const options = { + method: 'GET', + url: 'https://brianiswu-otreeba-open-cannabis-v1.p.rapidapi.com/strains', + headers: { + 'x-rapidapi-key': '0b3f85bcb7msh1e6e80e963c9914p1d1934jsnc3542fc83520', + 'x-rapidapi-host': 'brianiswu-otreeba-open-cannabis-v1.p.rapidapi.com' + } +}; + +module.exports = { + name: 'strain', + description: 'Search for information about a cannabis strain. Powered by Otreeba', + execute(message, file) { + options.url = options.url + '?name=' + file.name; + axios.request(options).then(function (response) { + console.log(response.data); + }).catch(function (error) { + console.error(error); + }); + } +} \ No newline at end of file diff --git a/commands/template b/commands/template index 527c41e..ed1de33 100644 --- a/commands/template +++ b/commands/template @@ -1,7 +1,9 @@ +const axios = require('axios').default; + module.exports = { - name: '', - description: '', - execute(message, args) { - message.channel.send(''); + name: 'strain', + description: 'Search for information about a cannabis strain. Powered by Otreeba', + execute(message, file) { + } } \ No newline at end of file diff --git a/config.json b/config.json index 2c0109a..17ad28d 100644 --- a/config.json +++ b/config.json @@ -14,7 +14,8 @@ "savegif", "truth", "joint", - "ping" + "ping", + "strain" ], "emoji": { "joint": "<:joint:862082955902976000>", diff --git a/package-lock.json b/package-lock.json index 4402a15..498121f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -223,6 +223,14 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, + "axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -816,6 +824,11 @@ "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", "dev": true }, + "follow-redirects": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz", + "integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==" + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", diff --git a/package.json b/package.json index 0543e35..8e151f4 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Nods and Nod Accessories.", "main": "index.js", "dependencies": { + "axios": "^0.21.1", "discord.js": "^12.5.3", "dotenv": "^10.0.0", "giphy-api": "^2.0.2",