Skip to content

Commit

Permalink
Rename request_nonce to guild_chunk_nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
davfsa committed Jan 14, 2021
1 parent 588d9da commit 23a57e9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion hikari/events/guild_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class GuildAvailableEvent(GuildVisibilityEvent):
The voice states active in the guild.
"""

request_nonce: typing.Optional[str] = attr.ib(repr=False, default=None)
guild_chunk_nonce: typing.Optional[str] = attr.ib(repr=False, default=None)
"""Nonce used to request the guild chunks.
This will be `builtins.None` if no chunks were requested.
Expand Down
2 changes: 1 addition & 1 deletion hikari/impl/event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async def on_guild_create(self, shard: gateway_shard.GatewayShard, payload: data
if members_declared and (event.guild.is_large or not presences_declared):
# We create a task here instead of awaiting the result to avoid any rate-limits from delaying dispatch.
nonce = f"{shard.id}.{time.uuid()}"
event.request_nonce = nonce
event.guild_chunk_nonce = nonce
coroutine = shard.request_guild_members(
event.guild, include_presences=bool(presences_declared), nonce=nonce
)
Expand Down
8 changes: 4 additions & 4 deletions tests/hikari/impl/test_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ async def test_on_guild_create(self, event_manager, shard, app):
members={"TestMember": 5678},
presences={"TestPresence": 9012},
voice_states={"TestState": 345},
request_nonce=None,
guild_chunk_nonce=None,
)

event_manager._app.event_factory.deserialize_guild_create_event.return_value = event
shard.request_guild_members = mock.AsyncMock()

await event_manager.on_guild_create(shard, payload)

assert event.request_nonce is None
assert event.guild_chunk_nonce is None
shard.request_guild_members.assert_not_called()

event_manager._cache.update_guild.assert_called_once_with(event.guild)
Expand Down Expand Up @@ -201,7 +201,7 @@ async def test_on_guild_create_when_request_chunks(self, event_manager, shard, a
members={"TestMember": 5678},
presences={"TestPresence": 9012},
voice_states={"TestState": 345},
request_nonce=None,
guild_chunk_nonce=None,
)

event_manager._app.event_factory.deserialize_guild_create_event.return_value = event
Expand All @@ -213,7 +213,7 @@ async def test_on_guild_create_when_request_chunks(self, event_manager, shard, a

uuid.assert_called_once_with()
nonce = "987.uuid"
assert event.request_nonce == nonce
assert event.guild_chunk_nonce == nonce
shard.request_guild_members.assert_called_once_with(event.guild, include_presences=True, nonce=nonce)
create_task.assert_called_once_with(shard.request_guild_members(), name="987:123 guild create members request")

Expand Down

0 comments on commit 23a57e9

Please sign in to comment.