mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 05:49:49 +02:00
updoot
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { googleKey } = require('../../config');
|
||||
|
||||
module.exports = class MapCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'map',
|
||||
group: 'search',
|
||||
memberName: 'map',
|
||||
description: 'Responds with a map based upon your query.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'zoom',
|
||||
label: 'zoom level',
|
||||
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;
|
||||
else return 'Please enter a zoom value from 1-20';
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What location you like to get a map image for?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const { zoom, query } = args;
|
||||
const { body } = await snekfetch
|
||||
.get('https://maps.googleapis.com/maps/api/staticmap')
|
||||
.query({
|
||||
center: query,
|
||||
zoom,
|
||||
size: '500x500',
|
||||
key: googleKey
|
||||
});
|
||||
return msg.say({ files: [{ attachment: body, name: 'map.png' }] });
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user