IAmBatman
IAmBatman
DIAdiscord.js - Imagine an app
Created by IAmBatman on 5/22/2024 in #djs-questions
Looking for a good way to organize subcommand groups
No description
4 replies
DIAdiscord.js - Imagine an app
Created by IAmBatman on 5/1/2024 in #djs-questions
Relative timestamp in embed footer
I want to put a relative timestamp in an embed footer. setTimestamp() doesn't accept strings, so I cannot pass the relative timestamp as an argument. When I use the relative timestamp in setFooter() like this
.setFooter({
text: `Last Update: ${relativeTime}`,
})
.setFooter({
text: `Last Update: ${relativeTime}`,
})
I get this
Last Update: <t:1714575200:R>
Last Update: <t:1714575200:R>
I know it would work if the timestamp was in a description or a field value, I just want to put it in the footer so it can look a little better. Is it possible to achieve this?
7 replies
DIAdiscord.js - Imagine an app
Created by IAmBatman on 4/13/2024 in #djs-questions
Cannot register commands globally
I am trying to register my slash commands to every server that my bot is in, but for some reason I can't. This code worked before it suddenly decided not working. I don't get any errors, it just halts the execution like it is still waiting for the response. My bot is in only two servers at the moment, I have tried kicking it from both of them and inviting back with application.commands and bot permissions. I have also tried using client.application.commands.set() instead of rest.put(). Here is a part of my code:
try {
await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), {
body: [],
});

const allGuildIds = await client.guilds.cache.map((guild) => guild.id);

await allGuildIds.forEach((guildId) => {
rest.put(
Routes.applicationGuildCommands(process.env.CLIENT_ID, guildId),
{
body: [],
}
);
});

console.log(
`🔄 Started refreshing ${commands.length} application commands...`
);

// THIS WORKS
const data = await rest.put(
Routes.applicationGuildCommands(
process.env.CLIENT_ID,
process.env.GUILD_ID
),
{
body: commands,
}
);

// THIS DOES NOT WORK
// const data = await rest.put(
// Routes.applicationCommands(process.env.CLIENT_ID),
// {
// body: commands,
// }
// );

console.log(
`✅ Successfully refreshed ${data.length} application commands!`
);
} catch (err) {
console.log(`There was an error: ${err}`);
}
try {
await rest.put(Routes.applicationCommands(process.env.CLIENT_ID), {
body: [],
});

const allGuildIds = await client.guilds.cache.map((guild) => guild.id);

await allGuildIds.forEach((guildId) => {
rest.put(
Routes.applicationGuildCommands(process.env.CLIENT_ID, guildId),
{
body: [],
}
);
});

console.log(
`🔄 Started refreshing ${commands.length} application commands...`
);

// THIS WORKS
const data = await rest.put(
Routes.applicationGuildCommands(
process.env.CLIENT_ID,
process.env.GUILD_ID
),
{
body: commands,
}
);

// THIS DOES NOT WORK
// const data = await rest.put(
// Routes.applicationCommands(process.env.CLIENT_ID),
// {
// body: commands,
// }
// );

console.log(
`✅ Successfully refreshed ${data.length} application commands!`
);
} catch (err) {
console.log(`There was an error: ${err}`);
}
Also, if there is a better way to clear the application commands from every guild before adding the new ones, please let me know.
9 replies
DIAdiscord.js - Imagine an app
Created by IAmBatman on 3/29/2024 in #djs-questions
Aligning field value text to center in an embed
No description
2 replies