ELONISEVIL / amfora

1 stars 0 forks source link

yarn add bart #5

Open ELONISEVIL opened 1 month ago

ELONISEVIL commented 1 month ago

https://github.com/ELONISEVIL/amfora/issues/4

ELONISEVIL commented 1 month ago
    node -v
    npm -v
This should display the versions of Node.js and npm installed.

Step 2: Create a Discord Bot

  1. Create a New Application:

    • Go to the Discord Developer Portal.
    • Click "New Application" and give it a name.
    • Under "Settings", click on "Bot" and then "Add Bot". Confirm by clicking "Yes, do it!".
  2. Get Your Bot Token:

    • Under the "Bot" section, you will see a "Token" field. Click "Copy" to save your bot's token for later.

Step 3: Set Up Your Project

  1. Create a New Directory and Navigate to It:

    mkdir my-discord-bot
    cd my-discord-bot
  2. Initialize a New Node.js Project:

    npm init -y
  3. Install Discord.js Library:

    npm install discord.js

Step 4: Create Your Bot's Code

  1. Create a New File named bot.js:

    const { Client, GatewayIntentBits } = require('discord.js');
    const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
    
    const token = 'YOUR_BOT_TOKEN_HERE'; // Replace with your bot's token
    
    client.once('ready', () => {
        console.log('Bot is online!');
    });
    
    client.on('messageCreate', (message) => {
        if (message.content === '!ping') {
            message.channel.send('Pong!');
        }
    });
    
    client.login(token);

Step 5: Run Your Bot

  1. Run the Bot:

    node bot.js

    You should see the message "Bot is online!" in your terminal, indicating that your bot is running.

Step 6: Invite Your Bot to Your Server

  1. Get Your OAuth2 URL:
    • In the Discord Developer Portal, under "OAuth2", go to the "URL Generator".
    • Select the "bot" scope and the necessary permissions.
    • Copy the generated URL and visit it in your browser to invite the bot to your server.