Random quote send from a bot - Unexpected Identifyer





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















So I'm getting a weird error message which looks like this:



SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at /home/remix867/bot_commando/node_modules/require-all/index.js:52:46


So it worked before but I have all dependencies installed. The Javascript code looks like this:



const { Command } = require('discord.js-commando');
const { oneLine } = require('common-tags');
const { RichEmbed } = require('discord.js');
const config = require('../../config.json');
var quotes = config.quotes;


module.exports = class EchoCommand extends Command {
constructor(client) {
super(client, {
name: 'quote',
group: 'quote',
memberName: 'quote',
description: 'Echoes a random Quote.',
details: oneLine`,
I'll say out a quote`,
examples: ['quote']
});
}

const avatarURL = message.author.avatar ? message.author.avatarURL: 'https://discordapp.com/assets/0e291f67c9274a1abdddeb3fd919cbaa.png';
const embed = new Discord.RichEmbed()
.setAuthor(`${message.author.tag}`, `${avatarURL}`);
.setColor(0x0000FF);
.setDescription(quotes[Math.floor(Math.random() * quotes.length)]);
.setTimestamp();
await message.channel.send({
embed
});
};


The Config.json is just a simple json where all the random Quotes are stored.



The issue should be on Line 20 where I define the avatar URL but if I delete this line, it says something else on a different line with exactly the same error.



Thanks in advance :)










share|improve this question































    0















    So I'm getting a weird error message which looks like this:



    SyntaxError: Unexpected identifier
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /home/remix867/bot_commando/node_modules/require-all/index.js:52:46


    So it worked before but I have all dependencies installed. The Javascript code looks like this:



    const { Command } = require('discord.js-commando');
    const { oneLine } = require('common-tags');
    const { RichEmbed } = require('discord.js');
    const config = require('../../config.json');
    var quotes = config.quotes;


    module.exports = class EchoCommand extends Command {
    constructor(client) {
    super(client, {
    name: 'quote',
    group: 'quote',
    memberName: 'quote',
    description: 'Echoes a random Quote.',
    details: oneLine`,
    I'll say out a quote`,
    examples: ['quote']
    });
    }

    const avatarURL = message.author.avatar ? message.author.avatarURL: 'https://discordapp.com/assets/0e291f67c9274a1abdddeb3fd919cbaa.png';
    const embed = new Discord.RichEmbed()
    .setAuthor(`${message.author.tag}`, `${avatarURL}`);
    .setColor(0x0000FF);
    .setDescription(quotes[Math.floor(Math.random() * quotes.length)]);
    .setTimestamp();
    await message.channel.send({
    embed
    });
    };


    The Config.json is just a simple json where all the random Quotes are stored.



    The issue should be on Line 20 where I define the avatar URL but if I delete this line, it says something else on a different line with exactly the same error.



    Thanks in advance :)










    share|improve this question



























      0












      0








      0








      So I'm getting a weird error message which looks like this:



      SyntaxError: Unexpected identifier
      at createScript (vm.js:80:10)
      at Object.runInThisContext (vm.js:139:10)
      at Module._compile (module.js:616:28)
      at Object.Module._extensions..js (module.js:663:10)
      at Module.load (module.js:565:32)
      at tryModuleLoad (module.js:505:12)
      at Function.Module._load (module.js:497:3)
      at Module.require (module.js:596:17)
      at require (internal/module.js:11:18)
      at /home/remix867/bot_commando/node_modules/require-all/index.js:52:46


      So it worked before but I have all dependencies installed. The Javascript code looks like this:



      const { Command } = require('discord.js-commando');
      const { oneLine } = require('common-tags');
      const { RichEmbed } = require('discord.js');
      const config = require('../../config.json');
      var quotes = config.quotes;


      module.exports = class EchoCommand extends Command {
      constructor(client) {
      super(client, {
      name: 'quote',
      group: 'quote',
      memberName: 'quote',
      description: 'Echoes a random Quote.',
      details: oneLine`,
      I'll say out a quote`,
      examples: ['quote']
      });
      }

      const avatarURL = message.author.avatar ? message.author.avatarURL: 'https://discordapp.com/assets/0e291f67c9274a1abdddeb3fd919cbaa.png';
      const embed = new Discord.RichEmbed()
      .setAuthor(`${message.author.tag}`, `${avatarURL}`);
      .setColor(0x0000FF);
      .setDescription(quotes[Math.floor(Math.random() * quotes.length)]);
      .setTimestamp();
      await message.channel.send({
      embed
      });
      };


      The Config.json is just a simple json where all the random Quotes are stored.



      The issue should be on Line 20 where I define the avatar URL but if I delete this line, it says something else on a different line with exactly the same error.



      Thanks in advance :)










      share|improve this question
















      So I'm getting a weird error message which looks like this:



      SyntaxError: Unexpected identifier
      at createScript (vm.js:80:10)
      at Object.runInThisContext (vm.js:139:10)
      at Module._compile (module.js:616:28)
      at Object.Module._extensions..js (module.js:663:10)
      at Module.load (module.js:565:32)
      at tryModuleLoad (module.js:505:12)
      at Function.Module._load (module.js:497:3)
      at Module.require (module.js:596:17)
      at require (internal/module.js:11:18)
      at /home/remix867/bot_commando/node_modules/require-all/index.js:52:46


      So it worked before but I have all dependencies installed. The Javascript code looks like this:



      const { Command } = require('discord.js-commando');
      const { oneLine } = require('common-tags');
      const { RichEmbed } = require('discord.js');
      const config = require('../../config.json');
      var quotes = config.quotes;


      module.exports = class EchoCommand extends Command {
      constructor(client) {
      super(client, {
      name: 'quote',
      group: 'quote',
      memberName: 'quote',
      description: 'Echoes a random Quote.',
      details: oneLine`,
      I'll say out a quote`,
      examples: ['quote']
      });
      }

      const avatarURL = message.author.avatar ? message.author.avatarURL: 'https://discordapp.com/assets/0e291f67c9274a1abdddeb3fd919cbaa.png';
      const embed = new Discord.RichEmbed()
      .setAuthor(`${message.author.tag}`, `${avatarURL}`);
      .setColor(0x0000FF);
      .setDescription(quotes[Math.floor(Math.random() * quotes.length)]);
      .setTimestamp();
      await message.channel.send({
      embed
      });
      };


      The Config.json is just a simple json where all the random Quotes are stored.



      The issue should be on Line 20 where I define the avatar URL but if I delete this line, it says something else on a different line with exactly the same error.



      Thanks in advance :)







      javascript node.js discord.js commando






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 16 '18 at 19:35









      Federico Grandi

      3,29531230




      3,29531230










      asked Nov 16 '18 at 12:32









      DoggoDoggo

      4511623




      4511623
























          1 Answer
          1






          active

          oldest

          votes


















          1














          When you create a command with Commando, you need to put the code you want to execute inside the .run method of the class.

          In your case, the code should look like this:



          module.exports = class EchoCommand extends Command {
          constructor(client) {
          super(client, {
          name: 'quote',
          group: 'quote',
          memberName: 'quote',
          description: 'Echoes a random Quote.',
          details: oneLine `,
          I'll say out a quote`,
          examples: ['quote']
          });
          }

          async run(message) {
          const avatarURL = message.author.avatar ? message.author.avatarURL : 'https://discordapp.com/assets/0e291f67c9274a1abdddeb3fd919cbaa.png';
          const embed = new Discord.RichEmbed()
          .setAuthor(`${message.author.tag}`, `${avatarURL}`);
          .setColor(0x0000FF);
          .setDescription(quotes[Math.floor(Math.random() * quotes.length)]);
          .setTimestamp();
          await message.channel.send({
          embed
          });
          }
          };


          If you added arguments to your command, it would have looked like this:



          aysnc run(message, {arg1, arg2, arg3, ...args}) {...}





          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337993%2frandom-quote-send-from-a-bot-unexpected-identifyer%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            When you create a command with Commando, you need to put the code you want to execute inside the .run method of the class.

            In your case, the code should look like this:



            module.exports = class EchoCommand extends Command {
            constructor(client) {
            super(client, {
            name: 'quote',
            group: 'quote',
            memberName: 'quote',
            description: 'Echoes a random Quote.',
            details: oneLine `,
            I'll say out a quote`,
            examples: ['quote']
            });
            }

            async run(message) {
            const avatarURL = message.author.avatar ? message.author.avatarURL : 'https://discordapp.com/assets/0e291f67c9274a1abdddeb3fd919cbaa.png';
            const embed = new Discord.RichEmbed()
            .setAuthor(`${message.author.tag}`, `${avatarURL}`);
            .setColor(0x0000FF);
            .setDescription(quotes[Math.floor(Math.random() * quotes.length)]);
            .setTimestamp();
            await message.channel.send({
            embed
            });
            }
            };


            If you added arguments to your command, it would have looked like this:



            aysnc run(message, {arg1, arg2, arg3, ...args}) {...}





            share|improve this answer




























              1














              When you create a command with Commando, you need to put the code you want to execute inside the .run method of the class.

              In your case, the code should look like this:



              module.exports = class EchoCommand extends Command {
              constructor(client) {
              super(client, {
              name: 'quote',
              group: 'quote',
              memberName: 'quote',
              description: 'Echoes a random Quote.',
              details: oneLine `,
              I'll say out a quote`,
              examples: ['quote']
              });
              }

              async run(message) {
              const avatarURL = message.author.avatar ? message.author.avatarURL : 'https://discordapp.com/assets/0e291f67c9274a1abdddeb3fd919cbaa.png';
              const embed = new Discord.RichEmbed()
              .setAuthor(`${message.author.tag}`, `${avatarURL}`);
              .setColor(0x0000FF);
              .setDescription(quotes[Math.floor(Math.random() * quotes.length)]);
              .setTimestamp();
              await message.channel.send({
              embed
              });
              }
              };


              If you added arguments to your command, it would have looked like this:



              aysnc run(message, {arg1, arg2, arg3, ...args}) {...}





              share|improve this answer


























                1












                1








                1







                When you create a command with Commando, you need to put the code you want to execute inside the .run method of the class.

                In your case, the code should look like this:



                module.exports = class EchoCommand extends Command {
                constructor(client) {
                super(client, {
                name: 'quote',
                group: 'quote',
                memberName: 'quote',
                description: 'Echoes a random Quote.',
                details: oneLine `,
                I'll say out a quote`,
                examples: ['quote']
                });
                }

                async run(message) {
                const avatarURL = message.author.avatar ? message.author.avatarURL : 'https://discordapp.com/assets/0e291f67c9274a1abdddeb3fd919cbaa.png';
                const embed = new Discord.RichEmbed()
                .setAuthor(`${message.author.tag}`, `${avatarURL}`);
                .setColor(0x0000FF);
                .setDescription(quotes[Math.floor(Math.random() * quotes.length)]);
                .setTimestamp();
                await message.channel.send({
                embed
                });
                }
                };


                If you added arguments to your command, it would have looked like this:



                aysnc run(message, {arg1, arg2, arg3, ...args}) {...}





                share|improve this answer













                When you create a command with Commando, you need to put the code you want to execute inside the .run method of the class.

                In your case, the code should look like this:



                module.exports = class EchoCommand extends Command {
                constructor(client) {
                super(client, {
                name: 'quote',
                group: 'quote',
                memberName: 'quote',
                description: 'Echoes a random Quote.',
                details: oneLine `,
                I'll say out a quote`,
                examples: ['quote']
                });
                }

                async run(message) {
                const avatarURL = message.author.avatar ? message.author.avatarURL : 'https://discordapp.com/assets/0e291f67c9274a1abdddeb3fd919cbaa.png';
                const embed = new Discord.RichEmbed()
                .setAuthor(`${message.author.tag}`, `${avatarURL}`);
                .setColor(0x0000FF);
                .setDescription(quotes[Math.floor(Math.random() * quotes.length)]);
                .setTimestamp();
                await message.channel.send({
                embed
                });
                }
                };


                If you added arguments to your command, it would have looked like this:



                aysnc run(message, {arg1, arg2, arg3, ...args}) {...}






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 16 '18 at 19:41









                Federico GrandiFederico Grandi

                3,29531230




                3,29531230
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337993%2frandom-quote-send-from-a-bot-unexpected-identifyer%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine