# Discord BOT Don't start (nodejs)

**URL:** <https://forum.freecodecamp.org/t/discord-bot-dont-start-nodejs/347764>\
**Category:** General\
**Created:** [February 5, 2020, 8:04pm UTC](https://forum.freecodecamp.org/t/discord-bot-dont-start-nodejs/347764 "2020-02-05T20:04:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aziime](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/aziime/32/133090_2.png) [@aziime](https://forum.freecodecamp.org/u/aziime)\
**Post date:** [February 5, 2020, 8:04pm UTC](https://forum.freecodecamp.org/t/discord-bot-dont-start-nodejs/347764/1 "2020-02-05T20:04:56Z")

</div>

This is my code.  
But for a day, I stopped working the bot …  
I don’t know if you see any fault because I don’t see anything …

If you can help me pls

```auto
import { Client, RichEmbed } from 'discord.js';
const client = new Client();
import { CronJob as cron } from 'cron';
import cron from 'node-cron';

client.on('ready', () => {
    console.log('Bot Now connected!');
    console.log('Logged In as', client.user.tag)
    client.user.setStatus('dnd'); // online, idle, invisible, dnd
    console.log('Bot status: ', client.user.presence.status);
    // Bot sending a Message to a text channel called test
    const testChannel = client.channels.find(x => x.name === 'test')
    console.log(testChannel)
    client.channels.find(c => c.name === 'test').send('Hello Server!');
});
/*
function getToday() {
    let today = new Date();
    let months = [`January`, `February`, `March`, `April`, `May`, `June`, `July`, `August`, `September`, `October`, `November`, `December`];
    let suffix = [`st`, `nd`, `rd`];
    return `${today.getDate()}${suffix[today.getDate()] || `th`} of ${months[today.getMonth()]}`;
}

function getday(){
  let azi = new Date();
  let day = [`Luni`,`Marti`,`Miercuri`,`Joi`,`Vineri`,`Sambata`,`Duminica`];
  return `${azi.getDate()} of ${day[azi.getday()]}`;

}

  function mueveReloj(){
      momentoActual = new Date()
      hora = momentoActual.getHours()
      minuto = momentoActual.getMinutes()
      segundo = momentoActual.getSeconds()

      str_segundo = new String (segundo)
      if (str_segundo.length == 1)
         segundo = "0" + segundo

      str_minuto = new String (minuto)
      if (str_minuto.length == 1)
         minuto = "0" + minuto

      str_hora = new String (hora)
      if (str_hora.length == 1)
         hora = "0" + hora

      horaImprimible = hora + " : " + minuto + " : " + segundo

      document.form_reloj.reloj.value = horaImprimible

      setTimeout("mueveReloj()",1000)
  }

const momentoact = new Date();
*/
// Bot listenning messages
client.on('message', msg => {
    //console.log(msg.content)

        if (msg.content === '/azi') {
          msg.reply(getday());
        }
        if (msg.content === 'ping') {
                msg.reply('pong');
            }

        if (msg.content === 'date') {
          msg.reply(getToday());
        }

        if (msg.content === 'David e prost') {
            msg.delete();
        }

        if (msg.content === 'neata') {
            msg.channel.send(`Buna dimineata si tie ${msg.author} !!! Azi e ` + getToday() + '.');
        }

        if (msg.content === 'cf') {
            msg.channel.send(`mor tu ${msg.author}?`);
        }

        // QUESTS / LINKS-------------------------------------------------------------------

        if (msg.content === '/eva') {
            msg.channel.send('http://nwloforums.com/thread/78/eva-guide-death-quest');
        }

        if (msg.content === '/potiuni') {
            msg.channel.send('http://nwloforums.com/thread/77/holy-exp-potions-quests');
        }

        if (msg.content === '/fred') {
            msg.channel.send('http://nwloforums.com/thread/81/fredericos-guide');
        }

        if (msg.content === '/victoria') {
            msg.channel.send('http://nwloforums.com/thread/83/victoria-quest');
        }

        if (msg.content === '/critquest') {
            msg.channel.send(' bad link ');
        }

        if (msg.content === '/stele') {
            msg.channel.send('https://wonderlandonline.fandom.com/wiki/Quests_by_Area');
        }

        if (msg.content === '/money') {
            msg.channel.send('http://nwloforums.com/thread/75/money-gold-guide');
        }

        if (msg.content === '/forum') {
            msg.channel.send('http://nwloforums.com');
        }

        if (msg.content === '/market') {
            msg.channel.send('https://docs.google.com/spreadsheets/d/1jywFUpxxp2nsoYpKMm0mP9W2AS3TLinYzlqPqsPMJq4/edit#gid=468913009');
        }

        if (msg.content === '/error') {
            msg.channel.send('http://nwloforums.com/thread/96/single-error');
        }

        if (msg.content === '/invite') {
            msg.channel.send('https://discord.gg/7f95qW7');
        }

        if (msg.content === '/pet') {
            msg.channel.send('http://wlopserver.com/thread/35/pet-level-guide');
        }

        if (msg.content === '!author') {
            const embed = new RichEmbed()
                // .setTitle('A pretty message')
                .setColor(0xFF0000)
                // .setDescription('Hello', msg.author);
                .addField('Author', 'Andrei', true)
                .addField('Version', '1.0', true)
                .addField('Contact', 'andr3y_30@yahoo.com', false)
                //.setAuthor('Andrei', '');
            msg.channel.send(embed);
        }

        // Deleting 100 messages
        if (msg.content.startsWith('!clear')) {
            async function clear() {
                try {
                    // await msg.delete();
                    const fetched = await msg.channel.fetchMessages({limit: 99});
                    msg.channel.bulkDelete(fetched);;
                    console.log('Messages deleted');
                }
                catch (e) {
                    console.log(e);
                }
            }
            clear();
        }

});

```

---

<div class="post-metadata">

**Author:** ![Hash2C](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/hash2c/32/132447_2.png) [@Hash2C](https://forum.freecodecamp.org/u/Hash2C)\
**Post date:** [February 5, 2020, 8:47pm UTC](https://forum.freecodecamp.org/t/discord-bot-dont-start-nodejs/347764/2 "2020-02-05T20:47:25Z")

</div>

Hi @aziime can you explain the issue you’re having a little bit better? Give us more info.  
Is this related with the freeCodeCamp curriculum? If it is, can you please tell what is the related lesson/project?

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 7:36pm UTC](https://forum.freecodecamp.org/t/discord-bot-dont-start-nodejs/347764/3 "2021-06-01T19:36:55Z")

</div>

Closed on June 1, 2021, 7:36pm UTC


