#discord bot

9 messages · Page 1 of 1 (latest)

surreal sorrel
#

Can someone help me make a discord bot I'll give u dev role in my discord server

vapid obsidian
#

there may be bots out there that already do what you want to do

surreal sorrel
# vapid obsidian there may be bots out there that already do what you want to do

Well I just bought the hosting plan thru pebblehosting and what I want the bot to do is very simple i want to use it to embed messages with a simple command for example I want to be able to say /say or something along those lines and the message after it gets embedding for example if someone is breaking rules in the discord or have a question me or staff and type a command and it say that

#

I was gonna use nodeJs

carmine wigeon
#

Well I sent a whole bunch of code and the bot removed it

#

There goes my 20 mins

ocean gladeBOT
#

@carmine wigeon posted:
Well I don't you really need someone for that. The code for it is also simple.

First, through the Node Package Manager (NPM), install discord.js version 14.11.0

Then, go to your file manager and open (or create if you don't have) the index.js file. In there, copy paste the following code in there.

const { Client, Events, GatewayIntentBits } = require("discord.js")
const token = "PLACE_YOUR_DISCORD_BOT_TOKEN_HERE"

// Create a new client instance
const client = new Client({ intents: [GatewayIntentBits.Guilds] });

// When the client is ready, run this code (only once)
// We use 'c' for the event parameter to keep it separate from the already defined 'client'
client.once(Events.ClientReady, c => {
    console.log(`Ready! Logged in as ${c.user.tag}`);
});

client.on(Events.InteractionCreate, async interaction => {
    if (!interaction.isChatInputCommand()) return;
    if (interaction.commandName === "say") {
        let option = interaction.options.getString("message") 
        let embed = {
            title: "whatever title you want", // remove this option if u don't want a title at all
            description: option, 
            color: 0x008800 // remove this option if you don't want a color
        } 
        interaction.reply({ embeds: [embed] }) 
    } 
}) 

// Log in to Discord with your client's token
client.login(token);
ornate dust
#
const { Client, Events, GatewayIntentBits } = require("discord.js")
const token = "PLACE_YOUR_DISCORD_BOT_TOKEN_HERE"

// Create a new client instance
const client = new Client({ intents: [GatewayIntentBits.Guilds] });

// When the client is ready, run this code (only once)
// We use 'c' for the event parameter to keep it separate from the already defined 'client'
client.once(Events.ClientReady, c => {
    console.log(Ready! Logged in as ${c.user.tag}`);
});

client.on(Events.InteractionCreate, async interaction => {
    if (!interaction.isChatInputCommand()) return;
    if (interaction.commandName === "say") {
        let option = interaction.options.getString("message") 
        let embed = {
            title: "whatever title you want", // remove this option if u don't want a title at all
            description: option, 
            color: 0x008800 // remove this option if you don't want a color
        } 
        interaction.reply({ embeds: [embed] }) 
    } 
}) 

// Log in to Discord with your client's token
client.login(token);