rec
rec
DIAdiscord.js - Imagine an app
Created by rec on 3/24/2024 in #djs-questions
Request to use token, but token was unavailable to the client.
const { Client, Intents, MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });

client.once('ready', () => {
console.log('Ready!');
});

client.on('messageCreate', async message => {
if (message.content.startsWith('!setnickname')) {
const args = message.content.slice('!setnickname'.length).trim().split(/ +/);
const newNickname = args.join(' ');

try {
// Log in with the user's credentials
const userId = "usrid"; // Replace with your actual user ID
const password = "psword"; // Replace with your actual password
const user = await client.login(userId, password);

// Set the new nickname
await user.rename(newNickname);

console.log("Nickname set successfully!");
message.channel.send(`Nickname set successfully to: ${newNickname}`);
} catch (error) {
console.error("An error occurred:", error);
message.channel.send("Failed to set nickname. Please try again later.");
}
}
});

client.login('token');
const { Client, Intents, MessageEmbed } = require('discord.js');
const fetch = require('node-fetch');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });

client.once('ready', () => {
console.log('Ready!');
});

client.on('messageCreate', async message => {
if (message.content.startsWith('!setnickname')) {
const args = message.content.slice('!setnickname'.length).trim().split(/ +/);
const newNickname = args.join(' ');

try {
// Log in with the user's credentials
const userId = "usrid"; // Replace with your actual user ID
const password = "psword"; // Replace with your actual password
const user = await client.login(userId, password);

// Set the new nickname
await user.rename(newNickname);

console.log("Nickname set successfully!");
message.channel.send(`Nickname set successfully to: ${newNickname}`);
} catch (error) {
console.error("An error occurred:", error);
message.channel.send("Failed to set nickname. Please try again later.");
}
}
});

client.login('token');
60 replies
DIAdiscord.js - Imagine an app
Created by rec on 3/10/2024 in #djs-questions
bitfield whateva
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.MESSAGE_CREATE] });

client.once('ready', () => {
console.log('Ready!');
});

client.on('messageCreate', message => {
if (message.content.startsWith('!c')) {
// Extract level ID from message content
const args = message.content.slice('!c'.length).trim().split(/ +/);
const levelId = args.shift();

// Place your bot logic here, e.g., spam comments on the specified level ID
message.channel.send(`ok ${levelId}...`);
// Add your bot logic here
}
});

client.login('YOUR_BOT_TOKEN');
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.MESSAGE_CREATE] });

client.once('ready', () => {
console.log('Ready!');
});

client.on('messageCreate', message => {
if (message.content.startsWith('!c')) {
// Extract level ID from message content
const args = message.content.slice('!c'.length).trim().split(/ +/);
const levelId = args.shift();

// Place your bot logic here, e.g., spam comments on the specified level ID
message.channel.send(`ok ${levelId}...`);
// Add your bot logic here
}
});

client.login('YOUR_BOT_TOKEN');
i know its to do with converting the screaming snake to the new one, but i dont know the name of the new intents, if someone could give me the names id appreciate it
14 replies