Vicarious
Vicarious
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
thx for helping
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
i just change it from collect to
client.on('messageReactionAdd', async (reaction, user) => {
// Check if the reaction is added by the bot
if (user.bot) return;

// Check if the reaction is added to the embed message
if (reaction.message.author.id !== client.user.id) return; // Ensure the bot sent the message
if (!reaction.message.embeds.length) return; // Ensure the message has an embed

const embed = reaction.message.embeds[0];
// You can further check the embed properties if needed

// Check if the reaction emoji is '✅'
if (reaction.emoji.name !== '✅') return;

// Grant view permission to the user
try {
await hiddenChannel.permissionOverwrites.edit(user.id, {
ViewChannel: true
});

// Send a confirmation message
const confirmationMessage = 'You have been granted permission to view the ticket channel.';
await reaction.message.channel.send({ content: confirmationMessage, ephemeral: true });
} catch (error) {
console.error('Error granting permission:', error);
// Handle the error, possibly by sending an error message
}
});
client.on('messageReactionAdd', async (reaction, user) => {
// Check if the reaction is added by the bot
if (user.bot) return;

// Check if the reaction is added to the embed message
if (reaction.message.author.id !== client.user.id) return; // Ensure the bot sent the message
if (!reaction.message.embeds.length) return; // Ensure the message has an embed

const embed = reaction.message.embeds[0];
// You can further check the embed properties if needed

// Check if the reaction emoji is '✅'
if (reaction.emoji.name !== '✅') return;

// Grant view permission to the user
try {
await hiddenChannel.permissionOverwrites.edit(user.id, {
ViewChannel: true
});

// Send a confirmation message
const confirmationMessage = 'You have been granted permission to view the ticket channel.';
await reaction.message.channel.send({ content: confirmationMessage, ephemeral: true });
} catch (error) {
console.error('Error granting permission:', error);
// Handle the error, possibly by sending an error message
}
});
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
@kin.ts yo finnaly work it
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
@\
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
At least a error code!
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
i am so confused because why when am clicking on reaction there nothing happen
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
na isn't
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
I hope this is the problem
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
so i'll not use Partials anymore i want other solution
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
const { Client, GatewayIntentBits, REST, Partials } = require('discord.js');
const { token } = require('../config.json');

// Define the intents you want to enable
const intents = [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageReactions
// Add more intents as needed
];

const rest = new REST({ version: '9' }).setToken(token);

// Create the client with the specified intents and partials
const client = new Client({ intents, partials: [Partials.Message, Partials.Channel, Partials.Reaction] });

// Export the client instance
module.exports = client;

client.login(token);
const { Client, GatewayIntentBits, REST, Partials } = require('discord.js');
const { token } = require('../config.json');

// Define the intents you want to enable
const intents = [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageReactions
// Add more intents as needed
];

const rest = new REST({ version: '9' }).setToken(token);

// Create the client with the specified intents and partials
const client = new Client({ intents, partials: [Partials.Message, Partials.Channel, Partials.Reaction] });

// Export the client instance
module.exports = client;

client.login(token);
when im solving error i got new error
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
You have entered a maze of parts
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
okey hold a minute
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
Reaction collector ended.
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
after 15 second
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
Reaction collector created.
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
logChannel.send({ embeds: [embed] })
.then(async (message) => {
console.log("Message sent with embed.");

// Add reaction emoji to the message
await message.react('✅');
console.log("Reaction added to the message.");

// Await the reaction
const filter = (reaction, user) => reaction.emoji.name === '✅' && user.id === interaction.user.id;
const collector = message.createReactionCollector({ filter, time: 15000 });

console.log("Reaction collector created.");

collector.on('collect', async (reaction, user) => {
console.log("Reaction collected:", reaction.emoji.name, "by user:", user.id);

// Grant view permission to the user
await hiddenChannel.permissionOverwrites.edit(interaction.user.id, {
VIEW_CHANNEL: true
});

// Send a confirmation message
interaction.reply({
content: 'You have been granted permission to view the ticket channel.',
ephemeral: true
});
});

collector.on('end', () => {
console.log("Reaction collector ended.");
// Remove the reaction collector after 15 seconds
collector.stop();
});
})
.catch(error => console.error('Error sending message to log channel:', error));

logChannel.send({ embeds: [embed] })
.then(async (message) => {
console.log("Message sent with embed.");

// Add reaction emoji to the message
await message.react('✅');
console.log("Reaction added to the message.");

// Await the reaction
const filter = (reaction, user) => reaction.emoji.name === '✅' && user.id === interaction.user.id;
const collector = message.createReactionCollector({ filter, time: 15000 });

console.log("Reaction collector created.");

collector.on('collect', async (reaction, user) => {
console.log("Reaction collected:", reaction.emoji.name, "by user:", user.id);

// Grant view permission to the user
await hiddenChannel.permissionOverwrites.edit(interaction.user.id, {
VIEW_CHANNEL: true
});

// Send a confirmation message
interaction.reply({
content: 'You have been granted permission to view the ticket channel.',
ephemeral: true
});
});

collector.on('end', () => {
console.log("Reaction collector ended.");
// Remove the reaction collector after 15 seconds
collector.stop();
});
})
.catch(error => console.error('Error sending message to log channel:', error));

47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
const { Client, GatewayIntentBits, REST } = require('discord.js');
const { token } = require('../config.json');


// Define the intents you want to enable
const intents = [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessageReactions
];

const rest = new REST({ version: '9' }).setToken(token);

// Create the client with the specified intents
const client = new Client({ intents });

// Export the client instance
module.exports = client;

client.login(token);
const { Client, GatewayIntentBits, REST } = require('discord.js');
const { token } = require('../config.json');


// Define the intents you want to enable
const intents = [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessageReactions
];

const rest = new REST({ version: '9' }).setToken(token);

// Create the client with the specified intents
const client = new Client({ intents });

// Export the client instance
module.exports = client;

client.login(token);
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
i wish that's work but it didn't also when click on reaction there nothing happening
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
const { Client, GatewayIntentBits, REST } = require('discord.js');
const { token } = require('../config.json');


// Define the intents you want to enable
const intents = [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent // Note: You have 'MessageContent' included twice in your original array
// Add more intents as needed
];

const rest = new REST({ version: '9' }).setToken(token);

// Create the client with the specified intents
const client = new Client({ intents });

// Export the client instance
module.exports = client;

client.login(token);
const { Client, GatewayIntentBits, REST } = require('discord.js');
const { token } = require('../config.json');


// Define the intents you want to enable
const intents = [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent // Note: You have 'MessageContent' included twice in your original array
// Add more intents as needed
];

const rest = new REST({ version: '9' }).setToken(token);

// Create the client with the specified intents
const client = new Client({ intents });

// Export the client instance
module.exports = client;

client.login(token);
thats ??
47 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
there nothing gonna happen
47 replies