! Tennessine [busy a few days]
! Tennessine [busy a few days]
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
Ok..
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
this is list.js
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
const { Client, Intents } = require("discord.js");
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});

const prefix = ",";

client.on("messageCreate", (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();

if (command === "list") {
if (args.length < 2) {
return message.reply("Folosește comanda astfel: ,list <ID> <motiv>");
}

const userID = args[0];
const member = message.guild.members.cache.get(userID);
const username = member ? member.displayName : "Utilizator necunoscut";
const reason = args.slice(1).join(" ");

const messageContent = `${username} - ID: ${userID} - ${reason}`;

const channel = client.channels.cache.get("953052947879702621");
if (channel) {
channel.send(messageContent);
} else {
console.error("Canalul nu a fost găsit!");
}
}
});

client.login(process.env.TOKEN);
const { Client, Intents } = require("discord.js");
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});

const prefix = ",";

client.on("messageCreate", (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();

if (command === "list") {
if (args.length < 2) {
return message.reply("Folosește comanda astfel: ,list <ID> <motiv>");
}

const userID = args[0];
const member = message.guild.members.cache.get(userID);
const username = member ? member.displayName : "Utilizator necunoscut";
const reason = args.slice(1).join(" ");

const messageContent = `${username} - ID: ${userID} - ${reason}`;

const channel = client.channels.cache.get("953052947879702621");
if (channel) {
channel.send(messageContent);
} else {
console.error("Canalul nu a fost găsit!");
}
}
});

client.login(process.env.TOKEN);
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
I updated the code, but I see that a problem has been solved. but i have two now... the first problem is that it does not count pings. This means that 1/2 of the used pings are also written the second time. The second problem is that the ",list" command no longer works, which used to work before. Immediately you also receive "list.js"
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
it s ok now?
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
require("dotenv").config();
const { Client, Collection, Intents } = require("discord.js");
const fs = require("fs");
const path = require("path");

const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});
const prefix = ",";

const token = process.env.TOKEN;

if (!token || typeof token !== "string") {
throw new Error("TOKEN_INVALID: Tokenul furnizat este invalid.");
}

const pingCount = new Map();

const commandFiles = fs
.readdirSync(path.resolve("./src"))
.filter((file) => file.endsWith(".js"));

const commands = new Collection();
for (const file of commandFiles) {
try {
const command = require(path.resolve(`./src/${file}`));
commands.set(command.name, command);
} catch (error) {
console.error(`Eroare încărcare comandă: ${file}`, error);
}
}

client.once("ready", () => {
console.log("Botul este online!");
});

client.on("messageCreate", async (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) {
if (message.channel.name.startsWith("slot-")) {
if (message.mentions.users.size > 0) {
const user = message.author;
let count = pingCount.get(user.id) || 0;
count++;

if (count > 1) {
message.channel.send(
`${user}, nu poți trimite ping-uri repetate! Canalul va fi șters.`
);
message.channel.delete();
return;
}

message.channel.send(`${user}, ${count}/1 ping-uri permise.`);

pingCount.set(user.id, count);
}
}
return;
}

const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();

if (commandName === "ping") {
if (!pingCount.has(message.author.id)) {
pingCount.set(message.author.id, 0);
}

let count = pingCount.get(message.author.id);
count++;

if (count > 2) {
message.channel.send(
`${message.author}, Ai folosit toate ping-urile posibile pentru astăzi. Cooldown de 24 de ore.`
);
message.channel.send(
`Nu puteți mai trimite ping-uri în acest canal pentru 24 de ore.`
);

message.channel.permissionOverwrites.edit(message.guild.roles.everyone, {
SEND_MESSAGES: false,
});

setTimeout(() => {
message.channel.permissionOverwrites.edit(
message.guild.roles.everyone,
{
SEND_MESSAGES: true,
}
);
}, 24 * 60 * 60 * 1000);

message.channel.send(
`ANNO! 🚨 Te rog să nu mai dai ping persoanelor. Vei pierde accesul slot-ului!`
);

return;
}

message.channel.send(`<@&1148177424647999529>`);
message.channel.send(`${count}/2 ping-uri folosite.`);
pingCount.set(message.author.id, count);
} else {
const command = commands.get(commandName);
if (!command) return;
try {
command.execute(message, args);
} catch (error) {
console.error(error);
message.reply("A apărut o eroare în timpul execuției comenzii.");
}
}
});

client.login(token);
require("dotenv").config();
const { Client, Collection, Intents } = require("discord.js");
const fs = require("fs");
const path = require("path");

const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
});
const prefix = ",";

const token = process.env.TOKEN;

if (!token || typeof token !== "string") {
throw new Error("TOKEN_INVALID: Tokenul furnizat este invalid.");
}

const pingCount = new Map();

const commandFiles = fs
.readdirSync(path.resolve("./src"))
.filter((file) => file.endsWith(".js"));

const commands = new Collection();
for (const file of commandFiles) {
try {
const command = require(path.resolve(`./src/${file}`));
commands.set(command.name, command);
} catch (error) {
console.error(`Eroare încărcare comandă: ${file}`, error);
}
}

client.once("ready", () => {
console.log("Botul este online!");
});

client.on("messageCreate", async (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) {
if (message.channel.name.startsWith("slot-")) {
if (message.mentions.users.size > 0) {
const user = message.author;
let count = pingCount.get(user.id) || 0;
count++;

if (count > 1) {
message.channel.send(
`${user}, nu poți trimite ping-uri repetate! Canalul va fi șters.`
);
message.channel.delete();
return;
}

message.channel.send(`${user}, ${count}/1 ping-uri permise.`);

pingCount.set(user.id, count);
}
}
return;
}

const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();

if (commandName === "ping") {
if (!pingCount.has(message.author.id)) {
pingCount.set(message.author.id, 0);
}

let count = pingCount.get(message.author.id);
count++;

if (count > 2) {
message.channel.send(
`${message.author}, Ai folosit toate ping-urile posibile pentru astăzi. Cooldown de 24 de ore.`
);
message.channel.send(
`Nu puteți mai trimite ping-uri în acest canal pentru 24 de ore.`
);

message.channel.permissionOverwrites.edit(message.guild.roles.everyone, {
SEND_MESSAGES: false,
});

setTimeout(() => {
message.channel.permissionOverwrites.edit(
message.guild.roles.everyone,
{
SEND_MESSAGES: true,
}
);
}, 24 * 60 * 60 * 1000);

message.channel.send(
`ANNO! 🚨 Te rog să nu mai dai ping persoanelor. Vei pierde accesul slot-ului!`
);

return;
}

message.channel.send(`<@&1148177424647999529>`);
message.channel.send(`${count}/2 ping-uri folosite.`);
pingCount.set(message.author.id, count);
} else {
const command = commands.get(commandName);
if (!command) return;
try {
command.execute(message, args);
} catch (error) {
console.error(error);
message.reply("A apărut o eroare în timpul execuției comenzii.");
}
}
});

client.login(token);
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
We need to take into account the v13 changes in the updateOverwrite method. In v13, the updateOverwrite method was replaced by permissionOverwrites.edit.
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
done install
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
and what can i do?
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
and this is the problem
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
this is src
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
require("dotenv").config();
const { Client, Collection, Intents } = require("discord.js");
const fs = require("fs");
const path = require("path");

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const prefix = ",";

const token = process.env.TOKEN;

if (!token || typeof token !== "string") {
throw new Error("TOKEN_INVALID: Tokenul furnizat este invalid.");
}

const pingCount = new Map();

const commandFiles = fs
.readdirSync(path.resolve("./src"))
.filter((file) => file.endsWith(".js"));

const commands = new Collection();
for (const file of commandFiles) {
try {
const command = require(path.resolve(`./src/${file}`));
commands.set(command.name, command);
} catch (error) {
console.error(`Eroare încărcare comandă: ${file}`, error);
}
}

client.once("ready", () => {
console.log("Botul este online!");
});

client.on("messageCreate", async (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) {
if (message.channel.name.startsWith("slot-")) {
if (message.mentions.users.size > 0) {
const user = message.author;
let count = pingCount.get(user.id) || 0;
count++;

if (count > 1) {
message.channel.send(
`${user}, nu poți trimite ping-uri repetate! Canalul va fi șters.`
);
message.channel.delete();
return;
}

message.channel.send(`${user}, ${count}/1 ping-uri permise.`);

pingCount.set(user.id, count);
}
}
return;
}

const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();

if (commands.has(commandName)) {
const command = commands.get(commandName);

if (
command.requiresAdmin &&
!message.member.permissions.has("ADMINISTRATOR")
) {
message.reply("Doar administratorii pot folosi această comandă.");
return;
}

try {
command.execute(message, args);
} catch (error) {
console.error(error);
message.reply("A apărut o eroare în timpul execuției comenzii.");
}
}

if (message.content.startsWith(prefix + "ping")) {
if (!pingCount.has(message.author.id)) {
pingCount.set(message.author.id, 0);
}

let count = pingCount.get(message.author.id);
count++;

if (count > 1) {
message.channel.send(
`${message.author}, Ai folosit toate ping-urile posibile pentru astăzi. Cooldown de 24 de ore.`
);
message.channel.send(
`Nu puteți mai trimite ping-uri în acest canal pentru 24 de ore.`
);

message.channel.permissionOverwrites.edit(message.guild.roles.everyone, {
SEND_MESSAGES: false,
});

setTimeout(() => {
message.channel.permissionOverwrites.edit(message.guild.roles.everyone, {
SEND_MESSAGES: null,
});
}, 24 * 60 * 60 * 1000);

message.channel.send(
`ANNO! 🚨 Te rog să nu mai dai ping persoanelor. Vei pierde accesul slot-ului!`
);

return;
}

message.channel.send(`<@&1148177424647999529>`);
message.channel.send(`${count}/2 ping-uri folosite.`);
pingCount.set(count);
}
});

client.login(token);
require("dotenv").config();
const { Client, Collection, Intents } = require("discord.js");
const fs = require("fs");
const path = require("path");

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const prefix = ",";

const token = process.env.TOKEN;

if (!token || typeof token !== "string") {
throw new Error("TOKEN_INVALID: Tokenul furnizat este invalid.");
}

const pingCount = new Map();

const commandFiles = fs
.readdirSync(path.resolve("./src"))
.filter((file) => file.endsWith(".js"));

const commands = new Collection();
for (const file of commandFiles) {
try {
const command = require(path.resolve(`./src/${file}`));
commands.set(command.name, command);
} catch (error) {
console.error(`Eroare încărcare comandă: ${file}`, error);
}
}

client.once("ready", () => {
console.log("Botul este online!");
});

client.on("messageCreate", async (message) => {
if (!message.content.startsWith(prefix) || message.author.bot) {
if (message.channel.name.startsWith("slot-")) {
if (message.mentions.users.size > 0) {
const user = message.author;
let count = pingCount.get(user.id) || 0;
count++;

if (count > 1) {
message.channel.send(
`${user}, nu poți trimite ping-uri repetate! Canalul va fi șters.`
);
message.channel.delete();
return;
}

message.channel.send(`${user}, ${count}/1 ping-uri permise.`);

pingCount.set(user.id, count);
}
}
return;
}

const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();

if (commands.has(commandName)) {
const command = commands.get(commandName);

if (
command.requiresAdmin &&
!message.member.permissions.has("ADMINISTRATOR")
) {
message.reply("Doar administratorii pot folosi această comandă.");
return;
}

try {
command.execute(message, args);
} catch (error) {
console.error(error);
message.reply("A apărut o eroare în timpul execuției comenzii.");
}
}

if (message.content.startsWith(prefix + "ping")) {
if (!pingCount.has(message.author.id)) {
pingCount.set(message.author.id, 0);
}

let count = pingCount.get(message.author.id);
count++;

if (count > 1) {
message.channel.send(
`${message.author}, Ai folosit toate ping-urile posibile pentru astăzi. Cooldown de 24 de ore.`
);
message.channel.send(
`Nu puteți mai trimite ping-uri în acest canal pentru 24 de ore.`
);

message.channel.permissionOverwrites.edit(message.guild.roles.everyone, {
SEND_MESSAGES: false,
});

setTimeout(() => {
message.channel.permissionOverwrites.edit(message.guild.roles.everyone, {
SEND_MESSAGES: null,
});
}, 24 * 60 * 60 * 1000);

message.channel.send(
`ANNO! 🚨 Te rog să nu mai dai ping persoanelor. Vei pierde accesul slot-ului!`
);

return;
}

message.channel.send(`<@&1148177424647999529>`);
message.channel.send(`${count}/2 ping-uri folosite.`);
pingCount.set(count);
}
});

client.login(token);
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
No description
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
done
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
ok, latest
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
No description
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
done
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
discord.js@13.0.0-dev.5af2ef5fbc7ad11281f38384c360ae79efe63b39
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
i can update
31 replies
DIAdiscord.js - Imagine an app
Created by ! Tennessine [busy a few days] on 3/7/2024 in #djs-questions
can someon help me with a bot discord (discord.js node)
Well, can't you help me with the code? I can not handle it
31 replies