From c20592195609357b1c890af34fae65431acc8578 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Mon, 15 Jun 2020 12:51:37 -0400 Subject: [PATCH] Smilebasic command --- README.md | 5 ++++- commands/other/smilebasic.js | 40 ++++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 commands/other/smilebasic.js diff --git a/README.md b/README.md index 405ff1df..3d5f43e5 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 486 +Total: 487 ### Utility: @@ -755,6 +755,7 @@ Total: 486 * **portal-send:** Send a message to a portal channel. * **prune:** Deletes up to 99 messages from the current channel. * **rename-all:** Renames every member of the server. (Owner-Only) +* **smilebasic:** Responds with a ZIP file for a SmileBASIC project. * **strawpoll:** Generates a Strawpoll with the options you provide. ### Roleplay: @@ -1401,6 +1402,8 @@ here. * brony-speak ([English-to-Brony Dictionary Data](https://www.deviantart.com/shrick/art/Brony-dictionary-version-2-207157029)) - [SinKillerJ Tachikawa](https://www.deviantart.com/sinkillerj) * steam-card ([Template](https://www.deviantart.com/sinkillerj/art/Steam-Trading-Card-Template-GIMP-372156984)) +- [SmileBASIC Source](https://smilebasicsource.com/) + * smilebasic ([API](https://smilebasicsource.com/page?pid=1360)) - [SMWiki](http://www.smwiki.net/) * smw-level ([Level Name Data](http://old.smwiki.net/wiki/List_of_Super_Mario_World_levels)) - [Snapchat](https://www.snapchat.com/) diff --git a/commands/other/smilebasic.js b/commands/other/smilebasic.js new file mode 100644 index 00000000..ff372fc7 --- /dev/null +++ b/commands/other/smilebasic.js @@ -0,0 +1,40 @@ +const Command = require('../../structures/Command'); +const request = require('node-superfetch'); + +module.exports = class SmilebasicCommand extends Command { + constructor(client) { + super(client, { + name: 'smilebasic', + group: 'other', + memberName: 'smilebasic', + description: 'Responds with a ZIP file for a SmileBASIC project.', + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'SmileBASIC Source', + url: 'https://smilebasicsource.com/', + reason: 'API', + reasonURL: 'https://smilebasicsource.com/page?pid=1360' + } + ], + args: [ + { + key: 'key', + prompt: 'What project key would you like to get a ZIP for?', + type: 'string', + parse: key => key.toUpperCase() + } + ] + }); + } + + async run(msg, { key }) { + try { + const { body } = await request.get(`http://sbapi.me/get/${key}/zip`); + return msg.say({ files: [{ attachment: body, name: `${key}.zip` }] }); + } catch (err) { + if (err.status === 404) return msg.say('Could not find any results. Invalid key?'); + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/package.json b/package.json index 110a8af2..f7d20aeb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "116.27.6", + "version": "116.28.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {