incident-actions

Does discord.js already include the function to enable the incident-actions like "Disable PM for 24h"? If yes, can some provide me how it works? 🙂
No description
16 Replies
d.js toolkit
d.js toolkit•9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
d.js docs
d.js docs•9mo ago
:method: Guild#edit() Updates the guild with new information - e.g. a new name.
kin.ts
kin.ts•9mo ago
yea it's possible currently discord.js doesn't have a method for those endpoint, you can call <Client>.rest.put("/guilds/{guildId}/incident-actions", { body }); for now * Note: the endpoint only available for community-enabled server true
KennoBe
KennoBeOP•9mo ago
Thanks, so it's like my attached screenshot 😄 i didn't know i can call rest directly, thanks for that! So if I want to block PM for 24h, it should look like this?
const now = new Date();
const tomorrow = new Date(now.getTime() + (24 * 60 * 60 * 1000));
const isoTimestamp = tomorrow.toISOString();
const body = {
"dms_disabled_until": isoTimestamp
};
client.rest.put("/guilds/{guildId}/incident-actions", { body } );
const now = new Date();
const tomorrow = new Date(now.getTime() + (24 * 60 * 60 * 1000));
const isoTimestamp = tomorrow.toISOString();
const body = {
"dms_disabled_until": isoTimestamp
};
client.rest.put("/guilds/{guildId}/incident-actions", { body } );
kin.ts
kin.ts•9mo ago
you forgot to close the endpoint string, but yeah, try it and see if it works or not
"/guilds/{guildId}/incident-actions
"/guilds/{guildId}/incident-actions
KennoBe
KennoBeOP•9mo ago
you're right I would let this post open, that maybe it can be updated when discord.js has integrated this feature? 🙂
kin.ts
kin.ts•9mo ago
still wrong btw
KennoBe
KennoBeOP•9mo ago
yeah I was happy that automod is already documented but was still a pain to create the commands to create ones 😄 what 😦
kin.ts
kin.ts•9mo ago
this is.. invalid endpoint
"/guilds/{guildId}/incident-actions, body: { body }"
"/guilds/{guildId}/incident-actions, body: { body }"
KennoBe
KennoBeOP•9mo ago
do i need to close it after ..-actions?
kin.ts
kin.ts•9mo ago
yeah, and you should just pass { body } as the second param
KennoBe
KennoBeOP•9mo ago
damn, thanks 😄
kin.ts
kin.ts•9mo ago
np
KennoBe
KennoBeOP•9mo ago
like this?
kin.ts
kin.ts•9mo ago
await client.rest.put("/guilds/{guildId}/incident-actions", { body });
await client.rest.put("/guilds/{guildId}/incident-actions", { body });
KennoBe
KennoBeOP•9mo ago
yeah changed it already after asking you 😄 will try it later, but I'm confident that it should work now 🙂
Want results from more Discord servers?
Add your server