diff --git a/README.md b/README.md index 4ed32260..3ad2d60c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ You can join the home server with [this link](https://discord.gg/fqQF8mc). [discord.js](https://discord.js.org/#/), [commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/) ## APIs -[Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Yoda Speak](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Yandex.Translate](https://translate.yandex.com/developers), [Wikipedia](https://en.wikipedia.org/w/api.php) +[Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Yoda Speak](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Yandex.Translate](https://translate.yandex.com/developers), [Wikipedia](https://en.wikipedia.org/w/api.php), [Google Static Maps](https://developers.google.com/maps/documentation/static-maps/) ## Self-Hosting You can Self-Host the bot easily, provided you have API keys and a Discord Bot Token. [Node.js](https://nodejs.org/en/) is also required, with at least version 7.8.0 recommended. diff --git a/commands/search/map.js b/commands/search/map.js new file mode 100644 index 00000000..100f8f29 --- /dev/null +++ b/commands/search/map.js @@ -0,0 +1,55 @@ +const { Command } = require('discord.js-commando'); +const request = require('superagent'); + +module.exports = class MapCommand extends Command { + constructor(client) { + super(client, { + name: 'map', + aliases: [ + 'location' + ], + group: 'search', + memberName: 'map', + description: 'Gets a map image for the location you define with the zoom level you define (1-20). (;map 15 Cartersville, GA)', + examples: [';map 15 Cartersville, GA'], + args: [{ + key: 'zoom', + prompt: 'What would you like the zoom level for the map to be? Limit 1-20.', + type: 'integer', + validate: zoom => { + if (zoom < 21 && zoom > 0) { + return true; + } + return 'Please enter a zoom value from 1-20'; + } + }, { + key: 'locationQ', + prompt: 'What location you like to get a map image for?', + type: 'string' + }] + }); + } + + async run(message, args) { + if (message.channel.type !== 'dm') { + if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return; + if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!'); + } + const zoom = args.zoom; + const locationQ = args.locationQ; + try { + const response = await request + .get('https://maps.googleapis.com/maps/api/staticmap') + .query({ + center: locationQ, + zoom: zoom, + size: '500x500', + key: process.env.GOOGLE_KEY + }); + return message.channel.sendFile(response.body); + } + catch (err) { + return message.say(':x: Error! Something went wrong! Make sure you entered the location correctly!'); + } + } +}; diff --git a/commands/search/youtube.js b/commands/search/youtube.js index 6b534f83..a39ef232 100644 --- a/commands/search/youtube.js +++ b/commands/search/youtube.js @@ -35,7 +35,7 @@ module.exports = class YouTubeCommand extends Command { type: 'video', maxResults: 1, q: video, - key: process.env.YOUTUBE_KEY + key: process.env.GOOGLE_KEY }); const data = response.body.items[0]; const embed = new RichEmbed() diff --git a/commands/util/info.js b/commands/util/info.js index 9c5a3d1f..d4acb14a 100644 --- a/commands/util/info.js +++ b/commands/util/info.js @@ -33,7 +33,7 @@ module.exports = class InfoCommand extends Command { .addField('Shards', `${this.client.options.shardCount} (${this.client.shard.id})`, true) .addField('Commands', - '110', true) + '111', true) .addField('Owner', 'dragonfire535#8081', true) .addField('Source Code', @@ -49,7 +49,7 @@ module.exports = class InfoCommand extends Command { .addField('Modules', '[commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)') .addField('APIs', - '[Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Yoda Speak](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Yandex.Translate](https://translate.yandex.com/developers), [Wikipedia](https://en.wikipedia.org/w/api.php)'); + '[Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Yoda Speak](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Yandex.Translate](https://translate.yandex.com/developers), [Wikipedia](https://en.wikipedia.org/w/api.php), [Google Static Maps](https://developers.google.com/maps/documentation/static-maps/)'); return message.embed(embed); } }; diff --git a/html/carbondesc.html b/html/carbondesc.html index 4919462f..5d048cf3 100644 --- a/html/carbondesc.html +++ b/html/carbondesc.html @@ -44,6 +44,7 @@
  • Yahoo Weather
  • Yandex.Translate
  • Wikipedia
  • +
  • Google Static Maps
  • Information

    Information

    diff --git a/package.json b/package.json index 7a504dcb..fed87868 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "24.4.0", + "version": "24.5.0", "description": "A Discord Bot", "main": "shardingmanager.js", "scripts": {