Ticketmaster Bot is a Discord bot designed to alert users every time a new event becomes available on Ticketmaster. Built for a ticket resale company based in NYC, it ensures users receive timely updates about upcoming events and provides powerful tools for managing event notifications.
-
Event Alerts: Automatically notifies a Discord server when new events are added to Ticketmaster.
-
User Commands:
-
API Crawlers: Continuously fetch new events from Ticketmaster’s API for four regions in North America.
- Programming Language: Python
- Database: PostgreSQL
- Hosting: Heroku
- APIs:
- Deployment: CI/CD pipeline auto-deploys updates to Heroku from GitHub.
The project is composed of two key components:
- API Crawlers: Four Python scripts, each assigned to a specific North American region, poll the Ticketmaster API every minute and store new events in a PostgreSQL database.
- Bot Script: The Discord bot retrieves unsent events from the database, posts them in designated channels, and handles user commands.
Example request:
https://app.ticketmaster.com/discovery/v2/events?apikey=YOUR_API_KEY&source=ticketmaster&locale=*&size=199&page=1&onsaleStartDateTime=2024-12-27T00:00:00Z&classificationId=CONCERTS&onsaleOnAfterStartDate=DATE&sort=onSaleStartDate,asc&latlong=CENTER&radius=DIST&unit=miles
-
Rate Limits: The Ticketmaster API enforces a rate limit of 1000 events returned per query.
-
Storage Efficiency: Optimized database structure to handle high-frequency updates and large datasets effectively.
- Expand coverage to include events from other continents.
- Optimize database queries for better performance.
- Add new Discord commands and enhance logging mechanisms.
- Improve bot scalability and error handling.
-
Clone the repository:
git clone https://github.com/adenjonah/TicketMasterBot.git
-
Install dependencies:
pip install -r requirements.txt
-
Set up your environment variables:
- TICKETMASTER_API_KEY
- DISCORD_CHANNEL_ID
- DISCORD_CHANNEL_ID_TWO
- DISCORD_BOT_TOKEN
- DATABASE_URL
- DEBUG_LOGS (1 if on, 0 if off)
- CENTER_POINT (long, lat of the zone you want to crawl)
- RADIUS (in miles)
- UNIT=miles
- REDIRECT_URI=http://localhost
Example.env
TICKETMASTER_API_KEY='P7v8iurhq2a9r84o84irqo2uhq' DISCORD_BOT_TOKEN='MKSEalfnj87yBbE8.GHQ_Cx.KHGbkFHBFYUBFI-ri_XY' DISCORD_CHANNEL_ID='3795263749501923847509' DISCORD_CHANNEL_ID_TWO='73425974283745975392785' REDIRECT_URI='http://localhost' DATABASE_URL='postgres://7stfuastdg88:utaf8sfiasgig9asiygfouasgf0.cluster-s78syag9.us-east-2.rds.amazonaws.com:26739/aiysgfyasg98f' DEBUG_LOGS='1' CENTER_POINT=43.89789,-72.84782 RADIUS=685 UNIT=miles
-
Deploy to Heroku or run locally using the provided scripts (run newbot.py and crawler.py at the same time).
- Add the bot to your Discord server.
- Configure the database with your Ticketmaster API regions and preferences via environment variables.
- Start receiving real-time alerts and use commands like
!next
and!addartist
to interact with the bot.
Find the source code and deployment instructions here.
This project was developed by adenjonah as a solo initiative, requiring approximately 30 hours of work, including iterations. For inquiries or collaboration, feel free to reach out via GitHub or the contacts in my profile.