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

Implement Stage Instances #1725

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

null-domain
Copy link
Contributor

Summary

This PR aims to finish the work made by @ashwinvin in #695, including rebasing on the most recent hikari version (at the time of writing) and bringing tests up to scratch.

Hopefully I haven't missed anything, I only had a few hours to look at this.

Checklist

  • I have run nox and all the pipelines have passed.
    • With the exception of the docs pipeline, but that isn't anything to do with me 👀
  • I have made unittests according to the code I have added/modified/deleted.

Related issues

Closes #695
Closes #602

@davfsa davfsa added the enhancement New feature or request label Sep 28, 2023
@null-domain

This comment was marked as outdated.

@davfsa davfsa mentioned this pull request Sep 28, 2023
2 tasks
@null-domain null-domain force-pushed the feat/stage-instances branch 2 times, most recently from 8425260 to fb4e40d Compare September 29, 2023 07:18
@null-domain null-domain marked this pull request as draft September 29, 2023 08:17
@null-domain
Copy link
Contributor Author

discord/discord-api-docs#5687 was merged last night so I'm gonna keep this as a draft until I get a moment to add this in. I have it committed locally but haven't had the chance to test yet.

@null-domain null-domain marked this pull request as ready for review October 2, 2023 09:32
Copy link
Member

@davfsa davfsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking over this PR!

hikari/stage_instances.py Outdated Show resolved Hide resolved
hikari/impl/rest.py Outdated Show resolved Hide resolved
hikari/impl/rest.py Outdated Show resolved Hide resolved
tests/hikari/test_stage_instances.py Outdated Show resolved Hide resolved
tests/hikari/events/test_stage_events.py Outdated Show resolved Hide resolved
hikari/api/rest.py Outdated Show resolved Hide resolved
hikari/api/rest.py Outdated Show resolved Hide resolved
hikari/api/rest.py Outdated Show resolved Hide resolved
hikari/api/rest.py Outdated Show resolved Hide resolved
hikari/api/rest.py Outdated Show resolved Hide resolved
Copy link
Member

@davfsa davfsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a nitpick :)

hikari/impl/entity_factory.py Outdated Show resolved Hide resolved
hikari/stage_instances.py Show resolved Hide resolved
hikari/stage_instances.py Show resolved Hide resolved
hikari/stage_instances.py Show resolved Hide resolved
ashwinvin and others added 16 commits November 2, 2023 09:23
add stubs

fix linting

make names more consistent.

started adding tests

change stage_id to id

rename stage_instance_events to stage_events.

add helpful functions and modify abc thing

rename and fix linting

fix bugs + add tests for event manager

add tests for stage events and fix some bugs

add tests for stage_instance

fix linting

add tests and fix small bugs
Just brought it up to date with the current version (at time of writing)
`guild_scheduled_event_id` was recently merged into DAPI docs.
`send_start_notification` was added to Create Stage Instance some time ago, so I added that in too.
Co-authored-by: davfsa <davfsa@gmail.com>
Signed-off-by: nulldomain <git@nulldoma.in>
Co-authored-by: davfsa <davfsa@gmail.com>
Signed-off-by: nulldomain <git@nulldoma.in>
hikari/api/rest.py Outdated Show resolved Hide resolved
hikari/api/rest.py Outdated Show resolved Hide resolved
hikari/internal/routes.py Show resolved Hide resolved
null-domain and others added 3 commits December 7, 2023 08:57
Co-authored-by: davfsa <davfsa@gmail.com>
Signed-off-by: nulldomain <git@nulldoma.in>
Co-authored-by: davfsa <davfsa@gmail.com>
Signed-off-by: nulldomain <git@nulldoma.in>
Co-authored-by: davfsa <davfsa@gmail.com>
Signed-off-by: nulldomain <git@nulldoma.in>
@davfsa
Copy link
Member

davfsa commented Jan 21, 2024

@FasterSpeeding please review when you can :)

@null-domain
Copy link
Contributor Author

@FasterSpeeding Can you review please?


@property
@abc.abstractmethod
def stage_instance_id(self) -> snowflakes.Snowflake:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a small thing but this property could just be a solid implementation which returns self.stage_instance.id, there's not really any good reason for it to be abstract since it's the same implementation each time.

@property
def app(self) -> traits.RESTAware:
# <<inherited docstring from Event>>.
return self.stage_instance.app
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These app property implementations could be moved to StageInstanceEvent since it's the same implementation each time anyways

Comment on lines +1471 to +1473
guild_scheduled_event_id = (
snowflakes.Snowflake(payload["guild_scheduled_event_id"]) if payload["guild_scheduled_event_id"] else None
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
guild_scheduled_event_id = (
snowflakes.Snowflake(payload["guild_scheduled_event_id"]) if payload["guild_scheduled_event_id"] else None
)
raw_event_id = payload["guild_scheduled_event_id"]
guild_scheduled_event_id = snowflakes.Snowflake(raw_event_id) if raw_event_id else None

Would make this a bit cleaner

Returns
-------
hikari.channels.GuildStageChannel
The guild stage channel where this stage instance was created.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section here needs to be updated to reflect that the return type is optional

@FasterSpeeding
Copy link
Collaborator

Asides from those few small things LGTM

# -*- coding: utf-8 -*-
# cython: language_level=3
# Copyright (c) 2020 Nekokatt
# Copyright (c) 2021 davfsa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copyright (c) 2021 davfsa
# Copyright (c) 2021-present davfsa

# -*- coding: utf-8 -*-
# cython: language_level=3
# Copyright (c) 2020 Nekokatt
# Copyright (c) 2021 davfsa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copyright (c) 2021 davfsa
# Copyright (c) 2021-present davfsa

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

Successfully merging this pull request may close these issues.

Implement Stage Instances
5 participants