Stew
Stew
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by Stew on 3/22/2024 in #djs-questions
TypeError [ColorConvert]: Unable to convert "16705372" to a number
Hey, I am using [email protected], and when importing Colors from discord.js and using .setColor(Colors.Red), it gives me the error: TypeError [ColorConvert]: Unable to convert "16705372" to a number Any ideas on how to fix it?
16 replies
DIAdiscord.js - Imagine an app
Created by Stew on 10/8/2022 in #djs-questions
ContextMenuCommandBuilder.setDMPermission does nothing
I want for my context menu to be inaccessible in DMs. My Context Menu class:
class ContextMenu extends ContextMenuCommandBuilder {
constructor(client, data) {
super();
this.setName(data.name);
this.setDMPermission(data.dm_permission);
this.setType(data.type);
this.setDefaultMemberPermissions(data.default_member_permissions);
}
}
class ContextMenu extends ContextMenuCommandBuilder {
constructor(client, data) {
super();
this.setName(data.name);
this.setDMPermission(data.dm_permission);
this.setType(data.type);
this.setDefaultMemberPermissions(data.default_member_permissions);
}
}
Initialization:
class TestContextMenu extends ContextMenu {
constructor(client) {
super(client, {
type: ApplicationCommandType.Message,
name: "testing",
default_member_permissions: PermissionFlagsBits.ManageMessages,
dm_permission: false

});
}
}
class TestContextMenu extends ContextMenu {
constructor(client) {
super(client, {
type: ApplicationCommandType.Message,
name: "testing",
default_member_permissions: PermissionFlagsBits.ManageMessages,
dm_permission: false

});
}
}
D.js docs (https://discord.js.org/#/docs/builders/main/class/ContextMenuCommandBuilder?scrollTo=setDMPermission) says it accepts null, undefined and boolean, so instead of dm_permission tried all valid values (null, undefined, true and false) and none of them restricted the context menu. The object that is sent to the API is
[
TestContextMenu {
name: 'testing',
type: 3,
default_permission: undefined,
default_member_permissions: '8192',
dm_permission: false
}
]
[
TestContextMenu {
name: 'testing',
type: 3,
default_permission: undefined,
default_member_permissions: '8192',
dm_permission: false
}
]
7 replies
DIAdiscord.js - Imagine an app
Created by Stew on 8/12/2022 in #djs-questions
Why does the library export an object twice?
7 replies