mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 22:27:44 +02:00
Discord auto-embeds
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
const { Command } = require('discord.js-commando');
|
const { Command } = require('discord.js-commando');
|
||||||
const snekfetch = require('snekfetch');
|
const snekfetch = require('snekfetch');
|
||||||
const { stripIndents } = require('common-tags');
|
|
||||||
const { GOOGLE_KEY, CUSTOM_SEARCH_ID } = process.env;
|
const { GOOGLE_KEY, CUSTOM_SEARCH_ID } = process.env;
|
||||||
|
|
||||||
module.exports = class GoogleCommand extends Command {
|
module.exports = class GoogleCommand extends Command {
|
||||||
@@ -33,12 +32,7 @@ module.exports = class GoogleCommand extends Command {
|
|||||||
});
|
});
|
||||||
if (!body.items) return msg.say('Could not find any results.');
|
if (!body.items) return msg.say('Could not find any results.');
|
||||||
const data = body.items[0];
|
const data = body.items[0];
|
||||||
return msg.say(stripIndents`
|
return msg.say(data.formattedUrl);
|
||||||
**${data.title}**
|
|
||||||
${data.snippet.replace(/\n/g, '')}
|
|
||||||
|
|
||||||
${data.formattedUrl}
|
|
||||||
`);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.say(`http://lmgtfy.com/?iie=1&q=${encodeURIComponent(query)}`);
|
return msg.say(`http://lmgtfy.com/?iie=1&q=${encodeURIComponent(query)}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user