English 中文(简体)
Discord Bot Help。 不工作的指挥部
原标题:Discord Bot Help. Commands not working Nodejs

不能确定自己的法典或我对机器人的授权,因为这是我第一次造船。 我习惯把机器人添加到我的服务器上,是否运行,但指挥官根本不使用机器。 指挥。

目前,我得到机器人许可。

范围:海底信息和应用。

然后作为行政批准。

const {Client, IntentsBitField} = require ( discord.js );

const client = new Client ({
    intents: [
      IntentsBitField.Flags.Guilds,
      IntentsBitField.Flags.GuildMembers,
      IntentsBitField.Flags.GuildMessages,
      IntentsBitField.Flags.MessageContent,
    ],
});

const PREFIX =  ? ;

const heroInfo = {
   jack : {
    description:  A mischievous and agile hero with a quick wit. ,
    image:  URL_TO_IMAGE ,
    abilities: [ Ability 1: Sneaky Strike ,  Ability 2: Evasive Roll ],
    faction:  Rogue ,
    emblem:  URL_TO_EMBLEM_IMAGE ,
  },

  // Add more heroes as needed
};

const faqInfo = {
   9999 :  7777 ,
   question2 :  Answer to question 2 ,
  // Add more FAQs as needed
};

const minigameInfo = {
   99 :  Description of minigame 1 ,
   3 :  Description of minigame 2 ,
   Skating :  Description of minigame 3 ,
   4 :  Description of minigame 2 ,
  // Add more minigames as needed
};

const top5PvPTeams = [
   URL_TO_TEAM_IMAGE_1 ,
   URL_TO_TEAM_IMAGE_2 ,
   URL_TO_TEAM_IMAGE_3 ,
   URL_TO_TEAM_IMAGE_4 ,
   URL_TO_TEAM_IMAGE_5 ,
];

const top5PvETeams = [
   URL_TO_TEAM_IMAGE_1 ,
   URL_TO_TEAM_IMAGE_2 ,
   URL_TO_TEAM_IMAGE_3 ,
   URL_TO_TEAM_IMAGE_4 ,
   URL_TO_TEAM_IMAGE_5 ,
];

const elementalCityTeams = {
   fire : {
    dungeon:  Best team for Fire dungeon ,
    hardStage5:  URL_TO_FIRE_HARD_STAGE_5_IMAGE ,
    hardStage10:  URL_TO_FIRE_HARD_STAGE_10_IMAGE ,
    hardStage15:  URL_TO_FIRE_HARD_STAGE_15_IMAGE ,
  },
   ice : {
    dungeon:  Best team for Ice dungeon ,
    hardStage5:  URL_TO_ICE_HARD_STAGE_5_IMAGE ,
    hardStage10:  URL_TO_ICE_HARD_STAGE_10_IMAGE ,
    hardStage15:  URL_TO_ICE_HARD_STAGE_15_IMAGE ,
  },
   wood : {
    dungeon:  Best team for Wood dungeon ,
    hardStage5:  URL_TO_WOOD_HARD_STAGE_5_IMAGE ,
    hardStage10:  URL_TO_WOOD_HARD_STAGE_10_IMAGE ,
    hardStage15:  URL_TO_WOOD_HARD_STAGE_15_IMAGE ,
  },
   water : {
    dungeon:  Best team for Water dungeon ,
    hardStage5:  URL_TO_WATER_HARD_STAGE_5_IMAGE ,
    hardStage10:  URL_TO_WATER_HARD_STAGE_10_IMAGE ,
    hardStage15:  URL_TO_WATER_HARD_STAGE_15_IMAGE ,
  },
  // Add more elemental city teams as needed
};

const bossSpeedInfo = {
   888 : {
    stage26:  Stage 26 - 2320 speed ,
    stage27:  Stage 27 - 2440 speed ,
    stage28:  Stage 28 - 2560 speed ,
    stage29:  Stage 29 - 2680 speed ,
    stage30:  Stage 30 - 2800 speed ,
  },
   9999 : {
    stage35:  Stage 35 - 2320 speed ,
    stage36:  Stage 36 - 2360 speed ,
    stage37:  Stage 37 - 2420 speed ,
    stage38:  Stage 38 - 2480 speed ,
    stage39:  Stage 39 - 2540 speed ,
    stage40:  Stage 40 - 2620 speed ,
  },
  // Add more boss speeds as needed
};

client.on( ready , () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on( message , (message) => {
  if (!message.content.startsWith(PREFIX) || message.author.bot) return;

  const args = message.content.slice(PREFIX.length).split(   );
  const command = args.shift().toLowerCase();

  if (command ===  hero ) {
    const heroName = args.join(   ).toLowerCase();
    const heroData = heroInfo[heroName];

    if (heroData) {
      const embed = new Discord.MessageEmbed()
        .setColor( #0099ff )
        .setTitle(heroName.charAt(0).toUpperCase() + heroName.slice(1)) // Capitalize the hero name
        .setDescription(heroData.description)
        .addField( Abilities , heroData.abilities.join( 
 ))
        .addField( Faction , heroData.faction)
        .addField( Emblem , heroData.emblem)
        .setImage(heroData.image);

      message.channel.send(embed);
    } else {
      message.channel.send( Hero not found. Please check the hero name and try again. );
    }
  } else if (command ===  faq ) {
    const question = args.join(   ).toLowerCase();
    const answer = faqInfo[question];

    if (answer) {
      const embed = new Discord.MessageEmbed()
        .setColor( #0099ff )
        .setTitle( Frequently Asked Question )
        .addField( Question , question)
        .addField( Answer , answer);

      message.channel.send(embed);
    } else {
      message.channel.send( FAQ not found. Please check the question and try again. );
    }
  } else if (command ===  minigames ) {
    const minigame = args.join(   ).toLowerCase();
    const description = minigameInfo[minigame];

    if (description) {
      const embed = new Discord.MessageEmbed()
        .setColor( #0099ff )
        .setTitle( Minigame Information )
        .setDescription(description);

      message.channel.send(embed);
    } else {
      message.channel.send( Minigame not found. Please check the minigame name and try again. );
    }
  } else if (command ===  top5pvp ) {
    const embed = new Discord.MessageEmbed()
      .setColor( #ff0000 )
      .setTitle( Top 5 PvP Teams )
      .setDescription( Here are the top 5 PvP teams: )
      .setImage(top5PvPTeams.join( 
 ));

    message.channel.send(embed);
  } else if (command ===  top5pve ) {
    const embed = new Discord.MessageEmbed()
      .setColor( #00ff00 )
      .setTitle( Top 5 PvE Teams )
      .setDescription( Here are the top 5 PvE teams: )
      .setImage(top5PvETeams.join( 
 ));

    message.channel.send(embed);
  } else if (command ===  elementalcity ) {
    const dungeon = args[0].toLowerCase();
    const stage = args[1] ? `hardStage${parseInt(args[1])}` :  dungeon ;
    const imageUrl = elementalCityTeams[dungeon] && elementalCityTeams[dungeon][stage];

    if (imageUrl) {
      const embed = new Discord.MessageEmbed()
        .setColor( #0000ff )
        .setTitle(`Best Team for ${dungeon.charAt(0).toUpperCase() + dungeon.slice(1)} Dungeon - ${stage.replace( hardStage ,  Hard Stage  )}`)
        .setImage(imageUrl);

      message.channel.send(embed);
    } else {
      message.channel.send( Dungeon or stage not found. Please check the dungeon and stage and try again. );
    }
  } else if (command ===  speed ) {
    const faction = args.join(   ).toLowerCase();
    const speedInfo = bossSpeedInfo[faction];

    if (speedInfo) {
      const embed = new Discord.MessageEmbed()
        .setColor( #ffcc00 )
        .setTitle(`Boss Speeds for ${faction.charAt(0).toUpperCase() + faction.slice(1)}`)
        .setDescription(Object.values(speedInfo).join( 
 ));

      message.channel.send(embed);
    } else {
      message.channel.send( Faction not found. Please check the faction name and try again. );
    }
  }
});

client.login(  );

需要使其发挥作用。 如果我的不和许可或守则,我需要说明。

问题回答




相关问题
How to make Sequelize use singular table names

I have an model called User but Sequelize looks for the table USERS whenever I am trying to save in the DB. Does anyone know how to set Sequelize to use singular table names? Thanks.

What is Node.js? [closed]

I don t fully get what Node.js is all about. Maybe it s because I am mainly a web based business application developer. What is it and what is the use of it? My understanding so far is that: The ...

Clientside going serverside with node.js

I`ve been looking for a serverside language for some time, and python got my attention somewhat. But as I already know and love javascript, I now want learn to code on the server with js and node.js. ...

Can I use jQuery with Node.js?

Is it possible to use jQuery selectors/DOM manipulation on the server-side using Node.js?

How do I escape a string for a shell command in node?

In nodejs, the only way to execute external commands is via sys.exec(cmd). I d like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a ...

热门标签