#discord bot
9 messages · Page 1 of 1 (latest)
you need to be a lot more specific. What language if you have a preferred language? What does the bot need to do? Is this bot for just one server or multiple discord servers?
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 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);
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);