Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ScheduledEvents support #152

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

connorshea
Copy link
Contributor

@connorshea connorshea commented Apr 23, 2022

Summary

I think I've got most of this working now, and I've tested it with my own bot. The only thing that isn't working is the event handlers, because I didn't add them to handle_dispatch. I might need some help on that part.

TODO:

  • Finish the relevant event handling to handle_dispatch so the event handlers actually get triggered.

Added

  • Discordrb::ScheduledEvent class to represent Discord's Scheduled Events functionality
  • Add a scheduled_events method on Discordrb::Server to get scheduled events for the given server.
  • Add a scheduled_event method on Discordrb::Server for getting individual scheduled events.
  • Add a delete method on Discordrb::ScheduledEvent to delete the ScheduledEvent.
  • Add request methods to Discordrb::API::Server for creating, updating, and deleting scheduled events. These aren't exposed on the Discordrb::Server class right now, but you can use the "raw" endpoints if you really want to.
  • Add event handling for ScheduledEvent creation, updating, and deleting.
  • Add event handling for users being added and removed to ScheduledEvents.
  • Add support for the ScheduledEvent intents.

This includes a few convenience methods and all the necessary attributes
for the class based on what the API returns for scheduled events.
It's events all the way down.

Also a method on the Server class for getting scheduled events for a
guild.
For getting a list of scheduled events off of a given guild.
Pretty basic implementation. Also renamed the create handler to match
the other guild-based event handlers.
Added endpoints for Show/Create/Update/Delete.
Now we can use event listeners to track when a user is added or removed
from a scheduled event.
This allows bots to request access for scheduled event creation,
deletion, etc events.
Need to figure out how to handle these properly, for now it's just TODOs.
Also fix the event handlers. I wasn't defining the `matches?` method
correctly.
@b-turchyn
Copy link

Hey @connorshea; was this something you were still working on? I have a use case for what you've built here. Not sure if I can be of any help, but I'm happy to get my hands dirty if you'd like!

@kmcphillips
Copy link
Contributor

Interested if anyone is going to pick this up? Is it close? I can look at it if nobody is owning it but it's lots of context to pickup if someone already has the context. Looks unfinished in #183

I'm using the REST api with the bot token for now, if anyone has the same requirements as me, but it's messy and not well integrated.

@edos4
Copy link

edos4 commented Oct 23, 2023

Up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants