Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2026 codebymitch
Copyright (c) 2026 hjackstudios

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
252 changes: 4 additions & 248 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,257 +1,13 @@
# TitanBot - Ultimate Discord Bot
# jackbot - Ultimate Discord Bot

**TitanBot** is a powerful, feature-rich Discord bot designed to enhance your server experience with comprehensive moderation tools, engaging economy systems, utility features, and much more. Built with modern Discord.js v14 and PostgreSQL for optimal performance and data persistence.

[![Support Server](https://img.shields.io/badge/-Support%20Server-%235865F2?logo=discord&logoColor=white&style=flat-square&logoWidth=20)](https://discord.gg/8kJBYhTGW9)
[![Discord.js](https://img.shields.io/npm/v/discord.js?style=flat-square&labelColor=%23202225&color=%23202225&logo=npm&logoColor=white&logoWidth=20)](https://www.npmjs.com/package/discord.js)
![PostgreSQL](https://img.shields.io/badge/-PostgreSQL-%23336791?logo=postgresql&logoColor=white&style=flat-square&logoWidth=20)

## Table of Contents

- [Features Overview](#features-overview)
- [Quick Setup](#quick-setup)
- [Manual Installation Steps](#manual-installation-steps)
- [Support Server](https://discord.gg/QnWNz2dKCE)
- [Required Bot Intents](#bot-intents)
- [Contributing](#contributing)

<a name="features-overview"></a>
## Features Overview

TitanBot offers a complete suite of tools for Discord server management and community engagement:

<table>
<tr>
<td width="50%" valign="top">

### Moderation & Administration
- **Mass Actions** - Bulk ban/kick capabilities
- **User Notes** - Keep detailed moderation records
- **Case Management** - View and track all mod actions

### Economy System
- **Shop & Inventory** - Buy and manage items
- **Gambling** - Risk it for rewards
- **Pay System** - Transfer money between users

### Fun & Entertainment
- **Random Facts** - Learn something new
- **Wanted Poster** - Create fun wanted images
- **Text Reversal** - Reverse any text

### Advanced Ticket System
- **Claim & Priority** - Staff ticket management
- **Ticket Limits** - Prevent spam
- **Transcript System** - Save ticket history

### Server Stats
- **Member Counter** - Live member count channels
- **Voice Counters** - Track voice stats
- **Dynamic Updates** - Real-time channel updates

### Reaction Roles
- **Role Assignment** - Self-assignable roles
- **Emoji Selection** - Reaction-based system
- **Multi-role Support** - Multiple role options

</td>
<td width="50%" valign="top">

### Leveling & XP System
- **XP Tracking** - Automatic message-based XP
- **Level Roles** - Auto-assign roles by level
- **Custom Configuration** - Personalize leveling

### Giveaways & Events
- **Multiple Winners** - Support multi-winner giveaways
- **Auto Picking** - Automatic winner selection
- **Reroll System** - Pick new winners if needed

### Birthday System
- **Birthday Tracking** - Never miss a birthday
- **Auto Announcements** - Celebrate automatically
- **Timezone Support** - Accurate worldwide tracking

### Utility Tools
- **Report System** - Report issues to staff
- **Todo Lists** - Personal task management
- **First Message** - Jump to channel's first message

### Welcome System
- **Welcome Messages** - Greet new members
- **Auto Roles** - Assign roles on join
- **Custom Embeds** - Personalized messages

</td>
</tr>
</table>

<a name="quick-setup"></a>
## Quick Setup (Recommended for non-coders)

### Video Tutorial
For a detailed step-by-step setup guide, watch our comprehensive video tutorial:
[**TitanBot Setup Tutorial**](https://www.youtube.com/@TouchDisc)

## Docker Deployment (Recommended)

TitanBot is fully containerized for easy deployment.

1. **Clone the repository:**
```bash
git clone https://github.com/codebymitch/TitanBot.git
cd TitanBot
```

2. **Configure environment variables:**
Create a `.env` file from `.env.example` and fill in your bot details and PostgreSQL credentials.

3. **Start the containers:**
```bash
docker-compose up -d
```

This will start both the bot and a persistent PostgreSQL database.

### Using GitHub Container Registry

The bot is automatically published to GitHub Container Registry on every push to main.

```bash
docker pull ghcr.io/codebymitch/titanbot:main
```

<a name="manual-installation-steps"></a>
## Manual Installation Steps

### Prerequisites
- Node.js 18.0.0 or higher
- PostgreSQL server (recommended) or memory storage fallback
- Discord bot application with proper intents

1. **Clone the Repository**
```bash
git clone https://github.com/codebymitch/TitanBot.git
cd TitanBot
```

2. **Install Dependencies**
```bash
npm install
```

3. **Configure Environment Variables**
```bash
cp .env.example .env
```
Edit `.env` with your configuration (only the following variables require configuration, leave remaining variables as default):
```env
# Discord Bot Configuration
DISCORD_TOKEN=your_discord_bot_token_here
CLIENT_ID=your_discord_client_id_here
GUILD_ID=your_discord_guild_id_here

# PostgreSQL Configuration (Primary Database)
POSTGRES_URL=postgresql://postgres:yourpassword@localhost:5432/titanbot
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=titanbot
POSTGRES_USER=postgres
POSTGRES_PASSWORD=yourpassword
```

Production note:
- `NODE_ENV=production`
- `LOG_LEVEL=warn` for a clean production console (critical issues + startup status)
- `LOG_LEVEL=info` if you want more detailed operational logs
- If your chosen `PORT` is already used, TitanBot automatically tries the next port(s)

Environment options reference:
- `NODE_ENV`: `development`, `production`, `test` (any non-`production` value is treated as non-production)
- `LOG_LEVEL`: `error`, `warn`, `info`, `http`, `verbose`, `debug`, `silly`
- Accepted aliases for `LOG_LEVEL` in this bot: `warns`, `warning`, `warnings` → `warn`

Recommended production `.env` (easy mode + default mode):
```env
NODE_ENV=production
LOG_LEVEL=warn
WEB_HOST=0.0.0.0
PORT=3000
PORT_RETRY_ATTEMPTS=5
```
This gives clear startup/online status messages while keeping logs simple for non-technical operators.
If port `3000` is busy, the bot tries the next available ports automatically (up to `PORT_RETRY_ATTEMPTS`).

4. **Setup PostgreSQL Database** (Optional but recommended)
```bash
# Create database and user
createdb titanbot
createuser titanbot
psql -c "ALTER USER titanbot PASSWORD 'yourpassword';"
psql -c "GRANT ALL PRIVILEGES ON DATABASE titanbot TO titanbot;"
```

5. **Test Database Connection**
```bash
npm run test-postgres
```

6. **Start the Bot**
```bash
npm start
```
<a name="bot-intents"></a>

## Required Bot Intents
TitanBot requires the following Discord intents:
- **Guilds**
- **Guild Messages**
- **Message Content**
- **Guild Members**
- **Guild Message Reactions**
- **Guild Voice States**
- **Direct Messages**
- **Bot**
- **Applications.commands**

### Required Permissions
- **View Channels**
- **Send Messages**
- **Embed Links**
- **Attach Files**
- **Read Message History**
- **Manage Messages**
- **Manage Channels**
- **Manage Roles**
- **Kick Members**
- **Manage Messages**
- **Ban Members**
- **Moderate Members**
- **Connect**

<a name="contributing"></a>
## Contributing

We welcome contributions to TitanBot! Here's how you can help:

1. **Fork the repository**
2. **Create a feature branch**
3. **Make your changes**
4. **Test thoroughly**
5. **Submit a pull request**

### Development Guidelines
- Follow existing code style
- Add proper error handling
- Include documentation for new features
- Test with PostgreSQL and memory storage
Assisted with the Help of TitanBot Materials.

## License

TitanBot is released under the MIT License. See [LICENSE](LICENSE) for details.
JackBot is released under the MIT License. See [LICENSE](LICENSE) for details.

## Thank You

Thank you for choosing TitanBot for your Discord server! We're constantly working to improve and add new features based on community feedback.
Thank you for choosing JackBot for your Discord server! We're constantly working to improve and add new features based on community feedback.

*Last updated: May 2026*
68 changes: 68 additions & 0 deletions src/commands/Core/testmodal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { SlashCommandBuilder, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } from 'discord.js';
import { InteractionHelper } from '../../utils/interactionHelper.js';
import { logger } from '../../utils/logger.js';
import fs from 'fs/promises';
import path from 'path';

async function getRecentLogs(maxChars = 3500) {
try {
const logsDir = path.resolve(new URL('../../logs', import.meta.url).pathname);
const files = await fs.readdir(logsDir).catch(() => []);
const combinedFiles = files.filter(f => f.startsWith('combined-') && f.endsWith('.log'));
if (combinedFiles.length === 0) return '';

// pick newest file by mtime
let newest = null;
for (const f of combinedFiles) {
const full = path.join(logsDir, f);
const stat = await fs.stat(full).catch(() => null);
if (!stat) continue;
if (!newest || stat.mtimeMs > newest.mtimeMs) newest = { file: full, mtimeMs: stat.mtimeMs };
}
if (!newest) return '';

const content = await fs.readFile(newest.file, 'utf8').catch(() => '');
if (!content) return '';
// return last maxChars characters
return content.slice(-maxChars);
} catch (e) {
logger.warn('Failed to read recent logs:', e.message || e);
return '';
}
}

export default {
data: new SlashCommandBuilder()
.setName('testmodal')
.setDescription('Open the Debug Test modal (developer logs)'),

async execute(interaction) {
const ready = await InteractionHelper.ensureReady(interaction, { flags: 0 });
if (!ready) return;

try {
const modal = new ModalBuilder()
.setCustomId('test_debug_modal')
.setTitle('Debug Test');

const logs = await getRecentLogs(3500);

const input = new TextInputBuilder()
.setCustomId('dev_logs')
.setLabel('Dev Logs (read-only)')
.setStyle(TextInputStyle.Paragraph)
.setRequired(false)
.setMaxLength(4000)
.setPlaceholder('No logs available')
.setValue(logs || 'No recent logs available');

const row = new ActionRowBuilder().addComponents(input);
modal.addComponents(row);

await interaction.showModal(modal);
} catch (error) {
logger.error('Failed to show TestModal:', error);
await InteractionHelper.safeReply(interaction, { content: 'Could not open debug modal.', flags: 1 << 6 });
}
},
};
Loading