discord-bot-status
Advanced tools
Comparing version 1.1.0 to 1.2.0
31
index.js
@@ -19,18 +19,25 @@ const { Client, Intents, MessageEmbed, TextChannel } = require('discord.js'); | ||
startStatusUpdates() { | ||
console.log("BotStatus: startStatusUpdates called"); // Check if this is called | ||
this.client.once('ready', async () => { | ||
console.log("BotStatus: Bot is ready, setting up the channel..."); | ||
const channel = await this.client.channels.fetch(this.channelId); | ||
console.log("BotStatus: Client ready, attempting to fetch channel..."); // Confirm we’re here | ||
try { | ||
const channel = await this.client.channels.fetch(this.channelId); | ||
console.log("BotStatus: Channel fetched:", channel ? "Success" : "Failed"); | ||
// Ensure the bot has permissions to view and send messages to the channel | ||
if (!channel || !(channel instanceof TextChannel)) { | ||
console.error('BotStatus: Provided channel is invalid or not accessible.'); | ||
return; | ||
} | ||
// Ensure the bot has permissions to view and send messages to the channel | ||
if (!channel || !(channel instanceof TextChannel)) { | ||
console.error('BotStatus: Provided channel is invalid or not accessible.'); | ||
return; | ||
} | ||
console.log("BotStatus: Channel found and accessible, sending initial message."); | ||
// Initial status update | ||
await this.updateStatusMessage(channel); | ||
console.log("BotStatus: Channel is valid and accessible."); | ||
// Schedule status updates every 30 seconds | ||
setInterval(() => this.updateStatusMessage(channel), 30000); // 30 seconds | ||
// Initial status update | ||
await this.updateStatusMessage(channel); | ||
// Schedule status updates every 30 seconds | ||
setInterval(() => this.updateStatusMessage(channel), 30000); // 30 seconds | ||
} catch (error) { | ||
console.error("BotStatus: Error fetching the channel:", error); | ||
} | ||
}); | ||
@@ -37,0 +44,0 @@ } |
{ | ||
"name": "discord-bot-status", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A package that automatically displays bot status (online/offline, ping) in a specified Discord channel with real-time updates.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
5012
85