Skip to content
Open
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
455 changes: 455 additions & 0 deletions CODE_REVIEW.md

Large diffs are not rendered by default.

261 changes: 251 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,266 @@
# iceC Discord Bot
A discord bot template im working on as I explore the mystical lands of discord.py

I will be adding stuff bit by bit, day by day.
A feature-rich Discord bot built with Python, featuring music playback, cryptocurrency trading alerts, and moderation tools.

## 🎯 Features

### 🎵 Music Bot Features
- **YouTube Music Playback** - Play songs from YouTube in voice channels
- **Spotify Playlist Support** - Play entire Spotify playlists
- **Queue Management** - Add, remove, shuffle, and manage song queues
- **Playback Controls** - Play, pause, resume, skip, seek, and volume control
- **Loop Functions** - Loop single songs or entire queues
- **Now Playing** - View current track information and requester

Download the zip file and upload it on [VirusTotal](https://www.virustotal.com) if you are doubtful.
### 📊 Trading Features (Binance Integration)
- **Position Alerts** - Automated alerts for futures positions
- **Margin Ratio Monitoring** - Get notified when margin ratios exceed thresholds
- **Favorite List** - Track favorite cryptocurrencies for SPOT and FUTURES
- **Account Balance** - View futures account balance

### 🛡️ Moderation Features
- **User Management** - Kick, ban, unban, mute, and unmute users
- **Role Management** - Assign roles to users
- **Permission-based Commands** - Role-based access control

If you dont know how to download the repository as a zip file press the green button as below.
## 📋 Prerequisites

![image](https://user-images.githubusercontent.com/35976946/218763761-e3baa46c-d23b-4b4a-8bdb-d971bfababa0.png)
- Python 3.8 or higher
- Discord Bot Token ([Get one here](https://discord.com/developers/applications))
- Binance API Key and Secret (for trading features - optional)
- Spotify Client ID and Secret (for Spotify features - optional)
- A Lavalink server (for music features)

After pressing the button press on 'Download ZIP'. The very last button.
![image](https://user-images.githubusercontent.com/35976946/218764456-f9b62665-01c4-4007-8608-0d13a2816f61.png)
- Link Recently changed to - [ArliT1-F](https://github.com/ArliT1-F/iceC)
## 🚀 Installation

### 1. Clone the Repository

### Manual Installation
```bash
git clone https://github.com/ArliT1-F/iceC.git
cd iceC
```

After the zip is downloaded just drag it in the virus total web page and wait for it to be scanned.
### 2. Install Dependencies

```bash
pip install -r requirements.txt
```

### 3. Environment Setup

Create a `.env` file in the root directory with the following variables:

```env
# Discord Bot Configuration
DISCORD_TOKEN=your_discord_bot_token_here
CHANNEL_ID=your_channel_id_here

# Binance API (Optional - for trading features)
BINANCE_API_KEY=your_binance_api_key
BINANCE_API_SECRET=your_binance_api_secret

# Spotify API (Optional - for Spotify playlist support)
spotify_id=your_spotify_client_id
spotify_secret=your_spotify_client_secret

# Lavalink Server (Required for music features)
LAVALINK_HOST=node1.kartadharta.xyz
LAVALINK_PORT=443
LAVALINK_PASSWORD=your_lavalink_password_here
```

### 4. Configuration Files

Ensure `FAV_LIST.json` exists with the following structure:

```json
{
"FUTURES": {},
"SPOT": {}
}
```

## 📖 Usage

### Starting the Bot

```bash
python main.py
```

The bot will connect to Discord and be ready to use once you see the "We have logged in as..." message.

### Command Prefix

The bot uses `!` as the default command prefix.

## 🎮 Commands

### Music Commands

| Command | Aliases | Description | Example |
|---------|---------|-------------|---------|
| `!play` | `!p` | Play a song from YouTube | `!play never gonna give you up` |
| `!splay` | `!sp` | Play a Spotify playlist | `!sp https://open.spotify.com/playlist/...` |
| `!pause` | `!stop` | Pause the current track | `!pause` |
| `!resume` | - | Resume the paused track | `!resume` |
| `!skip` | `!next`, `!s` | Skip to the next track | `!skip` |
| `!nowplaying` | `!np` | Show current track information | `!np` |
| `!queue` | `!q`, `!track` | Display the current queue | `!queue` |
| `!loop` | - | Loop/unloop the current song | `!loop` |
| `!loopqueue` | `!lq` | Enable/disable queue looping | `!lq start` |
| `!volume` | `!vol` | Set the player volume (0-100) | `!vol 50` |
| `!seek` | - | Seek to position in track (seconds) | `!seek 120` |
| `!shuffle` | `!mix` | Shuffle the queue | `!shuffle` |
| `!del` | `!remove`, `!drop` | Delete a track from queue | `!del 3` |
| `!skipto` | `!goto` | Skip to a specific track in queue | `!skipto 5` |
| `!move` | `!set` | Move a track to a different position | `!move 2 5` |
| `!clear` | - | Clear the entire queue | `!clear` |
| `!disconnect` | `!dc`, `!leave` | Disconnect from voice channel | `!dc` |
| `!save` | `!dm` | DM current song or queue | `!save` or `!save queue` |

### Trading Commands

| Command | Description | Example |
|---------|-------------|---------|
| `!add_fav` | Add a symbol to favorites | `!add_fav FUT BTCUSDT` |
| `!favs` | List favorite cryptocurrencies | `!favs` |
| `!fubln` | Show futures account balance | `!fubln` |

### Moderation Commands

| Command | Description | Permissions Required |
|---------|-------------|---------------------|
| `!kick` | Kick a user from the server | Administrator, Kick Members |
| `!ban` | Ban a user from the server | Administrator, Ban Members |
| `!unban` | Unban a user | Administrator, Ban Members |
| `!mute` | Mute a user | Manage Messages |
| `!unmute` | Unmute a user | Manage Messages |
| `!setrole` | Assign a role to a user | Administrator |

### Utility Commands

| Command | Aliases | Description |
|---------|---------|-------------|
| `!ping` | - | Check bot latency |
| `!info` | `!i` | Show bot information (Owner only) |

## 🔧 Configuration

### Lavalink Server

The bot connects to a Lavalink server for music playback. By default, it uses:
- Host: `node1.kartadharta.xyz`
- Port: `443`
- Protocol: HTTPS

You can modify the connection in the `node_connect()` function in `main.py`.
Comment on lines +152 to +157

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Lavalink configuration documentation is outdated.

The documentation states "You can modify the connection in the node_connect() function in main.py", but the actual implementation (main.py lines 53-65) now reads from environment variables rather than hardcoded values. This guidance is misleading.

Apply this diff:

-The bot connects to a Lavalink server for music playback. By default, it uses:
-- Host: `node1.kartadharta.xyz`
-- Port: `443`
-- Protocol: HTTPS
-
-You can modify the connection in the `node_connect()` function in `main.py`.
+The bot connects to a Lavalink server for music playback. Configure the connection via environment variables in `.env`:
+- `LAVALINK_HOST` (default: `node1.kartadharta.xyz`)
+- `LAVALINK_PORT` (default: `443`)
+- `LAVALINK_PASSWORD` (required)
+- Protocol: HTTPS is enabled by default
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The bot connects to a Lavalink server for music playback. By default, it uses:
- Host: `node1.kartadharta.xyz`
- Port: `443`
- Protocol: HTTPS
You can modify the connection in the `node_connect()` function in `main.py`.
The bot connects to a Lavalink server for music playback. Configure the connection via environment variables in `.env`:
- `LAVALINK_HOST` (default: `node1.kartadharta.xyz`)
- `LAVALINK_PORT` (default: `443`)
- `LAVALINK_PASSWORD` (required)
- Protocol: HTTPS is enabled by default
🤖 Prompt for AI Agents
In README.md around lines 152 to 157, the docs incorrectly tell users to modify
a non-existent node_connect() function; update the text to state that Lavalink
connection settings are read from environment variables (referencing main.py
lines 53–65) and list the relevant env vars (e.g., LAVALINK_HOST, LAVALINK_PORT,
LAVALINK_PROTOCOL or whatever exact names main.py uses), and replace the
sentence about node_connect() with guidance on setting those environment
variables or where to find defaults in the code.


### Required Intents

Ensure your bot has the following intents enabled in the Discord Developer Portal:
- ✅ Server Members Intent
- ✅ Message Content Intent
- ✅ Voice States Intent
- ✅ Emojis and Stickers Intent

## 📁 Project Structure

```
iceC/
├── main.py # Main bot file
├── requirements.txt # Python dependencies
├── FAV_LIST.json # Trading favorites list
├── .env # Environment variables (create this)
├── discord.log # Bot logs (created automatically)
├── LICENSE # GNU GPL v3 License
└── README.md # This file
```
Comment on lines +169 to +178

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Project structure is incomplete and doesn't reflect the cog-based architecture.

The documented structure omits the cogs/ directory and its modules (music.py, trading.py, moderation.py, utility.py, init.py), which are central to the PR's refactoring.

Apply this diff:

iceC/
├── main.py # Main bot file
+├── cogs/ # Bot command modules
+│ ├── init.py
+│ ├── music.py # Music commands
+│ ├── trading.py # Trading/Binance commands
+│ ├── moderation.py # Moderation commands
+│ └── utility.py # Utility commands
├── requirements.txt # Python dependencies
├── FAV_LIST.json # Trading favorites list
├── .env # Environment variables (create this)
├── discord.log # Bot logs (created automatically)
├── LICENSE # GNU GPL v3 License
└── README.md # This file

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
iceC/
├── main.py # Main bot file
├── requirements.txt # Python dependencies
├── FAV_LIST.json # Trading favorites list
├── .env # Environment variables (create this)
├── discord.log # Bot logs (created automatically)
├── LICENSE # GNU GPL v3 License
└── README.md # This file
```
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

169-169: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In README.md around lines 169 to 178, the project tree is missing the refactored
cog-based architecture; update the listed structure to include a cogs/ directory
and its files (add the cogs/ entry with __init__.py, music.py, trading.py,
moderation.py, utility.py) exactly as shown in the provided diff so the README
reflects the PR's refactor.


## 🐛 Troubleshooting

### Bot Commands Not Working
- Ensure you're using `commands.Bot()` (already fixed in code)
- Check that the bot has proper permissions in your server
- Verify the command prefix is correct (`!` by default)

### Music Not Playing
- Ensure you have a Lavalink server running and accessible
- Check that the bot has permission to join voice channels
- Verify the node connection in `node_connect()`

### Trading Features Not Working
- Ensure Binance API keys are correctly set in `.env`
- Check that API keys have necessary permissions (read-only recommended)
- Verify `FAV_LIST.json` exists and has correct structure

### Permission Errors
- Ensure the bot has necessary roles/permissions:
- Send Messages
- Connect to Voice Channels
- Speak in Voice Channels
- Manage Roles (for moderation commands)

## 🔐 Security Notes

- **Never commit your `.env` file** - It contains sensitive tokens
- Use read-only API keys when possible
- Regularly rotate your Discord bot token
- Keep dependencies updated for security patches

## 📝 Environment Variables

All required environment variables:

| Variable | Required | Description |
|----------|----------|-------------|
| `DISCORD_TOKEN` | ✅ Yes | Your Discord bot token |
| `CHANNEL_ID` | ✅ Yes | Channel ID for alerts |
| `LAVALINK_PASSWORD` | ✅ Yes* | Password for Lavalink server (required for music) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Environment variable documentation inconsistency: LAVALINK_PASSWORD is actually required for music.

Line 219 states LAVALINK_PASSWORD is "✅ Yes*" with a note "(required for music)", but main.py (lines 57-59) only logs a warning and returns early if it's missing—it doesn't crash the bot. However, the asterisk notation "Yes*" is ambiguous. Clarify whether it's required for the bot to start or only required for music features to work.

Apply this diff to clarify:

-| `LAVALINK_PASSWORD` | ✅ Yes* | Password for Lavalink server (required for music) |
+| `LAVALINK_PASSWORD` | ⚠️ Conditional | Required for music features; bot starts without it but music won't work |
🤖 Prompt for AI Agents
In README.md around line 219, the LAVALINK_PASSWORD entry is ambiguous; update
the table entry and note to state that LAVALINK_PASSWORD is optional for the bot
to start but required to enable music features (reflecting main.py behavior
where missing password triggers a warning and early return from music setup
rather than crashing the bot). Replace the "✅ Yes*" label with something like
"Optional (required for music)" and change the parenthetical note to explicitly
explain that the bot will still start without it but music functionality will be
disabled and a warning is logged.

| `LAVALINK_HOST` | ❌ Optional | Lavalink server host (default: node1.kartadharta.xyz) |
| `LAVALINK_PORT` | ❌ Optional | Lavalink server port (default: 443) |
| `BINANCE_API_KEY` | ❌ Optional | Binance API key for trading |
| `BINANCE_API_SECRET` | ❌ Optional | Binance API secret |
| `spotify_id` | ❌ Optional | Spotify client ID |
| `spotify_secret` | ❌ Optional | Spotify client secret |

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

## 📄 License

This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.

## 🔗 Links

- **Repository**: [GitHub - ArliT1-F/iceC](https://github.com/ArliT1-F/iceC)
- **Discord Developer Portal**: [discord.com/developers](https://discord.com/developers)
- **Binance API**: [binance.com/api](https://binance.com/api)
- **Wavelink Documentation**: [wavelink.readthedocs.io](https://wavelink.readthedocs.io/)

## ⚠️ Disclaimer

- This bot is for educational purposes
- Trading features involve financial risks - use at your own discretion
- Ensure compliance with Discord's Terms of Service
- Respect copyright when using music features

## 📞 Support

If you encounter any issues or have questions:
1. Check the [Troubleshooting](#-troubleshooting) section
2. Review the code comments and documentation
3. Open an issue on GitHub

---

**Made with ❤️ by the iceC development team**

*Last updated: 2024*
Loading