Ypsilon
Ypsilon
DIAdiscord.js - Imagine an app
Created by Ypsilon on 1/3/2025 in #djs-questions
GuildAuditLogEntryCreate & Typescript
export const handleAuditDrag = async (entry: GuildAuditLogsEntry, guild: Guild) => {
if (entry.action === AuditLogEvent.MemberMove) {
// 1322328096036094023
const userName = entry.executor?.username
const channelId = entry.extra.channel
}
}
export const handleAuditDrag = async (entry: GuildAuditLogsEntry, guild: Guild) => {
if (entry.action === AuditLogEvent.MemberMove) {
// 1322328096036094023
const userName = entry.executor?.username
const channelId = entry.extra.channel
}
}
How Can I get typescript to stop complaining about the extra property? What check do I need to do so it knows it will return entry.extra.channel ?
4 replies
DIAdiscord.js - Imagine an app
Created by Ypsilon on 12/23/2024 in #djs-questions
client.application.commands.permissions.set(), 401: Unauthorized
When I try to use the client.application.commands.permissions.set() I get the 401: Unauthorized You just use the bot token right? or do you have to use the application secret but i still get the error then. What am I doing wrong?
14 replies
DIAdiscord.js - Imagine an app
Created by Ypsilon on 10/7/2023 in #djs-questions
Embed Thumbnail not showing
No description
9 replies
DIAdiscord.js - Imagine an app
Created by Ypsilon on 8/28/2022 in #djs-questions
Import all commands from folder with ES modules
So my previous bot I build I used CommonJS and did the commands like this:
const commandsList = [];
const slashCommandFiles = readdirSync(path.resolve(__dirname, '../discord/commands'));

for (const fileSlash of slashCommandFiles) {
const commandSlash = require(path.resolve(__dirname, `../discord/commands/${fileSlash}`));
commandsList.push(commandSlash.commands)
}
const commandsList = [];
const slashCommandFiles = readdirSync(path.resolve(__dirname, '../discord/commands'));

for (const fileSlash of slashCommandFiles) {
const commandSlash = require(path.resolve(__dirname, `../discord/commands/${fileSlash}`));
commandsList.push(commandSlash.commands)
}
But now I really prefer to work with ES modules also because they are by default async. But now I have been thinking about a way to import all commands from the folder. But it doesn't work that easy with import. Anyone know a good way to do this. Because the export where build like
{
data: blabla,
action: (arg) => { stuff }
}
{
data: blabla,
action: (arg) => { stuff }
}
17 replies
DIAdiscord.js - Imagine an app
Created by Ypsilon on 8/22/2022 in #djs-questions
Can't get permissions on interaction command working
So with a rest.put I enter the commands in the discord
name: 'getideas',
description: 'get the list of ideas',
defaultMemberPermissions: 'Administrator',
name: 'getideas',
description: 'get the list of ideas',
defaultMemberPermissions: 'Administrator',
I have tried
defaultMemberPermissions: 'ADMINISTRATOR',
defaultMemberPermissions: 'ADMINISTRATOR',
defaultMemberPermissions: '0x0000000000000008',
defaultMemberPermissions: '0x0000000000000008',
defaultMemberPermissions: 'PermissionsBitField.Flags.Administrator',
defaultMemberPermissions: 'PermissionsBitField.Flags.Administrator',
The last one complains that it can serialize with the stringify for the put request None of these work. people without adminstrator rights keep seeing the command wrong. What am I doing wrong here ?
4 replies