Skip to content
/ pegasus Public

Official Discord bot of Hinkos Discord. Written in TypeScript with Web-UI and German support.

License

Notifications You must be signed in to change notification settings

cptcr/pegasus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

93 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Pegasus Discord Bot

Discord.js TypeScript PostgreSQL Node.js License

๐Ÿ† A Production-Ready, Feature-Rich Discord Bot Built with TypeScript

Support Server โ€ข Developer โ€ข Features โ€ข Installation โ€ข Commands

SPONSORS

VaultScope

https://vaultscope.dev

๐Ÿ“‹ Table of Contents

โœจ Features

๐Ÿ›ก๏ธ Advanced Moderation System

  • Comprehensive Warning System with automation rules and thresholds
  • Multi-action Moderation - Ban, kick, timeout with reason tracking
  • Audit Logging - Complete action history with user tracking
  • Permission Hierarchy - Role-based command access control
  • Blacklist System - Developer-only user management

๐Ÿ’ฐ Full Economy System

  • Virtual Currency with balance tracking and transactions
  • 5 Gambling Games:
    • ๐ŸŽฒ Dice - Roll against the house
    • ๐Ÿช™ Coinflip - 50/50 chance game
    • ๐ŸŽฐ Slots - Classic slot machine
    • โ™ ๏ธ Blackjack - Full blackjack implementation
    • ๐ŸŽฏ Roulette - Multiple betting options
  • Shop System - Buy/sell items with inventory management
  • Work & Rob - Earn money with cooldowns and protection items
  • Daily Rewards - Streak bonuses for consecutive claims

๐ŸŽ‰ Advanced Giveaway System

  • Multiple Entry Methods - Bonus entries for roles/boosters
  • Requirements System - Role, level, or time-based requirements
  • Live Timer Updates - Real-time countdown display
  • Automatic Winner Selection - Fair, weighted random selection
  • Reroll Capability - Change winners after giveaway ends

๐ŸŽŸ๏ธ Professional Ticket System

  • Custom Panels - Design support panels with embeds
  • Category Management - Organize tickets by type
  • Ticket Actions:
    • Claim - Assign ticket to staff
    • Close - Close with optional reason
    • Lock - Prevent user messages
    • Freeze - Prevent all messages
  • Transcript Generation - Save ticket history
  • Statistics Tracking - Monitor support metrics

๐Ÿ“ˆ XP & Leveling System

  • Voice & Text XP - Earn XP through activity
  • Role Rewards - Automatic role assignment at levels
  • Custom Rank Cards - Personalized rank displays
  • Leaderboards - Server-wide rankings
  • Booster Bonuses - Extra XP for server boosters
  • Channel Multipliers - Configure XP rates per channel

๐ŸŒ Multi-Language Support

  • 4 Languages: English, German, Spanish, French
  • Per-User Language - Individual language preferences
  • Localized Commands - Command descriptions in all languages
  • Dynamic Translations - All bot responses translated

๐Ÿ”ง Server Configuration

  • Welcome/Goodbye System - Custom messages with embeds
  • Auto-Role Assignment - Automatic roles for new members
  • Language Settings - Server-wide language preference
  • XP Configuration - Customize leveling system
  • Economy Settings - Adjust currency and rewards

๐Ÿ”ง Tech Stack

Technology Purpose
TypeScript 5.0 Type-safe development with strict mode
Discord.js v14 Latest Discord API features
PostgreSQL 16 Robust relational database
Drizzle ORM Type-safe database queries
Zod Runtime validation and type safety
i18next Internationalization framework
Winston Advanced logging system
Node.js 18+ Modern JavaScript runtime

๐Ÿ“ฆ Prerequisites

  • Node.js: v18.0.0 or higher
  • PostgreSQL: v14 or higher
  • npm: v9.0.0 or higher
  • Discord Application: Create here

Required Bot Permissions

- View Channels
- Send Messages
- Embed Links
- Attach Files
- Manage Messages
- Manage Roles
- Manage Channels
- Use External Emojis
- Add Reactions
- Read Message History
- Connect (for voice XP)
- Move Members
- Moderate Members

๐Ÿš€ Installation

1. Clone Repository

git clone https://github.com/cptcr/pegasus.git
cd pegasus

2. Install Dependencies

npm install

3. Database Setup

Create a PostgreSQL database:

CREATE DATABASE pegasus;

4. Environment Configuration

Create .env file in root directory:

# Required Configuration
DISCORD_TOKEN=your_bot_token_here
DISCORD_CLIENT_ID=your_application_id_here
DATABASE_URL=postgresql://username:password@localhost:5432/pegasus
DEVELOPER_IDS=["your_discord_id_here"]
SUPPORT_SERVER_INVITE=https://discord.gg/your_invite

# Optional Configuration
NODE_ENV=development
DEFAULT_LANGUAGE=en
LOG_LEVEL=info

# Security (Generate a 32-character key)
ENCRYPTION_KEY=your_32_character_encryption_key_here

# Optional Services
REDIS_URL=redis://localhost:6379
STEAM_API_KEY=your_steam_api_key

5. Build Project

npm run build

6. Start Bot

# Production
npm start

# Development (with auto-reload)
npm run dev

โš™๏ธ Configuration

First-Time Setup

After inviting the bot to your server:

  1. Set Server Language

    /config lang
    
  2. Configure XP System

    /config xp
    
  3. Setup Economy

    /config eco
    
  4. Configure Welcome Messages

    /config welcome
    
  5. Setup Auto-Roles

    /config autorole
    

Database Tables (Auto-Created)

The bot automatically creates all required tables on first startup:

  • users - User profiles and preferences
  • guilds - Server configurations
  • guild_settings - Detailed server settings
  • members - Per-server user data
  • warnings - Warning records
  • warning_automations - Automated moderation rules
  • economy_balances - User balances
  • economy_transactions - Transaction history
  • economy_shop_items - Shop inventory
  • tickets - Support tickets
  • ticket_panels - Ticket panel configurations
  • giveaways - Giveaway data
  • giveaway_entries - User entries
  • user_xp - XP and level data
  • xp_rewards - Level role rewards
  • audit_logs - Complete action history

๐Ÿ“ Commands

๐Ÿ›ก๏ธ Moderation Commands

Command Description Permission
/warn create Issue warning with title, description, level Moderate Members
/warn edit Edit existing warning via modal Moderate Members
/warn lookup View specific warning by ID Moderate Members
/warn view View all warnings for a user Moderate Members
/warn automation create Setup automated actions Administrator
/warn automation view List all automations Administrator
/warn automation delete Remove automation Administrator
/moderation ban Ban user with optional reason Ban Members
/moderation kick Kick user with optional reason Kick Members
/moderation timeout Timeout user for duration Moderate Members
/moderation mute Apply the server mute role (optional duration) Moderate Members
/moderation unmute Remove the mute role from a user Moderate Members
/moderation unban <user_id> Unban a user by ID Ban Members
/moderation purge <amount> Bulk delete recent messages Manage Messages
/moderation lock [channel] Lock a text channel for @everyone Manage Channels
/moderation unlock [channel] Unlock a previously locked channel Manage Channels
/moderation slowmode <seconds> Set channel slowmode (0 disables) Manage Channels
/moderation modlog [user] Display recent moderation cases Moderate Members
/moderation case view <id> View a specific moderation case Moderate Members
/moderation case delete <id> Delete a moderation case Manage Guild
/moderation reset-xp Reset user's XP to 0 Manage Guild

๐Ÿ’ฐ Economy Commands

Command Description Cooldown
/balance [user] Check balance None
/daily Claim daily reward (100-500) 24 hours
/work Work for money (50-200) 1 hour
/rob <user> Attempt to rob another user 24 hours
/shop view Browse available items None
/shop buy <item> Purchase an item None
/shop inventory View your items None
/gamble dice <amount> Roll dice (1-6 vs dealer) None
/gamble coinflip <amount> <side> Flip coin (heads/tails) None
/gamble slots <amount> Play slot machine None
/gamble blackjack <amount> Play blackjack None
/gamble roulette <amount> <bet> Play roulette None

๐ŸŽ‰ Giveaway Commands

Command Description Permission
/gw start Advanced giveaway with modal Manage Guild
/gw simple Quick giveaway setup Manage Guild
/gw end <id> Manually end giveaway Manage Guild
/gw reroll <id> Select new winners Manage Guild
/gw configure <id> Edit active giveaway Manage Guild

๐ŸŽŸ๏ธ Ticket Commands

Command Description Permission
/ticket panel create Design ticket panel Manage Guild
/ticket panel load <id> Send panel to channel Manage Guild
/ticket panel delete <id> Remove panel Manage Guild
/ticket panel list View all panels Manage Guild
/ticket claim Claim ticket Support Role
/ticket close [reason] Close ticket Support Role
/ticket stats View statistics Manage Guild

๐Ÿ“ˆ XP Commands

Command Description
/xp rank [user] View rank card
/xp leaderboard Top 10 users
/xp configuration View XP settings
/xp card Customize rank card

โš™๏ธ Configuration Commands

Command Description Permission
/config xp XP system settings Manage Guild
/config eco Economy settings Manage Guild
/config lang Server language Manage Guild
/config welcome Welcome messages Manage Guild
/config goodbye Goodbye messages Manage Guild
/config autorole Auto-role setup Manage Guild

๐Ÿ”ง Utility Commands

Command Description
/utils help [command] Dynamic help menu
/utils avatar [user] Display avatar
/utils banner [user] Display banner
/utils steam <profile> Steam profile info
/utils userinfo [user] User details
/utils whois <user> Detailed lookup
/utils roleinfo <role> Role information
/utils serverinfo Server statistics
/utils support Support server link
/utils stats Bot statistics
/ping Check latency

๐ŸŽฎ Fun Commands

Command Description
/fun meme Random meme
/fun fact Fun fact
/fun joke Random joke
/fun quote Inspirational quote
/fun dadjoke Dad joke

๐ŸŒ Language Commands

Command Description
/language available List languages
/language current Your language
/language set <lang> Change language

๐Ÿ‘‘ Admin Commands

Command Description Permission
/blacklist user <user> Blacklist user Developer Only
/blacklist view View blacklist Developer Only
/blacklist remove <user> Unblacklist Developer Only

๐Ÿ”’ Security Features

Input Validation

  • Zod Schemas - Runtime validation for all inputs
  • SQL Injection Prevention - Parameterized queries
  • XSS Protection - Input sanitization
  • Rate Limiting - Per-user and global limits

Permission System

  • Hierarchical Permissions - Role-based access
  • Developer Override - Emergency access
  • Audit Logging - Track all actions
  • Blacklist System - Block malicious users

Data Protection

  • Encryption - Sensitive data encryption
  • Secure Tokens - Environment variable storage
  • HTTPS Only - Secure API communications
  • Privacy Compliance - User data protection

๐ŸŒ Internationalization

Supported Languages

  • ๐Ÿ‡ฌ๐Ÿ‡ง English (en) - Default
  • ๐Ÿ‡ฉ๐Ÿ‡ช German (de) - Deutsch
  • ๐Ÿ‡ช๐Ÿ‡ธ Spanish (es) - Espaรฑol
  • ๐Ÿ‡ซ๐Ÿ‡ท French (fr) - Franรงais

Translation Coverage

  • โœ… All command descriptions
  • โœ… All bot responses
  • โœ… Error messages
  • โœ… Embed content
  • โœ… Button/Modal text

๐Ÿšข Deployment

Using Docker

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY . .
RUN npm run build
CMD ["npm", "start"]

Using PM2

npm install -g pm2
pm2 start dist/index.js --name pegasus
pm2 save
pm2 startup

Hosting Recommendations

  • VPS: DigitalOcean, Linode, Vultr
  • Cloud: AWS EC2, Google Cloud, Azure
  • Managed: Railway, Heroku, Render

๐Ÿค Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

Code Standards

  • TypeScript strict mode enabled
  • No production comments
  • Comprehensive error handling
  • Unit tests for new features

๐Ÿ“„ License

This project is licensed under the MIT License - see LICENSE file.

๐Ÿ’ฌ Support

๐Ÿ™ Acknowledgments

  • Discord.js team for the excellent library
  • PostgreSQL team for the robust database
  • All contributors and community members
  • Open source projects that made this possible

โญ Star this repository if you find it helpful!

Made with โค๏ธ by cptcr

Stars Forks

About

Official Discord bot of Hinkos Discord. Written in TypeScript with Web-UI and German support.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •