Skip to content

oreonproject/Luna

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Luna Discord Bot

A playful Discord.js bot with custom commands, automated responses, and Reddit integration for jokes and memes.

Features

  • Custom Commands: Admins can create custom text commands and embed commands
  • Auto Responses: Set up automated responses to specific trigger words
  • Reddit Integration: Fetch SFW jokes and memes from various subreddits
  • Server Information: Get detailed information about channels, servers, and member counts
  • Both Prefix and Slash Commands: Supports both ~ prefix and / slash commands
  • SQLite Database: Persistent storage for custom commands and responses
  • Admin-Only Commands: Secure command creation restricted to administrators

Commands

General Commands

  • ~help or /help - Display all available commands
  • ~joke or /joke - Get a random Linux/tech joke from Reddit
  • ~meme or /meme - Get a random SFW meme from Reddit
  • ~channelinfo or /channelinfo - Get current channel information
  • ~serverinfo or /serverinfo - Get server information
  • ~membercount or /membercount - Get detailed member count

Admin Commands (Administrator permission required)

  • ~createcustom or /createcustom - Create a custom text command
  • ~createresponse or /createresponse - Create an automated response
  • ~codecustom or /codecustom - Create a custom command with embed

Setup

Prerequisites

  • Node.js 16.0.0 or higher
  • npm or yarn
  • Discord Application with Bot Token

Installation

  1. Clone or download this repository

  2. Install dependencies:

    npm install
  3. Create a .env file in the root directory with the following content:

    DISCORD_TOKEN=your_bot_token_here
    CLIENT_ID=your_bot_client_id_here
    PREFIX=~
  4. Replace the values with your actual Discord bot credentials:

    • DISCORD_TOKEN: Your bot's token from Discord Developer Portal
    • CLIENT_ID: Your bot's application ID from Discord Developer Portal
    • PREFIX: Command prefix (default is ~)

Getting Discord Bot Credentials

  1. Go to Discord Developer Portal
  2. Click "New Application" and give it a name
  3. Go to the "Bot" section and click "Add Bot"
  4. Copy the bot token for DISCORD_TOKEN
  5. Go to "General Information" and copy the Application ID for CLIENT_ID
  6. In the "Bot" section, enable the following intents:
    • Server Members Intent
    • Message Content Intent

Bot Permissions

Your bot needs the following permissions:

  • Send Messages
  • Use Slash Commands
  • Embed Links
  • Read Message History
  • View Channels
  • Add Reactions

Running the Bot

Development mode (with auto-restart):

npm run dev

Production mode:

npm start

Usage Examples

Creating Custom Commands

~createcustom welcome Welcome to our awesome server!
/createcustom name:rules response:Please read our rules in #rules channel

Creating Auto Responses

~createresponse hello Hey there! How are you doing?
/createresponse trigger:goodbye response:See you later! Take care!

Creating Custom Embed Commands

~codecustom info "Server Info" "This is our gaming community!" #00ff00 "Join us!"
/codecustom name:announcement title:Important description:Check out our latest update! color:#ff0000

Database

The bot uses SQLite for persistent storage. The database file (luna.db) will be created automatically in the root directory on first run.

Database Schema

  • custom_commands: Stores custom commands (text and embed types)
  • auto_responses: Stores automated response triggers and messages

Reddit Integration

The bot fetches content from these subreddits:

  • Jokes: linuxmemes, ProgrammerHumor, linuxmasterrace, techhumor
  • Memes: memes, dankmemes, wholesomememes, me_irl, ProgrammerHumor

All content is filtered to be SFW (Safe For Work).

File Structure

luna-discord-bot/
├── src/
│   ├── commands/           # Command files
│   │   ├── help.js
│   │   ├── joke.js
│   │   ├── meme.js
│   │   ├── channelinfo.js
│   │   ├── serverinfo.js
│   │   ├── membercount.js
│   │   ├── createcustom.js
│   │   ├── createresponse.js
│   │   └── codecustom.js
│   ├── database.js         # Database handler
│   └── index.js           # Main bot file
├── package.json
├── .env                   # Environment variables (create this)
└── README.md

Contributing

Feel free to submit issues and pull requests to improve the bot!

License

This project is licensed under the MIT License.

About

Discord utility bot

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors