0% found this document useful (0 votes)
9 views2 pages

Discord AFK Mode Toggle Script

This document is a JavaScript module for a Discord self-bot command that toggles AFK (Away From Keyboard) mode. When AFK mode is enabled, the bot responds to direct messages and mentions with a random AFK message from a predefined list and logs the interaction via a webhook. The configuration settings are read from JSON files and updated accordingly when the command is executed.

Uploaded by

n8mtz756sj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Discord AFK Mode Toggle Script

This document is a JavaScript module for a Discord self-bot command that toggles AFK (Away From Keyboard) mode. When AFK mode is enabled, the bot responds to direct messages and mentions with a random AFK message from a predefined list and logs the interaction via a webhook. The configuration settings are read from JSON files and updated accordingly when the command is executed.

Uploaded by

n8mtz756sj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

const fs = require('fs');

const path = require('path');


const { WebhookClient } = require('[Link]-selfbot-v13');

const Config = require("../../Config/[Link]");


const Settings = require("../../Config/[Link]");

[Link] = {
name: 'afk',
description: 'Toggle AFK mode',
category: 'General',
execute(message, args, client) {
const configPath = [Link](__dirname, '..', 'Config', '[Link]');

// Toggle AFK status


[Link] = ![Link];

// Save updated config


[Link](configPath, [Link](Config, null, 2));
[Link](`AFK mode has been ${[Link] ?
'enabled' : 'disabled'}.`);
},
init(client) {
[Link]('messageCreate', handle);
}
};

async function handle(message) {


// Reload config on each message to get latest settings
const Config = [Link]([Link]([Link](__dirname, '..', '..',
'Config', '[Link]')));

if (![Link]) return;

// Check if mention or DM
if ([Link] === 'DM' ||
[Link]([Link])) {
if ([Link] === [Link]) return; // Don't reply to
self
if ([Link]('@everyone') ||
[Link]('@here')) return; // Exclude everyone and here

// Get random AFK message from config


const randomKeyword = [Link][
[Link]([Link]() * [Link])
];

await [Link](`${randomKeyword}`);

try {
const webhookClient = new WebhookClient({ url: [Link] });
await [Link]({
content: `@everyone AFK Logs (Type: ${[Link] === 'DM'
? 'DM' : [Link]})\n\`\`\`\nUser: ${[Link]}\nMessage: $
{[Link]}\nResponse: ${randomKeyword}\`\`\``
});
} catch (error) {
//[Link]('Failed to send webhook:', error);
}
}
}

You might also like