Awashcard0
Awashcard0
DIAdiscord.js - Imagine an app
Created by Awashcard0 on 5/18/2024 in #djs-voice
joinVoiceChannel is not a function. But its in dependencies
This is there error I get
awash@awash-hp:~/Documents/code/JS/musicBot$ bun run index.js
Ready! Logged in as Player#9475
[awashcard0]: !play
94 |
95 | if (connection) {
96 | connection.destroy();
97 | }
98 |
99 | connection = joinVoiceChannel({
^
TypeError: joinVoiceChannel is not a function. (In 'joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator
})', 'joinVoiceChannel' is undefined)
at /home/awash/Documents/code/JS/musicBot/index.js:99:18
at playAudio (/home/awash/Documents/code/JS/musicBot/index.js:88:26)
at /home/awash/Documents/code/JS/musicBot/index.js:73:17
awash@awash-hp:~/Documents/code/JS/musicBot$
awash@awash-hp:~/Documents/code/JS/musicBot$ bun run index.js
Ready! Logged in as Player#9475
[awashcard0]: !play
94 |
95 | if (connection) {
96 | connection.destroy();
97 | }
98 |
99 | connection = joinVoiceChannel({
^
TypeError: joinVoiceChannel is not a function. (In 'joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator
})', 'joinVoiceChannel' is undefined)
at /home/awash/Documents/code/JS/musicBot/index.js:99:18
at playAudio (/home/awash/Documents/code/JS/musicBot/index.js:88:26)
at /home/awash/Documents/code/JS/musicBot/index.js:73:17
awash@awash-hp:~/Documents/code/JS/musicBot$
Its says that TypeError: joinVoiceChannel is not a function but its in my require at const { Client, Collection, Events, GatewayIntentBits, createAudioResource, createAudioPlayer, AudioPlayerStatus, joinVoiceChannel, StreamType } = require('discord.js'); [email protected] bun: 1.1.4 (I cant get node to work)
4 replies
DIAdiscord.js - Imagine an app
Created by Awashcard0 on 2/29/2024 in #djs-questions
Send dm from command file
Im trying to send a dm from a command file but when it runs it errors
ReferenceError: client is not defined
ReferenceError: client is not defined
This is the full file part
const text = interaction.options.getString('text');
let users = []

interaction.channel.members.forEach(member => {
if (member.presence) {
if (member.presence.status == 'online' && !member.user.bot) {
if (member.id == interaction.user.id) {

} else {
users.push(member.id);
}
}
}
});

let index = Math.floor(Math.random() * users.length);
let user = users[index];

const embed = new EmbedBuilder()
.setTitle("Here is a random message from someone")
.setDescription(text)
.setColor('Blurple');
client.users.send(user, {embeds: [embed]});
await interaction.reply({ content: 'Sent', ephemeral: true });
const text = interaction.options.getString('text');
let users = []

interaction.channel.members.forEach(member => {
if (member.presence) {
if (member.presence.status == 'online' && !member.user.bot) {
if (member.id == interaction.user.id) {

} else {
users.push(member.id);
}
}
}
});

let index = Math.floor(Math.random() * users.length);
let user = users[index];

const embed = new EmbedBuilder()
.setTitle("Here is a random message from someone")
.setDescription(text)
.setColor('Blurple');
client.users.send(user, {embeds: [embed]});
await interaction.reply({ content: 'Sent', ephemeral: true });
6 replies
DIAdiscord.js - Imagine an app
Created by Awashcard0 on 3/13/2023 in #djs-questions
check if channel id is in guild id
Help pls I want to check if channel id is in guild id without running a command node = v18.13.0 djs = 14.8.0 My code (Dose not work (its for a command but i want it to run without a command))
const guild = client.guilds.resolve(guildId);
if (guild.channels.cache.get(ids.chat) === undefined) {
console.log('not there');
}
else {
console.log('its there');
}
const guild = client.guilds.resolve(guildId);
if (guild.channels.cache.get(ids.chat) === undefined) {
console.log('not there');
}
else {
console.log('its there');
}
11 replies
DIAdiscord.js - Imagine an app
Created by Awashcard0 on 3/6/2023 in #djs-questions
Ping not working
Code:
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Get the ping to discord'),
async execute(client, interaction) {
interaction.followUp(`Ping to discord :- ${Math.round(client.ws.ping)}ms`);
},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Get the ping to discord'),
async execute(client, interaction) {
interaction.followUp(`Ping to discord :- ${Math.round(client.ws.ping)}ms`);
},
};
The error:
Error executing ping
TypeError: Cannot read properties of undefined (reading 'followUp')
at Object.execute (C:\Users\awash\Downloads\all mod\commands\ping.js:9:15)
at Object.execute (C:\Users\awash\Downloads\all mod\events\interactionCreate.js:16:18)
at Client.<anonymous> (C:\Users\awash\Downloads\all mod\index.js:38:44)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
at WebSocketShard.onPacket (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\WebSocketShard.js:489:22)
at WebSocketShard.onMessage (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\WebSocketShard.js:328:10)
at callListener (C:\Users\awash\Downloads\all mod\node_modules\ws\lib\event-target.js:290:14)
Error executing ping
TypeError: Cannot read properties of undefined (reading 'followUp')
at Object.execute (C:\Users\awash\Downloads\all mod\commands\ping.js:9:15)
at Object.execute (C:\Users\awash\Downloads\all mod\events\interactionCreate.js:16:18)
at Client.<anonymous> (C:\Users\awash\Downloads\all mod\index.js:38:44)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
at WebSocketShard.onPacket (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\WebSocketShard.js:489:22)
at WebSocketShard.onMessage (C:\Users\awash\Downloads\all mod\node_modules\discord.js\src\client\websocket\WebSocketShard.js:328:10)
at callListener (C:\Users\awash\Downloads\all mod\node_modules\ws\lib\event-target.js:290:14)
node = v18.13.0 djs = 14.7.1
13 replies
DIAdiscord.js - Imagine an app
Created by Awashcard0 on 3/5/2023 in #djs-questions
Api error??
Idk what it meens The error:
Process exited with code 1
Uncaught DiscordAPIError DiscordAPIError[50035]: Invalid Form Body
2.options[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (5, 7, 6, 9, 4, 11, 8, 1, 10, 2, 3).
3.options[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (5, 7, 6, 9, 4, 11, 8, 1, 10, 2, 3).
3.options[1][UNION_TYPE_CHOICES]: Value of field "type" must be one of (5, 7, 6, 9, 4, 11, 8, 1, 10, 2, 3).
at runRequest (c:\Users\awash\Downloads\All mob bot\node_modules\@discordjs\rest\dist\index.js:667:15)
at processTicksAndRejections (internal/process/task_queues:95:5)
index.js:667
No debugger available, can not send 'variables'
Process exited with code 1
Uncaught DiscordAPIError DiscordAPIError[50035]: Invalid Form Body
2.options[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (5, 7, 6, 9, 4, 11, 8, 1, 10, 2, 3).
3.options[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (5, 7, 6, 9, 4, 11, 8, 1, 10, 2, 3).
3.options[1][UNION_TYPE_CHOICES]: Value of field "type" must be one of (5, 7, 6, 9, 4, 11, 8, 1, 10, 2, 3).
at runRequest (c:\Users\awash\Downloads\All mob bot\node_modules\@discordjs\rest\dist\index.js:667:15)
at processTicksAndRejections (internal/process/task_queues:95:5)
index.js:667
No debugger available, can not send 'variables'
24 replies
DIAdiscord.js - Imagine an app
Created by Awashcard0 on 3/4/2023 in #djs-questions
user ID from command
How should I get the user ID from command runner
18 replies
DIAdiscord.js - Imagine an app
Created by Awashcard0 on 1/22/2023 in #djs-questions
send a screenshot
24 replies
DIAdiscord.js - Imagine an app
Created by Awashcard0 on 1/21/2023 in #djs-questions
bot won't make commands and gives weird errors but still comes online
This is the error i get: [Error_Handling] :: Unhandled Rejection/Catch DiscordAPIError: Invalid Form Body name: Command name is invalid at RequestHandler.execute (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async RequestHandler.push (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\rest\RequestHandler.js:51:14) at async GuildApplicationCommandManager.set (C:\Users\awash\Downloads\Natro-control (0.0.1)\node_modules\discord.js\src\managers\ApplicationCommandManager.js:162:18) at async C:\Users\awash\Downloads\Natro-control-(0.0.1)\handlers\slash_handler.js:30:21 { method: 'put', path: '/applications/1066423230291771494/guilds/1061077499834011658/commands', code: 50035, httpStatus: 400, requestData: { json: [ [Object], [Object], [Object], [Object], [Object], [Object] ], files: [] } } Promise { <rejected> DiscordAPIError: Invalid Form Body name: Command name is invalid at RequestHandler.execute (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async RequestHandler.push (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\rest\RequestHandler.js:51:14) at async GuildApplicationCommandManager.set (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\managers\ApplicationCommandManager.js:162:18) at async C:\Users\awash\Downloads\Natro-control-(0.0.1)\handlers\slash_handler.js:30:21 { method: 'put', path: '/applications/1066423230291771494/guilds/1061077499834011658/commands', code: 50035, httpStatus: 400, requestData: { json: [Array], files: [] } } } [Error_Handling] :: Unhandled Rejection/Catch DiscordAPIError: Invalid Form Body name: Command name is invalid at RequestHandler.execute (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async RequestHandler.push (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\rest\RequestHandler.js:51:14) at async GuildApplicationCommandManager.set (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\managers\ApplicationCommandManager.js:162:18) at async C:\Users\awash\Downloads\Natro-control-(0.0.1)\handlers\slash_handler.js:30:21 { method: 'put', path: '/applications/1066423230291771494/guilds/1061077499834011658/commands', code: 50035, httpStatus: 400, requestData: { json: [ [Object], [Object], [Object], [Object], [Object], [Object] ], files: [] } } Promise { <rejected> DiscordAPIError: Invalid Form Body name: Command name is invalid at RequestHandler.execute (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async RequestHandler.push (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\rest\RequestHandler.js:51:14) at async GuildApplicationCommandManager.set (C:\Users\awash\Downloads\Natro-control-(0.0.1)\node_modules\discord.js\src\managers\ApplicationCommandManager.js:162:18) at async C:\Users\awash\Downloads\Natro-control-(0.0.1)\handlers\slash_handler.js:30:21 { method: 'put', path: '/applications/1066423230291771494/guilds/1061077499834011658/commands', code: 50035, httpStatus: 400, requestData: { json: [Array], files: [] } } }
11 replies
DIAdiscord.js - Imagine an app
Created by Awashcard0 on 12/22/2022 in #djs-voice
Server mute and unmute
I wanted to know if there was a way to make it server mute and unserver mute itself
5 replies