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