Using discord.py base with nodejs (discord.js & voice) as addons
If an entire current setup is based around python, but I want to harness the speaking functionalities which only seem to be available in js libraries...
Should I be looking to incorporate the js commands within a container?
Or should I be running a separate set of scripts... ie. have python and js running simultaneously?
I'm running discord.js v14.14.1
And voice v0.16.1
Thx 🙂
15 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!No, I mean as a separate project
I want to find a way to integrate the js into an already existing environment which is currently 100% discord.py
Have gone through the docs, doesn't look like it has a speaking map function etc. like in js
Plus the python guys answered a little while back 😦
Yes, I'll do that then 🙂
Slightly off topic, but since I've updated to 14.14.1, I'm having trouble with adding intents to the Client
Previously I was using intents: [] with Intents.FLAGS.x
Now should I be using an IntentsBitField eg. what the bot permissions interface gives me in terms of a permissions integer?
Thx
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined
- All SCREAMING_SNAKE_CASE
enums have been changed to PascalCase
- Intents: Intents.FLAGS.GUILD_MESSAGES
-> GatewayIntentBits.GuildMessages
- Permissions: Permissions.FLAGS.SEND_MESSAGES
-> PermissionFlagsBits.SendMessages
So this is the correct approach?
import Discord from 'discord.js';
import { joinVoiceChannel, VoiceReceiver } from '@discordjs/voice';
const { GatewayIntentBits } = require('discord.js')
const discordClient = new Discord.Client({
intents: [
GatewayIntentBits.Guild,
GatewayIntentBits.VoiceStateUpdate,
]
});
Also, I know you touched on this explanation before, but should I be using Permissions at all in the code?
And if so, why's that - how would they differ from intents?
Thx again
Yes indeed. But the python bot is running on someone else's server that I'm looking to add js functionality to 🙂
And the explanation was great 🙂 But I don't understand where permissions ie. PermissionFlagsBits.x need to sit - are they required in the client when creating one:
const discordClient = new Discord.Client({
intents: [
GatewayIntentBits.Guild,
GatewayIntentBits.VoiceStateUpdate,
]
});
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
understood. thanks 🙂
its possible. its just not documented (receiving voice)
discord doesn't have plans to change that iirc
So I was able to get this to work by using IntentsBitField:
const { Client, IntentsBitField } = require('../node_modules/discord.js')
const { joinVoiceChannel } = require('../node_modules/@discordjs/voice')
const clientIntents = new IntentsBitField();
clientIntents.add(1);
clientIntents.add(128);
clientIntents.add(256);
const client = new Client({intents: clientIntents})
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
the issue was that I could never actually import it to use 😦
Unknown User•7mo ago
Message Not Public
Sign In & Join Server To View
DIdn't work for me for some reason 😦