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
CC#
Created by Nicolas Matheisen on 3/19/2024 in #help
✅ I get an Issue if I lf 2 artikels. how Ican fix this?
double Fleisch = 4.20;
double Marmelade = 2.30;
double Obst = 2.10;
double Multimedia = 12.00;


Console.WriteLine("Heute im Angebot: Fleisch, Marmelade, Obst, Multimedia" );
Console.WriteLine("Geben sie bitte die Ware ein: ");
string Ware = Convert.ToString(Console.ReadLine());
Console.WriteLine("Geben sie die Anzahl von "+Ware+" an:");
double Anzahl = Convert.ToDouble(Console.ReadLine());



if (Ware == "Fleisch") {
double Ergebnis = Anzahl * Fleisch;
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Fleisch.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Marmelade")
{
double Ergebnis = Anzahl * Marmelade;
Math.Round(Ergebnis, 2);
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Marmelade.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Obst")
{
double Ergebnis = Anzahl * Obst;
Math.Round(Ergebnis);
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Obst.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Multimedia")
{
double Ergebnis = Anzahl * Multimedia;
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Multimedia.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
double Fleisch = 4.20;
double Marmelade = 2.30;
double Obst = 2.10;
double Multimedia = 12.00;


Console.WriteLine("Heute im Angebot: Fleisch, Marmelade, Obst, Multimedia" );
Console.WriteLine("Geben sie bitte die Ware ein: ");
string Ware = Convert.ToString(Console.ReadLine());
Console.WriteLine("Geben sie die Anzahl von "+Ware+" an:");
double Anzahl = Convert.ToDouble(Console.ReadLine());



if (Ware == "Fleisch") {
double Ergebnis = Anzahl * Fleisch;
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Fleisch.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Marmelade")
{
double Ergebnis = Anzahl * Marmelade;
Math.Round(Ergebnis, 2);
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Marmelade.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Obst")
{
double Ergebnis = Anzahl * Obst;
Math.Round(Ergebnis);
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Obst.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
if (Ware == "Multimedia")
{
double Ergebnis = Anzahl * Multimedia;
Console.WriteLine(Ware + "\t\t" + Anzahl + " X " + Multimedia.ToString("F2") + "EUR\t\t" + Ergebnis.ToString("F2") + "EUR");
}
10 replies
CC#
Created by Nicolas Matheisen on 3/18/2024 in #help
✅ Chessboard
How do I ensure that there is a line break after spielfeld[i,26].
string[,] Spielfeld = new string[27, 27];
char gleich = '\u2550';
char linksoben = '\u2554';
char rechtsoben = '\u2557';


Console.Write(Spielfeld[0,1] = " ");
Console.Write(Spielfeld[0,2] = (linksoben).ToString());

for (int j = 0; j < Spielfeld.GetLength(1); j++) {
for (int i = 0; i < Spielfeld.GetLength(1); i++)
{
Spielfeld[0, i] = (gleich).ToString();
Console.Write(Spielfeld[0, i]);
if (i == 26)
{
Console.WriteLine();
}
}
Console.Write(Spielfeld[0, 26] = (rechtsoben).ToString());

}
string[,] Spielfeld = new string[27, 27];
char gleich = '\u2550';
char linksoben = '\u2554';
char rechtsoben = '\u2557';


Console.Write(Spielfeld[0,1] = " ");
Console.Write(Spielfeld[0,2] = (linksoben).ToString());

for (int j = 0; j < Spielfeld.GetLength(1); j++) {
for (int i = 0; i < Spielfeld.GetLength(1); i++)
{
Spielfeld[0, i] = (gleich).ToString();
Console.Write(Spielfeld[0, i]);
if (i == 26)
{
Console.WriteLine();
}
}
Console.Write(Spielfeld[0, 26] = (rechtsoben).ToString());

}
37 replies
CC#
Created by Nicolas Matheisen on 3/15/2024 in #help
✅ Hey I am a beginner coder and lf some tipps to write clean code.
string[] letters = new string[8];
for (int i = 0; i < letters.Length; i++)
letters[i] = ((char)(65 + i)).ToString();
for (int i = 8; i > 0; i--)
{
for (int j = 0; j < letters.Length; j++)
{
Console.Write(letters[j] + (i) + " ");
}
Console.WriteLine();
}
string[] letters = new string[8];
for (int i = 0; i < letters.Length; i++)
letters[i] = ((char)(65 + i)).ToString();
for (int i = 8; i > 0; i--)
{
for (int j = 0; j < letters.Length; j++)
{
Console.Write(letters[j] + (i) + " ");
}
Console.WriteLine();
}
I try to build a Chess. But my question is it's clean code? or how to change it that u can read it easyer and any Idea how I can build the next step I need the game peace(german: Spielfiguren) And I only learn the basics of loops and Arrays. I am not sure if i try to build a array... ty for all hints/advices🌞😊
19 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