Skip to content
49 changes: 46 additions & 3 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'dotenv/config';
import 'dotenv/config';
import { Client, Collection, GatewayIntentBits } from 'discord.js';
import { REST } from '@discordjs/rest';
import express from 'express';
Expand Down Expand Up @@ -88,6 +88,9 @@ class TitanBot extends Client {
await this.registerCommands();
startupLog('Slash commands registration complete');

// Set bot presence after login
this.setInitialPresence();

const databaseMode = dbStatus.isDegraded
? 'Optional in-memory mode (data resets after restart)'
: 'Connected (persistent data enabled)';
Expand All @@ -103,6 +106,25 @@ class TitanBot extends Client {
}
}

setInitialPresence() {
try {
this.user.setPresence({
activities: [
{
name: 'Minecraft: Void Edition',
type: 'PLAYING',
state: 'Always Online'
}
],
status: 'online'
}).catch(error => {
logger.error('Failed to set initial presence:', error);
});
} catch (error) {
logger.error('Error setting initial presence:', error);
}
}

startWebServer() {
const app = express();
const configuredPort = Number(this.config.api?.port || process.env.PORT || 3000);
Expand Down Expand Up @@ -231,6 +253,29 @@ class TitanBot extends Client {
cron.schedule('0 6 * * *', () => checkBirthdays(this));
cron.schedule('* * * * *', () => checkGiveaways(this));
cron.schedule('*/15 * * * *', () => this.updateAllCounters());

// Update presence every 30 seconds with rotating statuses
this.presenceIndex = 0;
const presences = [
{ name: 'Minecraft: Void Edition', type: 'PLAYING', state: 'Always Online' },
{ name: 'Over Your Server', type: 'WATCHING', state: 'Ready to help!' },
{ name: 'Your Commands', type: 'LISTENING', state: 'Void Edition' }
];

setInterval(() => {
try {
const presence = presences[this.presenceIndex % presences.length];
this.user.setPresence({
activities: [presence],
status: 'online'
}).catch(error => {
logger.error('Failed to update presence:', error);
});
this.presenceIndex++;
} catch (error) {
logger.error('Error updating presence:', error);
}
}, 30000);
}

async updateAllCounters() {
Expand Down Expand Up @@ -382,5 +427,3 @@ try {

export default TitanBot;



193 changes: 0 additions & 193 deletions src/commands/Economy/slut.js

This file was deleted.

1 change: 0 additions & 1 deletion src/config/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const __dirname = path.dirname(__filename);




const appConfig = {
paths: {
root: path.join(__dirname, "../.."),
Expand Down
13 changes: 6 additions & 7 deletions src/config/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const botConfig = {
// 5 = Competing
activities: [
{
// Text users will see (example: "Playing /help | Titan Bot").
name: "Made with ❤️",
// Text users will see (example: "Playing Minecraft: Void Edition").
name: "Minecraft: Void Edition",
// Activity type number (0 = Playing).
type: 0,
},
Expand Down Expand Up @@ -57,8 +57,10 @@ export const botConfig = {
// Default questions shown when someone fills out an application.
defaultQuestions: [
{ question: "What is your name?", required: true },
{ question: "How old are you?", required: true },
{ question: "How old are you?", required: false },
{ question: "Why do you want to join?", required: true },
{ question: "How Long have you been in the Server", required: true },
{ question: "What role do you want?", required: true },
],

// Embed colors by application status.
Expand Down Expand Up @@ -136,7 +138,7 @@ export const botConfig = {
},
footer: {
// Default footer text used in bot embeds.
text: "Titan Bot",
text: "VoidXZ",
// Footer icon URL (null = no icon).
icon: null,
},
Expand Down Expand Up @@ -544,6 +546,3 @@ export function getRandomColor() {

export default botConfig;




16 changes: 16 additions & 0 deletions src/config/presence.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
static void UpdatePresence()
{
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
discordPresence.state = "Playing Minecraft: Void Edition";
discordPresence.details = "Survival";
discordPresence.startTimestamp = 1507665886;
discordPresence.endTimestamp = 1507665886;
discordPresence.largeImageText = "Numbani";
discordPresence.smallImageText = "Rogue - Level 100";
discordPresence.partyId = "ae488379-351d-4a4f-ad32-2b9b01c91657";
discordPresence.partySize = 3;
discordPresence.partyMax = 5;
discordPresence.joinSecret = "MTI4NzM0OjFpMmhuZToxMjMxMjM= ";
Discord_UpdatePresence(&discordPresence);
}
18 changes: 16 additions & 2 deletions src/events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export default {

async execute(client) {
try {
client.user.setPresence(config.bot.presence);
// Set initial presence
client.user.setPresence(config.bot.presence).catch(error => {
logger.error("Failed to set initial presence:", error);
});

startupLog(`Ready! Logged in as ${client.user.tag}`);
startupLog(`Serving ${client.guilds.cache.size} guild(s)`);
Expand All @@ -19,10 +22,21 @@ export default {
startupLog(
`Reaction role reconciliation: scanned ${reconciliationSummary.scannedMessages}, removed ${reconciliationSummary.removedMessages}, errors ${reconciliationSummary.errors}`
);

// Update presence every 30 seconds to keep it active
setInterval(() => {
try {
client.user.setPresence(config.bot.presence).catch(error => {
logger.error("Failed to update presence:", error);
});
} catch (error) {
logger.error("Error updating presence:", error);
}
}, 30000);

} catch (error) {
logger.error("Error in ready event:", error);
}
},
};