Ashish
Ashish
DIAdiscord.js - Imagine an app
Created by Ashish on 6/17/2023 in #djs-questions
Channel permissions
So I have a bot that changes a bunch of people's permission for a channel. However, I am getting the following DiscordAPIError[50013]: Missing Permissions However the bot does have permissions (unless it's a person higher than them)
client.channels.cache.get(game.channel)?.permissionOverwrites.set([
{ id: guildId, deny: ["ViewChannel"] },
...game.players.filter(a => !game[`player_${a}`].name.startsWith("Player") && game[`player_${a}`].status === 'Alive').map(a => ({ id: a, allow: ["SendMessages", "ViewChannel", "ReadMessageHistory"], deny: ["AddReactions", "AttachFiles"] })),
...game.players.filter(a => !game[`player_${a}`].name.startsWith("Player") && game[`player_${a}`].status === 'Dead').map(a => ({ id: a, allow: ["ViewChannel", "ReadMessageHistory"], deny: ["SendMessages", "AddReactions", "AttachFiles"] }) )])
client.channels.cache.get(game.channel)?.permissionOverwrites.set([
{ id: guildId, deny: ["ViewChannel"] },
...game.players.filter(a => !game[`player_${a}`].name.startsWith("Player") && game[`player_${a}`].status === 'Alive').map(a => ({ id: a, allow: ["SendMessages", "ViewChannel", "ReadMessageHistory"], deny: ["AddReactions", "AttachFiles"] })),
...game.players.filter(a => !game[`player_${a}`].name.startsWith("Player") && game[`player_${a}`].status === 'Dead').map(a => ({ id: a, allow: ["ViewChannel", "ReadMessageHistory"], deny: ["SendMessages", "AddReactions", "AttachFiles"] }) )])
Could it be because it's trying to edit someone's permission that is higher than the bot? ```
37 replies
DIAdiscord.js - Imagine an app
Created by Ashish on 6/8/2023 in #djs-voice
[SOLVED] 🤦Bot doesnt join the voice channel
So I have the following code, when its being executed, the bot doesnt join the voice channel.
const { joinVoiceChannel, createAudioPlayer, createAudioResource, StreamType } = require("@discordjs/voice")
const { join } = require("node:path")

module.exports.run = async (message, client) => {

const resource = createAudioResource(join(__dirname, "pregame.wav"), {
inputType: StreamType.WebmOpus
})

const connection = joinVoiceChannel({
channelId: client.channelId,
guildId: message.guild.id,
adapterCreator: message.guild.voiceAdapterCreator
})

const player = createAudioPlayer()

player.play(resource)
connection.subscribe(player)

}
const { joinVoiceChannel, createAudioPlayer, createAudioResource, StreamType } = require("@discordjs/voice")
const { join } = require("node:path")

module.exports.run = async (message, client) => {

const resource = createAudioResource(join(__dirname, "pregame.wav"), {
inputType: StreamType.WebmOpus
})

const connection = joinVoiceChannel({
channelId: client.channelId,
guildId: message.guild.id,
adapterCreator: message.guild.voiceAdapterCreator
})

const player = createAudioPlayer()

player.play(resource)
connection.subscribe(player)

}
client.channelId is defined in the main file as a channel ID. Am i doing something wrong? There are no errors in the console and the file is being ran (ive added console.logs to see if it works and it does). Idk if its an intent issue but here are my intents:
const intents = [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessages]
const intents = [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessages]
21 replies
DIAdiscord.js - Imagine an app
Created by Ashish on 2/14/2023 in #djs-questions
Unable to create a new channel
10 replies