Vicarious
Vicarious
DIAdiscord.js - Imagine an app
Created by Vicarious on 5/7/2024 in #djs-voice
Opus
client.on('messageCreate', async message => {
if (message.author.bot || !message.guild) return
if (!message.content.startsWith(prefix)) return
const args = message.content.slice(prefix.length).trim().split(/ +/g)
if (message.content.startsWith(prefix + "play")) {
if (!message.member.voice.channel) return message.reply({ content: `> **عذراً ، يجب ان تكون داخل روم صوتي لتستخدم هذا الأمر**` })
try {
const string = args.join(' ')
if (!string) return message.channel.send(`${client.emotes.error} | Please enter a song url or query to search.`)
client.distube.play(message.member.voice.channel, string, {
member: message.member,
textChannel: message.channel,
message
})
}
catch (e) {
console.error(e)
message.channel.send(`حدث خطا اثناء التشغيل !`)
}
}

client.on('messageCreate', async message => {
if (message.author.bot || !message.guild) return
if (!message.content.startsWith(prefix)) return
const args = message.content.slice(prefix.length).trim().split(/ +/g)
if (message.content.startsWith(prefix + "play")) {
if (!message.member.voice.channel) return message.reply({ content: `> **عذراً ، يجب ان تكون داخل روم صوتي لتستخدم هذا الأمر**` })
try {
const string = args.join(' ')
if (!string) return message.channel.send(`${client.emotes.error} | Please enter a song url or query to search.`)
client.distube.play(message.member.voice.channel, string, {
member: message.member,
textChannel: message.channel,
message
})
}
catch (e) {
console.error(e)
message.channel.send(`حدث خطا اثناء التشغيل !`)
}
}

hey i want extract from this code !join and play like !join 'bot' or !setbot 'channel' 'bot' and !play , if bot in channel
4 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 5/7/2024 in #djs-questions
Distube
client.on('messageCreate', async message => {
if (message.author.bot || !message.guild) return
if (!message.content.startsWith(prefix)) return
const args = message.content.slice(prefix.length).trim().split(/ +/g)
if (message.content.startsWith(prefix + "play")) {
if (!message.member.voice.channel) return message.reply({ content: `> **عذراً ، يجب ان تكون داخل روم صوتي لتستخدم هذا الأمر**` })
try {
const string = args.join(' ')
if (!string) return message.channel.send(`${client.emotes.error} | Please enter a song url or query to search.`)
client.distube.play(message.member.voice.channel, string, {
member: message.member,
textChannel: message.channel,
message
})
}
catch (e) {
console.error(e)
message.channel.send(`حدث خطا اثناء التشغيل !`)
}
}

client.on('messageCreate', async message => {
if (message.author.bot || !message.guild) return
if (!message.content.startsWith(prefix)) return
const args = message.content.slice(prefix.length).trim().split(/ +/g)
if (message.content.startsWith(prefix + "play")) {
if (!message.member.voice.channel) return message.reply({ content: `> **عذراً ، يجب ان تكون داخل روم صوتي لتستخدم هذا الأمر**` })
try {
const string = args.join(' ')
if (!string) return message.channel.send(`${client.emotes.error} | Please enter a song url or query to search.`)
client.distube.play(message.member.voice.channel, string, {
member: message.member,
textChannel: message.channel,
message
})
}
catch (e) {
console.error(e)
message.channel.send(`حدث خطا اثناء التشغيل !`)
}
}

hey i want extract from this code !join and play like !join 'bot' or !setbot 'channel' 'bot' and !play , if bot in channel
3 replies
DIAdiscord.js - Imagine an app
Created by Vicarious on 4/8/2024 in #djs-questions
Emoji click interaction
Hey, i made code when author click on reaction get ViewChannel Permission but i didn't work can any body help ??
logChannel.send({ embeds: [embed] })
.then(async (message) => {
// Add reaction emoji to the message
await message.react(':white_check_mark:');

// Await the reaction
const filter = (reaction, user) => reaction.emoji.name === ':white_check_mark:' && 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, {
ViewChannel: true // corrected ViewChannel to VIEW_CHANNEL
});

// 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) => {
// Add reaction emoji to the message
await message.react(':white_check_mark:');

// Await the reaction
const filter = (reaction, user) => reaction.emoji.name === ':white_check_mark:' && 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, {
ViewChannel: true // corrected ViewChannel to VIEW_CHANNEL
});

// 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