Crypto Bots

How to Build a Discord Bot for Crypto Price Alerts and Trading Signals

Build a Discord bot that sends real-time crypto price alerts, whale movement notifications, and AI trading signals to your server. Full tutorial with discord.js and Python.

A
AI Agents Hubยท2026-03-14ยท4 min readยท749 words

Builder of AI agents, crypto trading bots, and open-source automation tools. Sharing practical guides on how to build, deploy, and profit from AI and DeFi technology.

Why Discord for Crypto Alerts?

Discord has become the de facto platform for crypto communities. A bot that delivers real-time price alerts, whale movements, and trading signals to a Discord server is one of the highest-value tools you can build.

Use cases:

  • Personal price alert system ($BTC crosses $70K โ†’ ping you)
  • Community trading signal bot (post signals to a members channel)
  • Whale wallet tracker (famous wallet moves โ†’ notify server)
  • Portfolio tracker (daily P&L summary in your private server)

Setting Up a Discord Bot

Step 1: Go to discord.com/developers/applications โ†’ New Application โ†’ Bot โ†’ copy the token.

Step 2: Enable these Privileged Gateway Intents:

  • Message Content Intent
  • Server Members Intent

Step 3: Generate an invite URL with bot and applications.commands scopes.

Basic Discord Bot with Price Alerts

import { Client, GatewayIntentBits, EmbedBuilder, TextChannel } from 'discord.js'
import ccxt from 'ccxt'

const client = new Client({
  intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages]
})

const exchange = new ccxt.binance()

// Price alert rules
interface PriceAlert {
  symbol: string
  threshold: number
  direction: 'above' | 'below'
  channelId: string
  triggered: boolean
}

const alerts: PriceAlert[] = [
  { symbol: 'BTC/USDT', threshold: 70000, direction: 'above', channelId: 'YOUR_CHANNEL_ID', triggered: false },
  { symbol: 'ETH/USDT', threshold: 4000, direction: 'above', channelId: 'YOUR_CHANNEL_ID', triggered: false },
]

// Check prices and trigger alerts
async function checkAlerts() {
  for (const alert of alerts.filter(a => !a.triggered)) {
    const ticker = await exchange.fetchTicker(alert.symbol)
    const price = ticker.last!
    
    const triggered = alert.direction === 'above' 
      ? price >= alert.threshold 
      : price <= alert.threshold
    
    if (triggered) {
      alert.triggered = true
      await sendAlert(alert, price)
    }
  }
}

async function sendAlert(alert: PriceAlert, currentPrice: number) {
  const channel = client.channels.cache.get(alert.channelId) as TextChannel
  if (!channel) return
  
  const embed = new EmbedBuilder()
    .setColor(alert.direction === 'above' ? 0x00ff00 : 0xff0000)
    .setTitle(`๐Ÿšจ Price Alert: ${alert.symbol}`)
    .addFields(
      { name: 'Current Price', value: `$${currentPrice.toLocaleString()}`, inline: true },
      { name: 'Alert Level', value: `$${alert.threshold.toLocaleString()}`, inline: true },
      { name: 'Direction', value: alert.direction === 'above' ? '๐Ÿ“ˆ Above' : '๐Ÿ“‰ Below', inline: true }
    )
    .setTimestamp()
  
  await channel.send({ embeds: [embed] })
}

// Slash command for setting new alerts
client.on('interactionCreate', async (interaction) => {
  if (!interaction.isChatInputCommand()) return
  
  if (interaction.commandName === 'alert') {
    const symbol = interaction.options.getString('symbol', true).toUpperCase()
    const price = interaction.options.getNumber('price', true)
    const direction = interaction.options.getString('direction', true) as 'above' | 'below'
    
    alerts.push({
      symbol: `${symbol}/USDT`,
      threshold: price,
      direction,
      channelId: interaction.channelId,
      triggered: false,
    })
    
    await interaction.reply(`โœ… Alert set: **${symbol}** ${direction} **$${price.toLocaleString()}**`)
  }
})

client.once('ready', () => {
  console.log(`Bot logged in as ${client.user?.tag}`)
  // Check prices every 30 seconds
  setInterval(checkAlerts, 30_000)
})

client.login(process.env.DISCORD_TOKEN)

Whale Alert Integration

Track large on-chain transactions and post them to Discord:

import discord
import aiohttp
import asyncio

TOKEN = 'YOUR_BOT_TOKEN'
CHANNEL_ID = 123456789  # Your channel ID
MIN_USD_VALUE = 1_000_000  # Alert on $1M+ moves

intents = discord.Intents.default()
client = discord.Client(intents=intents)

async def get_large_transactions():
    """Poll whale-alert style API for large transactions"""
    async with aiohttp.ClientSession() as session:
        # Using public Whale Alert API (free tier: 10 calls/minute)
        url = "https://api.whale-alert.io/v1/transactions"
        params = {
            "api_key": "YOUR_WHALE_ALERT_KEY",
            "min_value": 1000000,
            "start": int(asyncio.get_event_loop().time()) - 60  # Last 60 seconds
        }
        async with session.get(url, params=params) as resp:
            data = await resp.json()
            return data.get('transactions', [])

async def send_whale_alert(channel, tx):
    embed = discord.Embed(
        title=f"๐Ÿ‹ ${tx['amount_usd']:,.0f} {tx['symbol'].upper()} Transfer",
        color=0x00B4D8
    )
    embed.add_field(name="Amount", value=f"{tx['amount']:,.0f} {tx['symbol'].upper()}", inline=True)
    embed.add_field(name="USD Value", value=f"${tx['amount_usd']:,.0f}", inline=True)
    embed.add_field(name="From", value=tx['from']['owner'] or tx['from']['address'][:10]+'...', inline=True)
    embed.add_field(name="To", value=tx['to']['owner'] or tx['to']['address'][:10]+'...', inline=True)
    embed.set_footer(text=f"๐Ÿ”— Tx: {tx['hash'][:20]}...")
    
    await channel.send(embed=embed)

@client.event
async def on_ready():
    channel = client.get_channel(CHANNEL_ID)
    print(f'Bot ready: {client.user}')
    
    while True:
        transactions = await get_large_transactions()
        for tx in transactions:
            await send_whale_alert(channel, tx)
        await asyncio.sleep(60)

client.run(TOKEN)

Daily Market Summary Bot

async def send_daily_summary(channel):
    """Post a daily market summary at 9 AM UTC"""
    import ccxt
    
    exchange = ccxt.binance()
    symbols = ['BTC/USDT', 'ETH/USDT', 'SOL/USDT', 'BNB/USDT']
    
    embed = discord.Embed(title="๐Ÿ“Š Daily Crypto Market Summary", color=0x9B59B6)
    embed.set_footer(text=f"Updated: {datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC')}")
    
    for symbol in symbols:
        ticker = exchange.fetch_ticker(symbol)
        coin = symbol.split('/')[0]
        change = ticker['percentage']
        emoji = "๐ŸŸข" if change > 0 else "๐Ÿ”ด"
        
        embed.add_field(
            name=f"{emoji} {coin}",
            value=f"${ticker['last']:,.2f}\n{change:+.2f}%",
            inline=True
        )
    
    await channel.send(embed=embed)

Deploying Your Discord Bot

Deploy to a cheap VPS (DigitalOcean, Hetzner) for 24/7 uptime:

# Install dependencies
npm install discord.js ccxt dotenv

# Start with PM2 for auto-restart
npm install -g pm2
pm2 start bot.js --name discord-crypto-bot
pm2 save
pm2 startup

Or use Railway/Render for serverless hosting โ€” they have free tiers that work well for Discord bots.

Monetization tip: Package your bot and charge Discord server owners $10-20/month for a private instance. Crypto communities value real-time alerts and many will pay for quality tooling.

Related Articles