Jan 2025 Update
Team Search Improvements: Added required game selection before team name input Added VR Battles image as the main embed image Removed buttons for cleaner display Added sorting by game mode (Squads > Duo > Solo) Made team display more compact with icons and shortened stats Added SQL injection protection and input sanitization User Search Improvements: Made game selection required before username input Added VR Battles image as the main embed image Added better user status messages: played Security Enhancements: Added input validation and sanitization at multiple levels Limited input lengths to prevent buffer overflow Added proper error handling and logging Implemented safe API calls with timeouts and validation Added protection against SQL injection Code Organization: Improved error messages for better user feedback Added comprehensive logging for monitoring Made responses visible to everyone in the channel Cleaned up code structure and removed redundant parts Development Environment: Set up proper development configuration Added environment variable management Improved command deployment process
This commit is contained in:
88
README.md
Normal file
88
README.md
Normal file
@@ -0,0 +1,88 @@
|
||||
# VRBattles Discord Bot (Development)
|
||||
|
||||
This is the development version of the VRBattles Discord Bot. It connects to the VRBattles API and provides various commands for users to interact with VRBattles data through Discord.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd discord-bot
|
||||
```
|
||||
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
3. Create a `.env` file based on `.env.example`:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
4. Set up your development environment:
|
||||
|
||||
- Create a new Discord Application at https://discord.com/developers/applications
|
||||
- Create a new bot for your application
|
||||
- Get your bot token and client ID
|
||||
- Create a new Supabase project at https://supabase.com
|
||||
- Get your Supabase URL and anon key
|
||||
|
||||
5. Update your `.env` file with the development credentials:
|
||||
```env
|
||||
DISCORD_TOKEN=your_dev_bot_token
|
||||
CLIENT_ID=your_dev_client_id
|
||||
SUPABASE_URL=your_dev_supabase_url
|
||||
SUPABASE_KEY=your_dev_supabase_key
|
||||
NODE_ENV=development
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Start the bot in development mode:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Deploy slash commands to your development Discord server:
|
||||
```bash
|
||||
npm run deploy-commands:dev
|
||||
```
|
||||
|
||||
## Available Commands
|
||||
|
||||
- `/ping` - Test bot connectivity
|
||||
- `/finduser` - Find a user by username
|
||||
- `/matchhistory` - View match history
|
||||
- `/findteam` - Find a team by name
|
||||
- `/subscribe` - Subscribe to game notifications (Admin only)
|
||||
- `/unsubscribe` - Unsubscribe from game notifications (Admin only)
|
||||
- `/register_server` - Register Discord server with BattleBot (Admin only)
|
||||
- `/list_subscriptions` - List all game subscriptions (Admin only)
|
||||
|
||||
## API Integration
|
||||
|
||||
The bot connects to the following APIs:
|
||||
- VRBattles API (`https://www.vrbattles.gg/api/`)
|
||||
- Discord API (via discord.js)
|
||||
- Supabase Database
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Create a new branch for your feature:
|
||||
```bash
|
||||
git checkout -b feature/your-feature-name
|
||||
```
|
||||
|
||||
2. Make your changes and commit them:
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "Description of your changes"
|
||||
```
|
||||
|
||||
3. Push to your branch:
|
||||
```bash
|
||||
git push origin feature/your-feature-name
|
||||
```
|
||||
|
||||
4. Create a Pull Request to merge into the dev branch
|
||||
Reference in New Issue
Block a user