A Python IRC bot with weather, utilities, fun commands, and text tools. ASCII-styled output with IRC color formatting.
- Current weather with temperature, humidity, wind, pressure, visibility, sunrise/sunset
- 3-day forecast with highs, lows, and precipitation data
- Urban Dictionary lookups
- Current time (UTC)
- Coin flip with ASCII art
- Dice rolling (any XdY format)
- Magic 8-ball with ASCII art
- Rock Paper Scissors
- Random fun facts
- Quote database -- save and retrieve quotes from chat
- Seen tracker -- check when someone was last active
- Ping / uptime
- Safe math calculator
- MD5 / SHA1 / SHA256 hashing
- Base64 encode and decode
- Text reversal
- Mocking case (SpOnGeBoB)
- Hostmask-based authentication (
nick!user@hostwith wildcard support) - Admin commands bypass rate limiting
%join,%part,%quit,%say,%nick,%kick,%raw- Admin section only visible in
%helpto authenticated admins
- Input sanitization on all commands (CRLF injection, IRC control chars, length limits)
- URL parameter encoding on all API calls
- Per-user rate limiting (2s cooldown)
- Nickname validation against IRC spec
- Safe eval with no builtins for calculator
- Exponent cap to prevent resource exhaustion
- SSL/TLS support with TLS 1.2 minimum, optional certificate verification bypass
- SASL PLAIN and NickServ authentication
- Multi-network support via separate config files
- Temperature-based color coding
- ASCII-styled output (no emoji dependencies)
- Anti-flood protection between multi-line messages
- Configurable command prefix
Python 3.7+
pip install -r requirements.txtSettings live in config.py (default) or any alternate config file passed as a CLI argument.
# Connection
SERVER = "irc.example.net"
PORT = 6697 # 6697 for SSL, 6667 for non-SSL
NICKNAME = "le0"
CHANNELS = ["#channel"]
COMMAND_PREFIX = "%"
# Admin hostmasks (nick!user@host format, wildcards supported)
# Examples: "*!*@*.myisp.net" "mynick!*@*"
ADMINS = ["*!*@*.example.net"]
# SSL / Auth
USE_SSL = True
VERIFY_SSL = True # False to allow self-signed/unverified certs
PASSWORD = None # Server password (if needed)
NICKSERV_PASS = None # NickServ identify password (if needed)
SASL_USERNAME = None # SASL plain username (if needed)
SASL_PASSWORD = None # SASL plain password (if needed)# Default (uses config.py)
python3 le0.py
# Alternate config (e.g. config.efnet.py)
python3 le0.py config.efnetMultiple config files can coexist for different networks (e.g. config.efnet.py, config.libera.py).
WEATHER
%weather <location> or %w <location> Current weather
%forecast <location> or %f <location> 3-day forecast
INFO
%urban <term> or %ud <term> Urban Dictionary lookup
%time [location] Current time (UTC)
FUN
%coin or %flip Flip a coin
%roll [XdY] or %dice [XdY] Roll dice (default: 1d6)
%8ball <question> or %8 <question> Magic 8-ball
%rps <rock|paper|scissors> Rock Paper Scissors
%fact Random fun fact
SOCIAL
%quote Random quote from database
%addquote <text> Add a quote
UTILITY
%seen <nick> When was a user last active
%ping Pong
%uptime Bot uptime
TOOLS
%calc <expression> Math calculator
%hash <text> MD5/SHA1/SHA256 hashes
%base64 <encode|decode> <text> Base64 encode/decode
%reverse <text> Reverse text
%mock <text> SpOnGeBoB mOcKiNg CaSe
ADMIN (hostmask-authenticated only)
%join <channel> Join a channel
%part [channel] Leave a channel (defaults to current)
%quit [message] Disconnect the bot
%say <channel> <message> Speak in any channel
%nick <newnick> Change the bot's nick
%kick <nick> [reason] Kick a user from the current channel
%raw <command> Send a raw IRC command
HELP
%help Show all commands in IRC
<user> %weather London
<le0> ----------- Weather | London, United Kingdom -----------
<le0> > Condition: Partly cloudy Temp: 12°C / 54°F Feels: 10°C / 50°F
<le0> > Humidity: 76% Wind: 15km/h W Clouds: 65%
<le0> > Pressure: 1013hPa Visibility: 10km Sunrise: 07:45 Sunset: 16:30
<user> %roll 2d6
<le0> ----------- Dice Roll -----------
<le0> > 2d6 > [4, 5] = 9
<user> %calc 2^10
<le0> ----------- Calculator -----------
<le0> > 2**10 = 1024
<user> %rps rock
<le0> ----------- Rock Paper Scissors -----------
<le0> > You: ROCK vs Bot: SCISSORS
<le0> > Result: YOU WIN
Actual output includes IRC color codes for a much prettier display.