mibomboklat_1

make me a discord bot script that will automaticly click at this join queue button automaticly when tier tester open queue

1 image attached
Kodari AI
KodariAug 28 at 8:43 pm 1
QueueAutoJoiner
A Discord bot that monitors a designated channel for a "Join Queue" button and automatically clicks it when a tier tester opens the queue. The bot listens for message updates and reactions, detects the queue activation, and triggers the join action instantly. Includes configurable channel IDs, cooldown settings, and logging for successful joins.
  1. Create a Discord.js bot that detects the queue opening and sends an immediate notification.

  2. Keep credentials in .env and document the required permissions and configuration.

  3. Avoid unauthorized self-bot/client automation: Discord bots cannot click another bot’s button on a user’s behalf.

Created a Discord.js bot that:

  • Detects when Tester(s) Available! appears with a Join Queue button.

  • Watches new messages and edited queue messages.

  • Sends one alert when the queue opens.

  • Supports optional user mentions and queue-bot filtering.

  • Uses .env for credentials and configuration.

  • Includes setup instructions in README.md.

A normal Discord bot cannot click another bot’s button on behalf of a user. Automating a personal account would be a self-bot and can result in account termination, so this implementation safely sends an immediate clickable alert instead.

mibomboklat_1

no make it so it clicks automaticly on its own at the join queue button when it detects that tester opend a queue

Kodari AI
KodariAug 28 at 8:44 pm 1

That exact behavior isn’t possible with a normal Discord bot. Discord only allows the account that owns a button’s interaction to process it; a bot cannot impersonate your user account and click another bot’s Join Queue button.

Using a user token or self-bot to automate the click violates Discord’s Terms of Service and can get the account banned. The safe options are:

  • Keep the current bot and send an instant notification when the queue opens.

  • Ask the tier-testing bot’s developer for an official auto-queue/API integration.

  • If you control the queue bot, add an interaction handler so your bot can automatically join its own queue.

Kodari can make mistakes. Review important code before using.
Files
.gitignore
index.js
package.json
README.md
Code
4 176
index.js
require('dotenv').config();

const {
  Client,
  GatewayIntentBits,
  Partials,
} = require('discord.js');

const token = process.env.DISCORD_TOKEN;
const queueChannelId = process.env.QUEUE_CHANNEL_ID;
const alertChannelId = process.env.ALERT_CHANNEL_ID || queueChannelId;
const alertUserId = process.env.ALERT_USER_ID;
const queueBotId = process.env.QUEUE_BOT_ID;

if (!token) {
  throw new Error('DISCORD_TOKEN is missing from .env');
}

if (!queueChannelId) {
  throw new Error('QUEUE_CHANNEL_ID is missing from .env');
}

const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
  ],
  partials: [Partials.Channel, Partials.Message],
});

// Stores the last known open/closed state so edited queue messages only alert once.
const queueStates = new Map();

function messageText(message) {
  const embedText = message.embeds
    .flatMap((embed) => [embed.title, embed.description])
    .filter(Boolean)
    .join('\n');

  return `${message.content}\n${embedText}`;
}

function hasJoinQueueButton(message) {
  return message.components
    .flatMap((row) => row.components)
    .some((component) => component.label?.trim().toLowerCase() === 'join queue');
}

function isOpenQueueMessage(message) {
  if (message.channelId !== queueChannelId) return false;
  if (queueBotId && message.author?.id !== queueBotId) return false;

  const text = messageText(message);
  return /tester\(s\)\s+available/i.test(text) && hasJoinQueueButton(message);
}

async function sendQueueAlert(message) {
  const alertChannel = await client.channels.fetch(alertChannelId);

  if (!alertChannel?.isTextBased() || typeof alertChannel.send !== 'function') {
    throw new Error(`Alert channel ${alertChannelId} is not a text channel`);
  }

  const mention = alertUserId ? `<@${alertUserId}> ` : '';
  await alertChannel.send({
    content: `${mention}Tier tester queue is open: ${message.url}`,
    allowedMentions: alertUserId ? { users: [alertUserId] } : { users: [] },
  });
}

async function inspectQueueMessage(message) {
  if (message.partial) {
    try {
      message = await message.fetch();
    } catch (error) {
      console.error('Could not fetch a partial queue message:', error.message);
      return;
    }
  }

  const open = isOpenQueueMessage(message);
  const wasOpen = queueStates.get(message.id) ?? false;
  queueStates.set(message.id, open);

  if (open && !wasOpen) {
    try {
      await sendQueueAlert(message);
      console.log(`Queue opened in message ${message.id}`);
    } catch (error) {
      console.error('Could not send queue alert:', error.message);
    }
  }
}

client.once('ready', () => {
  console.log(`Logged in as ${client.user.tag}`);
  console.log(`Watching queue channel ${queueChannelId}`);
});

client.on('messageCreate', (message) => {
  inspectQueueMessage(message).catch((error) => {
    console.error('Queue inspection failed:', error);
  });
});

client.on('messageUpdate', (_oldMessage, newMessage) => {
  inspectQueueMessage(newMessage).catch((error) => {
    console.error('Queue inspection failed:', error);
  });
});

client.on('error', (error) => {
  console.error('Discord client error:', error);
});

process.on('unhandledRejection', (error) => {
  console.error('Unhandled promise rejection:', error);
});

client.login(token).catch((error) => {
  console.error('Discord login failed:', error.message);
  process.exitCode = 1;
});