admin管理员组文章数量:1405563
I am extremely new to Javascript and Discord.js, meaning that I copy most of my code online and try to understand them. I tried this google search mand. However, my bot does not send anything. The only thing it sends is "Need Input" when I type .google. When I do input a search, it does not plete the task. It does not give me an error in my mand prompt. Have I done something wrong? Do you have a pletely different code? PS. My code is from .js
I have installed npm i google, but it sends me a lot of errors when I do.
const google = require('google');
const Discord = require(`discord.js`);
exports.run = (client, message) => {
if (!suffix) {
message.channel.send({
embed: {
color: 0xff2727,
description: `:warning: **${message.author.username}**, You didn't give me anything to search. {.google \`input\`}`,
}
});
}
google.resultsPerPage = 5;
google(suffix, function (err, res) {
if (err) message.channel.send({
embed: {
color: 0xff2727,
description: `:warning: **${message.author.username}**, ${err}`,
footer: {
text: 'API Lantancy is ' + `${Date.now() - message.createdTimestamp}` + ' ms',
}
}
});
for (var i = 0; i < res.links.length; ++i) {
var link = res.links[i];
if (!link.href) {
res.next;
} else {
let embed = new Discord.RichEmbed()
.setColor(`#ffffff`)
.setAuthor(`Result for "${suffix}"`, `.svg/2000px-Google_%22G%22_Logo.svg.png`)
.setDescription(`**Link**: [${link.title}](${link.href})\n**Description**:\n${link.description}`)
.setTimestamp()
.setFooter('API Lantancy is ' + `${Date.now() - message.createdTimestamp}` + ' ms', message.author.displayAvatarURL);
return message.channel.send({
embed: embed
});
} return message.react("
本文标签:
javascriptHow to create a google search command in a discord botStack Overflow
版权声明:本文标题:javascript - How to create a google search command in a discord bot? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人,
转载请联系作者并注明出处:http://www.betaflare.com/web/1744340862a2601466.html,
本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论