IFPA or PinballMap API into Discord Bot?

We’re kicking around the idea of a local Discord. Has anyone written any bots that query the IFPA or PinballMap APIs to post things to a Discord or Slack?

Use cases:

  • IFPA - New tournament registered within a certain location/radius
  • IFPA - Upcoming tournament reminder
  • IFPA - Results for a tournament posted
  • PinballMap - New machine shows up in a certain region
5 Likes

I can’t help with the bots, but please add me to the discord unless it’s Delco only.

Super interested in this if someone pulls it off

In Slack, we haven’t used the pinball map api, but have used the @pinballmapcom twitter feed (which used the rss of machines added to locations).

@Richthofen or @PressStart - are State Championship standings available through an API? I know I can see standings in the IFPA app, but didn’t know if state standings or the upcoming tournaments at a state level were available through an API.

I totally forgot about this. If you link your Match Play user up for Slack notifications it does come with a couple of slash commands: /ifpa to search IFPA players and /tournaments to search Match Play for tournaments. I don’t think anyone uses them – I just added them way back when to see how it could all work

OK, I’ve attempted to hack something together for Discord:

The IFPA Championship Series Discord Bot:

Link to add it into your server (need to be a Server Admin):

What it does:

  • Web scrapes the standings page for the State and Year you provide it
  • Returns Top 32 people in that state
  • It’s fairly brittle because it looks for specific CSS tags to get the table it needs
  • It only works for the NACS right now.
    • With a little bit of work I can make it work for the Australian series.
    • It won’t work for WNACS because those are custom rankings pages that don’t include the State/Province name in the URL; I’ll need a reference table to return the right pages.
    • It won’t work for many of the other country championship pages since those are mostly formatted differently; I don’t see a solution for this.

How it works:

Type $ifpachamps followed by the following two inputs:

  • Two-Letter State or Province Code
  • Year

I will attempt to return the top 32 players for the year requested.
Example: $ipfachamps PA 2022`

I’m new to Discord and new to making bots, so if you have any feedback drop me a line.

3 Likes

Yes, the undocumented v2 api supports State Championship standings. Check out the v2 api endpoints and models here:

PinballApi/PinballRankingApiV2.cs at master · edgiardina/PinballApi (github.com)

Also, Corey, I absolutely love this. I’ve never written a Discord bot and now I totally want to. Well done.

IMHO it would be super rad if we just added $ifpa as the command and offered verbs. There’s so much data, and we could provide it all. or, can we do slash notation like /ifpa nacs ri 2021 ?

my discord is Pinball Dad#7848 if you wanna invite me and chat about it.

2 Likes

LOL Corey you absolutely ruined my night

1 Like

Version Update:

I don’t know if anyone is using the bot yet, but last night I published an update to version 2.0.

  • Now includes the WNACS (Open and Women’s). It relies on data-scraping specific URLs from the website on the Custom Ranking page, and that’s maintained through a reference file.
  • Differentiated the command for NACS
1 Like

Sounds like you had a late night! I’ll add you on Discord and we can keep the conversation going there.