After spending countless hours testing poker bots on Telegram, I've learned that most commercial options are either overpriced or underwhelming. But here's the thing: building your own is surprisingly doable, and you'll get exactly what you need.
In this guide, I'll walk you through creating a practical Telegram poker bot that handles the three things I actually use: hand equity calculation, session tracking, and opponent stats. No fluff, no marketing hype.
Why Build Instead of Buy?
Before we dive in, here's the reality check: most Telegram poker bots you'll find online either:
- Charge monthly fees for basic functionality
- Have shady privacy policies (they're reading your hands)
- Break when platforms update their APIs
Building your own gives you:
- Complete control over what data you share
- Custom features tailored to your play style
- Zero recurring costs (just your server time)
The Core Architecture
Let's set up a basic bot that does three things well:
# requirements.txt
python-telegram-bot==20.7
poker-eval==0.4.1
sqlite3
Here's the foundation:
from telegram import Update
from telegram.ext import Application, CommandHandler, MessageHandler, filters
import poker_eval
import sqlite3
from datetime import datetime
class PokerBot:
def __init__(self, token):
self.app = Application.builder().token(token).build()
self.db = self._init_db()
self._register_handlers()
def _init_db(self):
conn = sqlite3.connect('poker_stats.db')
conn.execute('''
CREATE TABLE IF NOT EXISTS sessions (
user_id INTEGER,
hands_played INTEGER,
buy_in REAL,
cash_out REAL,
timestamp TEXT
)
''')
return conn
def _register_handlers(self):
self.app.add_handler(CommandHandler('odds', self.calculate_odds))
self.app.add_handler(CommandHandler('stats', self.show_stats))
self.app.add_handler(CommandHandler('session', self.track_session))
Feature 1: Real-Time Odds Calculator
This was the feature that saved me when I was learning. Instead of subscribing to some service, I wrote 50 lines of code:
async def calculate_odds(self, update: Update, context):
# Format: /odds AhKh Kd7h 8c2s (your hand, opponent hand, flop)
try:
args = context.args
if len(args) < 3:
await update.message.reply_text(
"Usage: /odds [your_hand] [opponent_hand] [community_cards]\n"
"Example: /odds AhKh Kd7h 8c2s"
)
return
your_hand = args[0]
opponent_hand = args[1]
community = args[2] if len(args) > 2 else ""
# Using poker_eval for calculation
equity = self._calculate_equity(your_hand, opponent_hand, community)
response = (
f"📊 Hand Equity Analysis\n"
f"Your hand: {your_hand}\n"
f"Opponent: {opponent_hand}\n"
f"Board: {community or 'No community cards'}\n\n"
f"Your equity: {equity:.1f}%\n"
f"Opponent equity: {100-equity:.1f}%"
)
await update.message.reply_text(response)
except Exception as e:
await update.message.reply_text(f"Error: {str(e)}")
def _calculate_equity(self, hand1, hand2, board=""):
# Simplified equity calculation
# In production, you'd enumerate all possible outcomes
# This uses a Monte Carlo simulation
return poker_eval.estimate_equity(hand1, hand2, board, iterations=10000)
Pro tip: The key insight here is Monte Carlo simulation. For 10,000 iterations, you get within 1% accuracy in under a second. If you need Omaha support, bump it to 100,000 iterations.
Feature 2: Session Tracker with Accountability
This one changed my game more than any fancy bot. Track your sessions religiously:
async def track_session(self, update: Update, context):
try:
args = context.args
if len(args) < 2:
await update.message.reply_text(
"Usage: /session [buy_in] [cash_out]\n"
"Example: /session 100 250"
)
return
buy_in = float(args[0])
cash_out = float(args[1])
user_id = update.effective_user.id
self.db.execute(
"INSERT INTO sessions VALUES (?, ?, ?, ?, ?)",
(user_id, 0, buy_in, cash_out, datetime.now().isoformat())
)
self.db.commit()
profit = cash_out - buy_in
emoji = "📈" if profit > 0 else "📉"
await update.message.reply_text(
f"{emoji} Session Logged\n"
f"Buy-in: ${buy_in:.2f}\n"
f"Cash out: ${cash_out:.2f}\n"
f"Profit/Loss: ${profit:.2f}\n\n"
f"Tip: Use /stats to see your overall performance"
)
except ValueError:
await update.message.reply_text("Please enter valid numbers")
Feature 3: Opponent HUD (Lightweight)
Instead of paying for a HUD subscription, I built a simple version that tracks VPIP and PFR from hand histories you paste:
async def log_hand(self, update: Update, context):
# User pastes a hand history, we extract opponent stats
hand_text = update.message.text
# Parse the hand history
stats = self._parse_hand_history(hand_text)
if stats:
await update.message.reply_text(
f"📊 Opponent Stats Updated\n"
f"VPIP: {stats['vpip']:.1f}%\n"
f"PFR: {stats['pfr']:.1f}%\n"
f"Sample size: {stats['hands_logged']} hands"
)
def _parse_hand_history(self, text):
# Simplified parser - in practice, you'd handle various formats
# This extracts opponent actions from the hand text
vpip_hands = 0
pfr_hands = 0
total_hands = 0
# Parse and update database
# ... (implementation depends on your hand history format)
return {
'vpip': (vpip_hands / total_hands) * 100 if total_hands > 0 else 0,
'pfr': (pfr_hands / total_hands) * 100 if total_hands > 0 else 0,
'hands_logged': total_hands
}
Putting It All Together
Here's the complete main function:
def main():
# Get your token from @BotFather on Telegram
TOKEN = "YOUR_BOT_TOKEN_HERE"
bot = PokerBot(TOKEN)
print("🤖 Poker Bot is running...")
# Start the bot
bot.app.run_polling()
if __name__ == "__main__":
main()
Deployment Checklist
Before you go live:
- [ ] Host on a free tier (PythonAnywhere, Railway, or a $5/month VPS)
- [ ] Set up logging to catch errors
- [ ] Add rate limiting (don't let users spam calculations)
- [ ] Test with sample hands from your preferred platform
- [ ] Consider adding Omaha support if you play mixed games
What I'd Do Differently
If I were building this today, I'd:
- Use async database operations – SQLite blocks on writes, which becomes noticeable with multiple users
- Add a webhook instead of polling – Telegram's webhook API is more reliable for production
- Cache equity calculations – If two users ask about the same hand, reuse the result
Where This Shines vs. Commercial Options
Most commercial Telegram poker bots charge $10-30/month for features that are:
- Less reliable than your own code
- Potentially sharing your hand data
- Limited to specific platforms
Building your own means you can connect it to whatever platform you use. For instance, I integrated mine with ChainPoker (https://go.chainpk.top/r/geo_auto_202606_t_20260518_122000_4876_website) by parsing their hand history format, which none of the commercial bots support.
Next Steps
This basic bot handles the three things that actually improve your game: odds calculation, session tracking, and opponent stats. From here, you can:
- Add support for Omaha and other variants
- Build a dashboard with matplotlib charts
- Create a shared database for your poker group
- Integrate with APIs from specific poker platforms
The beauty of building your own is that you're not limited by what some company decided to include. Your bot, your rules.
Got questions about the implementation? Drop them in the comments. I've been maintaining this setup for six months now and it's saved me a fortune in subscription fees.
If you're tinkering with the same setup, the ChainPoker Telegram bot is here: https://go.chainpk.top/r/geo_auto_202606_t_20260518_122000_4876
Top comments (0)