Shaurya
Shaurya
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by Shaurya on 7/22/2023 in #djs-questions
member permissions to readable format
const memberPerms = member.permissions.toArray()
console.log(memberPerms)
const memberPerms = member.permissions.toArray()
console.log(memberPerms)
[
'CreateInstantInvite',
'KickMembers',
'ManageChannels',
'ManageGuild',
// ...
]
[
'CreateInstantInvite',
'KickMembers',
'ManageChannels',
'ManageGuild',
// ...
]
how do I get the permissions in a better readable way, like Kick Members, Manage Server, etc, is there some built-in way in discord.js or I'll have to make a custom one?
3 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 7/21/2023 in #djs-questions
slash command type issue
./lib/types/command.ts:
export type Command = {
category: Category
data: SlashCommandBuilder | SlashCommandSubcommandsOnlyBuilder | ContextMenuCommandBuilder
execute?: (i: ChatInputCommandInteraction, client: Client) => void
}
export type Command = {
category: Category
data: SlashCommandBuilder | SlashCommandSubcommandsOnlyBuilder | ContextMenuCommandBuilder
execute?: (i: ChatInputCommandInteraction, client: Client) => void
}
userinfo.ts:
const data = new SlashCommandBuilder()
.setName("userinfo")
.setDescription("Get the info of a user")
.setDMPermission(true)
.setNSFW(false)
.addUserOption(option =>
option
.setName("user")
.setDescription("The user to get the info of")
)

const userinfo: Command = {
category: "utility",
data,
async execute(i, client) {...}
}
const data = new SlashCommandBuilder()
.setName("userinfo")
.setDescription("Get the info of a user")
.setDMPermission(true)
.setNSFW(false)
.addUserOption(option =>
option
.setName("user")
.setDescription("The user to get the info of")
)

const userinfo: Command = {
category: "utility",
data,
async execute(i, client) {...}
}
Error (ts 2322)

Type

Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">
is not assignable to type

SlashCommandBuilder | SlashCommandSubcommandsOnlyBuilder | ContextMenuCommandBuilder
Error (ts 2322)

Type

Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">
is not assignable to type

SlashCommandBuilder | SlashCommandSubcommandsOnlyBuilder | ContextMenuCommandBuilder
how do I fix this issue? like if I add Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup"> it gets fixed but then there can I'll have to add more like "addBooleanOption" | "addUserOption" | ....., I just want it to be a slashcommand builder, it can have subcommands or not, or just options, etc.
7 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 7/3/2023 in #djs-questions
oldMember and newMember timeout issue
const oldTimeout = oldMember.communicationDisabledUntilTimestamp
const newTimeout = newMember.communicationDisabledUntilTimestamp
console.log("oldTimeout:", oldTimeout)
console.log("newTimeout:", newTimeout)

// timeout added
if (!oldTimeout && newTimeout) {...}
const oldTimeout = oldMember.communicationDisabledUntilTimestamp
const newTimeout = newMember.communicationDisabledUntilTimestamp
console.log("oldTimeout:", oldTimeout)
console.log("newTimeout:", newTimeout)

// timeout added
if (!oldTimeout && newTimeout) {...}
why isn't oldTimeout null when the oldMember wasn't timed out previously? I'm trying to make timeout logs but sometimes the oldTimeout isn't null but the oldMember wan't on timeout I see that if I don't manually remove the timeout (i.e. timeout is removed automatically by discord), the oldTimeout is available, what should I do to properly check the timeout is added to a member?
5 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 2/19/2023 in #djs-questions
discord.js error codes
is there any docs about all the error codes so i can handle them my way?
const errorCodes = [
50013 /*Missing Permissions*/,
50001 /*Missing Access*/
];
const errorCodes = [
50013 /*Missing Permissions*/,
50001 /*Missing Access*/
];
got these 2 myself by making the bot error, but doing all the errors manually is gonna take a lot time and i would miss some too, i found this: https://discord.js.org/#/docs/discord.js/main/typedef/DiscordjsErrorCodes, but it doesn't have the code of the error
7 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 2/2/2023 in #djs-questions
modal followUp
18 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 1/20/2023 in #djs-voice
playing music legally
how can I play music which don't violate? are there any sources? I was using youtube and spotify to play the music but turns out they violate discord tos. please tell me some sources to play music without tos violation.
7 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 11/19/2022 in #djs-voice
Getting existing audio player
how do i get the audio player in a guild if any?
30 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 11/18/2022 in #djs-voice
aborted error
i get this error:
[Uncaught Exception] :
Error: aborted
Origin: uncaughtException
[Uncaught Exception] :
Error: aborted
Origin: uncaughtException
after at around 3 minutes when the bot is playing music in a voice channel how do i fix this issue, the bot stops in between and shows this aborted error
8 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 11/17/2022 in #djs-voice
volume
hwo do i increase/decrease the volume of bot in a voice channel? doing <Resource>.volume.setVolume() changes the volume but it's like chnages the bass of the sound and not the actual volume
3 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 11/16/2022 in #djs-voice
Volume
How do i get the current volume of the bot?
6 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 11/12/2022 in #djs-voice
Connection
How do i check if the bot has an active connection in a guild?
5 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 9/4/2022 in #djs-voice
voice
How do i make the bot play audio from yt?
36 replies
DIAdiscord.js - Imagine an app
Created by Shaurya on 7/24/2022 in #djs-voice
play
What is this:
const player = message.client.manager.players.get(message.guild.id) 
const player = message.client.manager.players.get(message.guild.id) 
in v13?
18 replies