Marcus
Marcus
DIAdiscord.js - Imagine an app
Created by Marcus on 8/19/2023 in #djs-questions
SlashCommandHandler - Not answering
So I've created the deploy-commands & slashcommandhandler from Discord.Js guide docs, my commands do appear when I use /ping, but it doesnt respond
284 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 8/19/2023 in #djs-questions
Error using slashcommandbuilder
4 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 7/14/2023 in #djs-questions
Why isnt my eventHandler being loaded?
async function loadEvents(client) {
const { loadFiles } = require('../Functions/fileLoader');
const ascii = require("ascii-table")
const table = new ascii().setHeading("Events", "Status");

await client.events.clear();

const Files = await loadFiles("Events");

Files.forEach((file) => {
const event = require(file);

const execute = (...args) => event.execute(...args, client);
client.events.set(event.name, execute);

if(event.rest) {
if(event.once) client.rest.once(event.name, execute);
else
client.rest.on(event.name, execute);
} else {
if(event.once) client.once(event.name, execute);
else
client.on(event.name, execute);
}

table.addRow(event.name, "Online")
})

return console.log(table.toString(), "\nLoaded Events")
}

module.exports = { loadEvents }
async function loadEvents(client) {
const { loadFiles } = require('../Functions/fileLoader');
const ascii = require("ascii-table")
const table = new ascii().setHeading("Events", "Status");

await client.events.clear();

const Files = await loadFiles("Events");

Files.forEach((file) => {
const event = require(file);

const execute = (...args) => event.execute(...args, client);
client.events.set(event.name, execute);

if(event.rest) {
if(event.once) client.rest.once(event.name, execute);
else
client.rest.on(event.name, execute);
} else {
if(event.once) client.once(event.name, execute);
else
client.on(event.name, execute);
}

table.addRow(event.name, "Online")
})

return console.log(table.toString(), "\nLoaded Events")
}

module.exports = { loadEvents }
const config = require('dotenv').config()

const { Client, Events, GatewayIntentBits, SlashCommandBuilder, Partials, Collection } = require('discord.js');

const { Guilds, GuildMembers, GuildMessages } = GatewayIntentBits;

const { User, Message, GuildMember, ThreadMember } = Partials;

const { loadEvents } = require("./Handlers/eventHandler");

const client = new Client({
intents: [Guilds, GuildMembers, GuildMessages],
partials: [User, Message, GuildMember, ThreadMember]
});

client.events = new Collection();

loadEvents(client);


client
.login(process.env.DISCORD_TOKEN)
.then(() => {
console.log(`Successfully logged in`);
client.user.setActivity('Stwffer.it');
})
.catch((err) => console.log(err));
const config = require('dotenv').config()

const { Client, Events, GatewayIntentBits, SlashCommandBuilder, Partials, Collection } = require('discord.js');

const { Guilds, GuildMembers, GuildMessages } = GatewayIntentBits;

const { User, Message, GuildMember, ThreadMember } = Partials;

const { loadEvents } = require("./Handlers/eventHandler");

const client = new Client({
intents: [Guilds, GuildMembers, GuildMessages],
partials: [User, Message, GuildMember, ThreadMember]
});

client.events = new Collection();

loadEvents(client);


client
.login(process.env.DISCORD_TOKEN)
.then(() => {
console.log(`Successfully logged in`);
client.user.setActivity('Stwffer.it');
})
.catch((err) => console.log(err));
26 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 7/14/2023 in #djs-questions
Why isnt this working.
6 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 5/6/2023 in #djs-questions
Djs variable question
So I got system setup with embeds and drop down options, and I need the drop down options which the user choose and then send them in an embed afterwards, which variables / how would I do it? 🙂 I dont want to use a database, I think variables would be the easiest option, and the best in this case, science I don't need to store it forever.
13 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 5/1/2023 in #djs-questions
Unknown Interaction
module.exports = {
data: new SlashCommandBuilder()
.setName('hxbuy')
.setDescription('This is used by the administration when a user have bought Hx Cheats')
.addUserOption(option =>
option.setName('user')
.setDescription('The user who bought the HX Cheats.')
.setRequired(true))
.addStringOption(option =>
option.setName('key')
.setDescription('The HX Cheats key it will provide the customer with (Lifetime / Month / Week / 1day)')
.setRequired(true)),
async execute(interaction, client) {
const member = interaction.member;
if (member.roles.cache.has('1089455359921508412')) {

const channel = interaction.channel;


const UserInput = interaction.options.getUser('user') ?? 'No user was provided!'; // The error is here
const Key = interaction.options.getString('key') ?? 'No key was provided!';

interaction.reply({ content: 'The key and message was successfully send!', ephemeral: true })
module.exports = {
data: new SlashCommandBuilder()
.setName('hxbuy')
.setDescription('This is used by the administration when a user have bought Hx Cheats')
.addUserOption(option =>
option.setName('user')
.setDescription('The user who bought the HX Cheats.')
.setRequired(true))
.addStringOption(option =>
option.setName('key')
.setDescription('The HX Cheats key it will provide the customer with (Lifetime / Month / Week / 1day)')
.setRequired(true)),
async execute(interaction, client) {
const member = interaction.member;
if (member.roles.cache.has('1089455359921508412')) {

const channel = interaction.channel;


const UserInput = interaction.options.getUser('user') ?? 'No user was provided!'; // The error is here
const Key = interaction.options.getString('key') ?? 'No key was provided!';

interaction.reply({ content: 'The key and message was successfully send!', ephemeral: true })
61 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 4/30/2023 in #djs-questions
Weird error
12 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 4/21/2023 in #djs-questions
PayPal API
const { Client, GatewayIntentBits, Collection, Events, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed } = require("discord.js");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});
const fs = require('fs');

client.commands = new Collection();
const paypal = require('paypal-rest-sdk');
client.config = require("./config.json");
const prefix = '!';
const functions = fs.readdirSync("./functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./commands");

(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./commands");

})();

paypal.configure({
'mode': 'sandbox', // set to 'live' for production
'client_id': '',
'client_secret': ''
});

client.on('message', async (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 === 'pay') {
const paymentData = {
'intent': 'sale',
'payer': {
'payment_method': 'paypal'
},
'redirect_urls': {
'return_url': 'https://example.com/success',
'cancel_url': 'https://example.com/cancel'
},
'transactions': [{
'item_list': {
'items': [{
'name': 'Payment for Discord bot',
'sku': 'DISCORDBOT01',
'price': '35.00',
'currency': 'EUR',
'quantity': 1
}]
},
'amount': {
'currency': 'EUR',
'total': '35.00'
},
'description': 'Payment for Discord bot service'
}]
};

const { Client, GatewayIntentBits, Collection, Events, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed } = require("discord.js");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});
const fs = require('fs');

client.commands = new Collection();
const paypal = require('paypal-rest-sdk');
client.config = require("./config.json");
const prefix = '!';
const functions = fs.readdirSync("./functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./commands");

(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./commands");

})();

paypal.configure({
'mode': 'sandbox', // set to 'live' for production
'client_id': '',
'client_secret': ''
});

client.on('message', async (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 === 'pay') {
const paymentData = {
'intent': 'sale',
'payer': {
'payment_method': 'paypal'
},
'redirect_urls': {
'return_url': 'https://example.com/success',
'cancel_url': 'https://example.com/cancel'
},
'transactions': [{
'item_list': {
'items': [{
'name': 'Payment for Discord bot',
'sku': 'DISCORDBOT01',
'price': '35.00',
'currency': 'EUR',
'quantity': 1
}]
},
'amount': {
'currency': 'EUR',
'total': '35.00'
},
'description': 'Payment for Discord bot service'
}]
};


paypal.payment.create(paymentData, (error, payment) => {
if (error) {
console.error(error);
message.reply('There was an error creating the payment. Please try again later.');
} else {
const approvalUrl = payment.links.find(link => link.rel === 'approval_url').href;
message.reply(`Please approve the payment at ${approvalUrl}`);

const paymentId = payment.id;
const checkPayment = setInterval(() => {
paypal.payment.get(paymentId, (error, payment) => {
if (error) {
console.error(error);
clearInterval(checkPayment);
message.reply('There was an error checking the payment status. Please contact the bot owner.');
} else {
if (payment.state === 'approved') {
clearInterval(checkPayment);
message.reply('Payment successful! Thank you for your payment.');
}
}
});
}, 5000);
}
});
}
});




client
.login(client.config.token)
.then(() => {
console.log(`Cliend logged in as ${client.user.username}`)
client.user.setActivity(`Support`)


})

paypal.payment.create(paymentData, (error, payment) => {
if (error) {
console.error(error);
message.reply('There was an error creating the payment. Please try again later.');
} else {
const approvalUrl = payment.links.find(link => link.rel === 'approval_url').href;
message.reply(`Please approve the payment at ${approvalUrl}`);

const paymentId = payment.id;
const checkPayment = setInterval(() => {
paypal.payment.get(paymentId, (error, payment) => {
if (error) {
console.error(error);
clearInterval(checkPayment);
message.reply('There was an error checking the payment status. Please contact the bot owner.');
} else {
if (payment.state === 'approved') {
clearInterval(checkPayment);
message.reply('Payment successful! Thank you for your payment.');
}
}
});
}, 5000);
}
});
}
});




client
.login(client.config.token)
.then(() => {
console.log(`Cliend logged in as ${client.user.username}`)
client.user.setActivity(`Support`)


})
No errors, but doesn't send (The PayPal API stuff w. !pay)
5 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 4/10/2023 in #djs-questions
Emoji select menu
5 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 4/9/2023 in #djs-questions
Select menu emojis
69 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 4/8/2023 in #djs-questions
send channel not working
client.on("message", async message => {


const spooferEmbed = new EmbedBuilder()
.setColor('#147df5')
.setTitle('Bubble Sp00fer')
.setDescription('**Prices**\n\n> 1x Week / 10€\n> 1x Month / 15€\n> Lifetime / 20€')
.setThumbnail('https://media.discordapp.net/attachments/1055568148281163818/1088178678170669106/bubble.png')
.setImage('https://media.discordapp.net/attachments/1055568148281163818/1088176997127176303/bubble_banner.png')

const channel = await client.channels.fetch('1092194462295404694');
channel.send({ embeds: [spooferEmbed] });

})
client.on("message", async message => {


const spooferEmbed = new EmbedBuilder()
.setColor('#147df5')
.setTitle('Bubble Sp00fer')
.setDescription('**Prices**\n\n> 1x Week / 10€\n> 1x Month / 15€\n> Lifetime / 20€')
.setThumbnail('https://media.discordapp.net/attachments/1055568148281163818/1088178678170669106/bubble.png')
.setImage('https://media.discordapp.net/attachments/1055568148281163818/1088176997127176303/bubble_banner.png')

const channel = await client.channels.fetch('1092194462295404694');
channel.send({ embeds: [spooferEmbed] });

})
No errors, and it is not sending the embed to the channel
7 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 4/5/2023 in #djs-questions
slashcommand input issue
Why isn't this working?
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
data: new SlashCommandBuilder()
.setName('hxbuy')
.setDescription('This is used by the administration when a user have bought Hx Cheats')
.addStringOption(option =>
option.setName('Key')
.setDescription('The Hx Cheats key it will provide the customer with (Lifetime / Month / Week / 1day)')
.setRequired(true)),
async execute(interaction, client) {
const Key = interaction.options.getString('Key') ?? 'No key was provided!';

interaction.reply('Test123' + (Key))

}
}
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
data: new SlashCommandBuilder()
.setName('hxbuy')
.setDescription('This is used by the administration when a user have bought Hx Cheats')
.addStringOption(option =>
option.setName('Key')
.setDescription('The Hx Cheats key it will provide the customer with (Lifetime / Month / Week / 1day)')
.setRequired(true)),
async execute(interaction, client) {
const Key = interaction.options.getString('Key') ?? 'No key was provided!';

interaction.reply('Test123' + (Key))

}
}
https://media.discordapp.net/attachments/1092217188045299794/1093180829485776946/image.png
4 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 4/3/2023 in #djs-questions
Const messages
const { Client, message } = require('discord.js');
const wait = require('node:timers/promises').setTimeout;
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js')
const discordTranscripts = require('discord-html-transcripts');

const countdownTime = 4;

module.exports = {
data: new SlashCommandBuilder()
.setName('closeticket')
.setDescription('Closes your ticket'),
async execute(interaction, client) {
const member = interaction.member;
if (member.roles.cache.has('1092224079047704667')) {
interaction.reply('This ticket will close in 5 seconds!')
let countdown = countdownTime;
const channel = interaction.channel;
const countdownInterval = setInterval(() => {
if (countdown > 0) {
interaction.editReply(`${countdown} seconds left!`);
countdown--;
} else {


channel.permissionOverwrites.create(channel.guild.roles.everyone, { ViewChannel: false });
channel.setParent('1089611611314065519')

const attachment = discordTranscripts.generateFromMessages(messages, channel);



channel.setName(`close-${interaction.user.discriminator}`)
interaction.channel.send({ files: [attachment] });
clearInterval(countdownInterval);
}
}, 1000);
} else {
interaction.reply('You dont have permission to close this ticket!')
}
}
}
const { Client, message } = require('discord.js');
const wait = require('node:timers/promises').setTimeout;
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js')
const discordTranscripts = require('discord-html-transcripts');

const countdownTime = 4;

module.exports = {
data: new SlashCommandBuilder()
.setName('closeticket')
.setDescription('Closes your ticket'),
async execute(interaction, client) {
const member = interaction.member;
if (member.roles.cache.has('1092224079047704667')) {
interaction.reply('This ticket will close in 5 seconds!')
let countdown = countdownTime;
const channel = interaction.channel;
const countdownInterval = setInterval(() => {
if (countdown > 0) {
interaction.editReply(`${countdown} seconds left!`);
countdown--;
} else {


channel.permissionOverwrites.create(channel.guild.roles.everyone, { ViewChannel: false });
channel.setParent('1089611611314065519')

const attachment = discordTranscripts.generateFromMessages(messages, channel);



channel.setName(`close-${interaction.user.discriminator}`)
interaction.channel.send({ files: [attachment] });
clearInterval(countdownInterval);
}
}, 1000);
} else {
interaction.reply('You dont have permission to close this ticket!')
}
}
}
I am making a transcript system, but I need to define "messages" for the channel I am closing, but I got no clue how I would define "messages". const messages = someWayToGetMessages(); // Must be Collection<string, Message> or Message[]
29 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 4/2/2023 in #djs-questions
Cannot read properties of undefined.. (Error)
15 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 4/2/2023 in #djs-questions
Select menus & label name
8 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 4/1/2023 in #djs-questions
My SlashCommandHandler isn't working..
No clue how to fix it..
const { Client, Collection, Events, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed } = require("discord.js");
const client = new Client({ intents: ["Guilds"] });
const fs = require('fs');

client.commands = new Collection();

client.config = require("./config.json");

const functions = fs.readdirSync("./functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./commands");

(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./commands");
client.login(client.config.token)
})();


client
.login(client.config.token)
.then(() => {
console.log(`Cliend logged in as ${client.user.username}`)
client.user.setActivity(`Support`)
})
const { Client, Collection, Events, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed } = require("discord.js");
const client = new Client({ intents: ["Guilds"] });
const fs = require('fs');

client.commands = new Collection();

client.config = require("./config.json");

const functions = fs.readdirSync("./functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./commands");

(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./commands");
client.login(client.config.token)
})();


client
.login(client.config.token)
.then(() => {
console.log(`Cliend logged in as ${client.user.username}`)
client.user.setActivity(`Support`)
})
- Index file https://media.discordapp.net/attachments/1091664900906025100/1091664901094772826/image.png
78 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 3/26/2023 in #djs-questions
My Embed isn't working
4 replies
DIAdiscord.js - Imagine an app
Created by Marcus on 8/23/2022 in #djs-questions
Djs - commandsender to variable
So I got 2 interactions in 2 different scripts, I need to make the commandsender into an variable that I can use in the other interaction, how do I do that?
2 replies