Nicolas Matheisen
Nicolas Matheisen
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 7/23/2024 in #djs-questions
I get an error
No description
16 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 7/14/2024 in #djs-questions
Can someone explain me how to return a value?
No description
27 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 7/14/2024 in #djs-questions
embed message struggle
I try to reply with a embed message but I want as answer the .setValue from my select menu. Any Idea how I can get it? maybe save it in a variabele? Ty for advice
40 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 6/21/2024 in #djs-questions
I am confused with interactions
How I can create a script that switch the message with interaction.update there is a "edit" message I don't like to show it get another way?
23 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 6/20/2024 in #djs-questions
Is there any method that i can use
to update my embed message? I hope I describe my problem right. I send a embed messege in a channel and then the bot respond I choise from the select menu something and the bot responsed again with a new msg but it's possibile to update the first msg to the sec that I only have 1 embed and not two? Ty for advise me
21 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 6/17/2024 in #djs-questions
hey I create a offline notifer as event
But if my bot get offline I get no notification any idea why?
const { Events, EmbedBuilder} = require('discord.js');

module.exports = {

name: Events.PresenceUpdate,

async execute (oldStatus, newStatus, client) {

if (newStatus.user.id !== "xxx") return;

var bot = await client.users.fetch("xxx");

async function sendMessage (message) {

const embed = new EmbedBuilder()


.setColor("Blurple")

.setDescription(message);

var channel = await client.channels.fetch("xxx");

var member = await client.users.fetch("xxx");

await channel.send({ embeds: [embed] }).catch(err => {});

await member.send({ embeds: [embed] }).catch(err => {});

}

var timestamp = `<t:$(Math.floor(Date.now()/1000)):R>`;

if (!oldStatus && newStatus.status !== "offline") {

await sendMessage(`:warning: **Looks like ${bot.username} is offline!**\n${bot.username} (${bot.id}) became offline ${timestamp}, you might need to turn it back on to resolve this issue.`);
} else if (oldStatus.status !== "offline" && newStatus.status == "offline"){

await sendMessage(`:information_source: **${bot.username} is back online!**\n${bot.username} (${bot.id}) was recently offline and as of now (${timestamp}) is back online!`);
}
}
}
const { Events, EmbedBuilder} = require('discord.js');

module.exports = {

name: Events.PresenceUpdate,

async execute (oldStatus, newStatus, client) {

if (newStatus.user.id !== "xxx") return;

var bot = await client.users.fetch("xxx");

async function sendMessage (message) {

const embed = new EmbedBuilder()


.setColor("Blurple")

.setDescription(message);

var channel = await client.channels.fetch("xxx");

var member = await client.users.fetch("xxx");

await channel.send({ embeds: [embed] }).catch(err => {});

await member.send({ embeds: [embed] }).catch(err => {});

}

var timestamp = `<t:$(Math.floor(Date.now()/1000)):R>`;

if (!oldStatus && newStatus.status !== "offline") {

await sendMessage(`:warning: **Looks like ${bot.username} is offline!**\n${bot.username} (${bot.id}) became offline ${timestamp}, you might need to turn it back on to resolve this issue.`);
} else if (oldStatus.status !== "offline" && newStatus.status == "offline"){

await sendMessage(`:information_source: **${bot.username} is back online!**\n${bot.username} (${bot.id}) was recently offline and as of now (${timestamp}) is back online!`);
}
}
}
17 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 6/16/2024 in #djs-questions
Can someone explain me what can I do that my bot always response. If I try next day a slash command
my bot doesn't respons.
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
const dotenv = require('dotenv');
const dbconnection = require('./events/dbconnection.js');
const cocapiconnection = require('./events/cocapiconnection.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });

dotenv.config();

client.commands = new Collection();
const commandsPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.log(`[WARNING] Der Befehl in ${filePath} fehlt eine erforderliche "data" oder "execute" Eigenschaft.`);
}
}

const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));





for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}

client.login(process.env.token);
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
const dotenv = require('dotenv');
const dbconnection = require('./events/dbconnection.js');
const cocapiconnection = require('./events/cocapiconnection.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });

dotenv.config();

client.commands = new Collection();
const commandsPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.log(`[WARNING] Der Befehl in ${filePath} fehlt eine erforderliche "data" oder "execute" Eigenschaft.`);
}
}

const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));





for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}

client.login(process.env.token);
42 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 2/25/2024 in #djs-questions
If I crate a /command
there are commands after this like /command command1:10 how the command1 is called tyyy :3
11 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 2/14/2024 in #djs-questions
Can someone explain me how I can use the sequelize?
I coppied the repo from discord.js but how I can test the content? In my DB
3 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 12/15/2023 in #djs-questions
I get a error in discord that the bot don't response? how I can fix that
My code is comming
23 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 12/12/2023 in #djs-questions
How I can crate a handler that responsed to my select menu
I am a beginner In programming and I don't realy know wicht parts I need for the event. I build a dynamically eventhandler (hope that's the right word) Now I open a new ja and at this point I don't know how to do it. Ty for all hints
10 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 12/11/2023 in #djs-questions
I build a 'sending select menu'
But if I test my bot and choise a option the bot dosent response. What is missing? Ty for ur help and sry My expirience in programming isn't like a professional. Have mercy😂🙌🏼
49 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 12/11/2023 in #djs-questions
I have a error and don't know how to fix it.
I copied the code from github and now I get a error why?
14 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 10/11/2023 in #djs-questions
I have create a command folder
If i edit my commands I must deploy the commands again or is the edit save?
4 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 10/11/2023 in #djs-questions
I need help solving an error message
This one says that my path is wrong???
9 replies
DIAdiscord.js - Imagine an app
Created by Nicolas Matheisen on 10/4/2022 in #djs-questions
I try to understand what is meaning t he word handling
What is command/event handling? Is that how you structure something? Any Tipps are welcome
8 replies