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

feat: implement voice_channel_effect event #993

Merged
merged 27 commits into from
Nov 13, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2820ed9
feat: implement `voice_channel_effect` event
shiftinv Mar 30, 2023
e37a22e
feat: add cached fields to raw event
shiftinv Mar 30, 2023
c63a166
docs: add/update documentation
shiftinv Mar 30, 2023
23dfb20
docs: add changelog entry
shiftinv Mar 30, 2023
5d6ff11
chore(types): use `total=False` for effect typeddict
shiftinv Mar 30, 2023
c8bdfd7
chore: run autotyping
shiftinv Mar 30, 2023
4cce725
chore: add another todo
shiftinv Mar 30, 2023
b46070a
refactor: move `VoiceChannelEffect` to `disnake.channel`
shiftinv Apr 1, 2023
ce08c34
feat: add repr
shiftinv Apr 1, 2023
1b6ba55
Merge remote-tracking branch 'upstream/master' into feature/voice-cha…
shiftinv Apr 9, 2023
4e8a8e3
Merge remote-tracking branch 'upstream/master' into feature/voice-cha…
shiftinv May 2, 2023
0264c76
Merge remote-tracking branch 'upstream/master' into feature/voice-cha…
shiftinv Jul 1, 2023
378de67
chore(docs): update versionadded
shiftinv Jul 1, 2023
b6e3608
feat: add soundboard effect fields
shiftinv Jul 1, 2023
1ee704a
chore: remove obsolete todos
shiftinv Jul 1, 2023
4202e58
docs: link new events on page
shiftinv Jul 2, 2023
b27a6de
revert: remove soundboard fields, moved to other PR
shiftinv Jul 3, 2023
ee4f70c
Merge remote-tracking branch 'upstream/master' into feature/voice-cha…
shiftinv Jun 4, 2024
f09a4fb
Merge remote-tracking branch 'upstream/master' into feature/voice-cha…
shiftinv Aug 9, 2024
1a0f017
Merge remote-tracking branch 'upstream/master' into feature/voice-cha…
shiftinv Aug 16, 2024
1d1291e
lint: make pylance happy
shiftinv Aug 16, 2024
5848c61
refactor: rename to `cached_member`
shiftinv Aug 16, 2024
b394539
refactor: create `VoiceChannelEffect` outside of raw model
shiftinv Aug 19, 2024
75a4c8f
refactor: move emoji conversion into `VoiceChannelEffect`, use emoji …
shiftinv Aug 19, 2024
beeb8f0
Merge remote-tracking branch 'upstream/master' into feature/voice-cha…
shiftinv Nov 13, 2024
2a7ced2
docs: add link to raw event
shiftinv Nov 13, 2024
022dc36
docs: effects will always happen in `VoiceChannel`s
shiftinv Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add cached fields to raw event
shiftinv committed Mar 30, 2023
commit e37a22e7091722904956962c24ac1c59bbbd63c8
5 changes: 3 additions & 2 deletions disnake/raw_models.py
Original file line number Diff line number Diff line change
@@ -454,12 +454,13 @@ class RawVoiceChannelEffectEvent(_RawReprMixin):
"guild_id",
"user_id",
"effect",
"member",
)

# TODO: add cached fields

def __init__(self, data: VoiceChannelEffectSendEvent, emoji: Optional[PartialEmoji]):
self.channel_id: int = int(data["channel_id"])
self.guild_id: int = int(data["guild_id"])
self.user_id: int = int(data["user_id"])
self.effect: VoiceChannelEffect = VoiceChannelEffect(data, emoji)

self.member: Optional[Member] = None
5 changes: 3 additions & 2 deletions disnake/state.py
Original file line number Diff line number Diff line change
@@ -1815,10 +1815,11 @@ def parse_voice_channel_effect_send(self, data: gateway.VoiceChannelEffectSendEv
)

raw = RawVoiceChannelEffectEvent(data, emoji)
self.dispatch("raw_voice_channel_effect", raw)

# TODO: narrow channel type to VoiceChannel?
channel = guild.get_channel(raw.channel_id)
member = guild.get_member(raw.user_id)
raw.member = member = guild.get_member(raw.user_id)
self.dispatch("raw_voice_channel_effect", raw)

if channel and member:
# TODO: upgrade `PartialEmoji` to `Emoji` here?