rad
rad
Explore posts from servers
DIAdiscord.js - Imagine a boo! 👻
Created by rad on 8/4/2024 in #djs-questions
Issues editing automod
for (const module of serverRecord.modules) {
try {
const rule = await autoModManager.fetch(module.id);
const newActions = [
{
type: AutoModerationActionType.Timeout,
metadata: { durationSeconds: duration },
},
];
for (const module of serverRecord.modules) {
try {
const rule = await autoModManager.fetch(module.id);
const newActions = [
{
type: AutoModerationActionType.Timeout,
metadata: { durationSeconds: duration },
},
];
If I leave it like this, without the splitting, it'll just turn off block messages and alert, and only turn on timeout duration yk
4 replies
DIAdiscord.js - Imagine a boo! 👻
Created by rad on 8/4/2024 in #djs-questions
Issues editing automod
And i'm not really sure why, here is my code that deals with editing it, the code that goes below this is for managing the database
const autoModManager = interaction.guild?.autoModerationRules;
if (!autoModManager) return;

for (const module of serverRecord.modules) {
try {
const rule = await autoModManager.fetch(module.id);
console.log('Current Rule actions:', rule.actions);

let actionUpdated = false;
const newActions = rule.actions.map((action) => {
if (action.type === AutoModerationActionType.Timeout) {
actionUpdated = true;
return {
type: AutoModerationActionType.Timeout,
metadata: { durationSeconds: duration },
};
}
return action;
});

if (!actionUpdated) {
newActions.push({
type: AutoModerationActionType.Timeout,
metadata: { durationSeconds: duration },
});
}

const editOptions: AutoModerationRuleEditOptions = { actions: newActions };

console.log('Sending the following edit options to Discord:', JSON.stringify(editOptions, null, 2));

await rule.edit(editOptions);
const autoModManager = interaction.guild?.autoModerationRules;
if (!autoModManager) return;

for (const module of serverRecord.modules) {
try {
const rule = await autoModManager.fetch(module.id);
console.log('Current Rule actions:', rule.actions);

let actionUpdated = false;
const newActions = rule.actions.map((action) => {
if (action.type === AutoModerationActionType.Timeout) {
actionUpdated = true;
return {
type: AutoModerationActionType.Timeout,
metadata: { durationSeconds: duration },
};
}
return action;
});

if (!actionUpdated) {
newActions.push({
type: AutoModerationActionType.Timeout,
metadata: { durationSeconds: duration },
});
}

const editOptions: AutoModerationRuleEditOptions = { actions: newActions };

console.log('Sending the following edit options to Discord:', JSON.stringify(editOptions, null, 2));

await rule.edit(editOptions);
4 replies
DIAdiscord.js - Imagine a boo! 👻
Created by rad on 11/13/2023 in #djs-questions
ActivityType not setting correctly
thank you for your help
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by rad on 11/13/2023 in #djs-questions
ActivityType not setting correctly
i probably did something wrong somewhere else or discord is jut choosing to not abide by their own docs maybe the bot just isn't losing it's status from what it was originally ill see tomorrow
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by rad on 11/13/2023 in #djs-questions
ActivityType not setting correctly
competing works
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by rad on 11/13/2023 in #djs-questions
ActivityType not setting correctly
unless you can jsut do that with integers
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by rad on 11/13/2023 in #djs-questions
ActivityType not setting correctly
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by rad on 11/13/2023 in #djs-questions
ActivityType not setting correctly
i also tried doing this
let activityType = ActivityType.Custom;
if (statusType) {
switch (statusType.toLowerCase()) {
case 'playing':
activityType = ActivityType.Playing;
break;
case 'watching':
activityType = ActivityType.Watching;
break;
case 'listening':
activityType = ActivityType.Listening;
break;
case 'streaming':
activityType = ActivityType.Streaming;
break;
case 'competing':
activityType = ActivityType.Competing;
break;
default:
activityType = ActivityType.Custom;
break;
}
}
let activityType = ActivityType.Custom;
if (statusType) {
switch (statusType.toLowerCase()) {
case 'playing':
activityType = ActivityType.Playing;
break;
case 'watching':
activityType = ActivityType.Watching;
break;
case 'listening':
activityType = ActivityType.Listening;
break;
case 'streaming':
activityType = ActivityType.Streaming;
break;
case 'competing':
activityType = ActivityType.Competing;
break;
default:
activityType = ActivityType.Custom;
break;
}
}
14 replies
DIAdiscord.js - Imagine a boo! 👻
Created by !𝓩𝓮𝓴𝓱𝓪𝓹 on 10/12/2023 in #djs-questions
Vertical & Horizontal Scale question
Each shard will be connected to one central redis and mongo
8 replies
DIAdiscord.js - Imagine a boo! 👻
Created by !𝓩𝓮𝓴𝓱𝓪𝓹 on 10/12/2023 in #djs-questions
Vertical & Horizontal Scale question
Yes that's what it would do
8 replies
DIAdiscord.js - Imagine a boo! 👻
Created by !𝓩𝓮𝓴𝓱𝓪𝓹 on 10/12/2023 in #djs-questions
Vertical & Horizontal Scale question
Or docker swarm
8 replies
DIAdiscord.js - Imagine a boo! 👻
Created by !𝓩𝓮𝓴𝓱𝓪𝓹 on 10/12/2023 in #djs-questions
Vertical & Horizontal Scale question
Kubernetes may be for you
8 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Wiktor. on 9/29/2023 in #djs-questions
Command Handler Not Working??
intents? does the bot have the right perms?
21 replies