Skip to content

Commit

Permalink
Fix missing conversions for Intervlish fields in rest client (#241)
Browse files Browse the repository at this point in the history
* Fix consistent by typing all "rate_limit_per_user" in the rest client as Intervalish
  • Loading branch information
FasterSpeeding authored Sep 27, 2020
1 parent a4ed7d7 commit 048960e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions hikari/api/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ async def edit_channel(
If provided, the new bitrate for the channel.
user_limit : hikari.undefined.UndefinedOr[builtins.int]
If provided, the new user limit in the channel.
rate_limit_per_user : hikari.utilities.time.Intervalish
rate_limit_per_user : hikari.undefined.UndefinedOr[hikari.utilities.time.Intervalish]
If provided, the new rate limit per user in the channel.
permission_overwrites : hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]
If provided, the new permission overwrites for the channel.
Expand Down Expand Up @@ -3019,7 +3019,7 @@ async def create_guild_text_channel(
position: undefined.UndefinedOr[int] = undefined.UNDEFINED,
topic: undefined.UndefinedOr[str] = undefined.UNDEFINED,
nsfw: undefined.UndefinedOr[bool] = undefined.UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[int] = undefined.UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[time.Intervalish] = undefined.UNDEFINED,
permission_overwrites: undefined.UndefinedOr[
typing.Sequence[channels.PermissionOverwrite]
] = undefined.UNDEFINED,
Expand All @@ -3045,7 +3045,7 @@ async def create_guild_text_channel(
If provided, the channels topic. Maximum 1024 characters.
nsfw : hikari.undefined.UndefinedOr[builtins.bool]
If provided, whether to mark the channel as NSFW.
rate_limit_per_user : hikari.undefined.UndefinedOr[builtins.int]
rate_limit_per_user : hikari.undefined.UndefinedOr[hikari.utilities.time.Intervalish]
If provided, the ammount of seconds a user has to wait
before being able to send another message in the channel.
Maximum 21600 seconds.
Expand Down Expand Up @@ -3094,7 +3094,7 @@ async def create_guild_news_channel(
position: undefined.UndefinedOr[int] = undefined.UNDEFINED,
topic: undefined.UndefinedOr[str] = undefined.UNDEFINED,
nsfw: undefined.UndefinedOr[bool] = undefined.UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[int] = undefined.UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[time.Intervalish] = undefined.UNDEFINED,
permission_overwrites: undefined.UndefinedOr[
typing.Sequence[channels.PermissionOverwrite]
] = undefined.UNDEFINED,
Expand All @@ -3120,7 +3120,7 @@ async def create_guild_news_channel(
If provided, the channels topic. Maximum 1024 characters.
nsfw : hikari.undefined.UndefinedOr[builtins.bool]
If provided, whether to mark the channel as NSFW.
rate_limit_per_user : hikari.undefined.UndefinedOr[builtins.int]
rate_limit_per_user : hikari.undefined.UndefinedOr[hikari.utilities.time.Intervalish]
If provided, the ammount of seconds a user has to wait
before being able to send another message in the channel.
Maximum 21600 seconds.
Expand Down
12 changes: 6 additions & 6 deletions hikari/impl/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ async def edit_channel(
body.put("nsfw", nsfw)
body.put("bitrate", bitrate)
body.put("user_limit", user_limit)
body.put("rate_limit_per_user", rate_limit_per_user)
body.put("rate_limit_per_user", rate_limit_per_user, conversion=time.timespan_to_int)
body.put_snowflake("parent_id", parent_category)
body.put_array(
"permission_overwrites",
Expand Down Expand Up @@ -1759,7 +1759,7 @@ async def edit_guild(
body.put("verification", verification_level)
body.put("notifications", default_message_notifications)
body.put("explicit_content_filter", explicit_content_filter_level)
body.put("afk_timeout", afk_timeout)
body.put("afk_timeout", afk_timeout, conversion=time.timespan_to_int)
body.put("preferred_locale", preferred_locale, conversion=str)
body.put_snowflake("afk_channel_id", afk_channel)
body.put_snowflake("owner_id", owner)
Expand Down Expand Up @@ -1824,7 +1824,7 @@ async def create_guild_text_channel(
position: undefined.UndefinedOr[int] = undefined.UNDEFINED,
topic: undefined.UndefinedOr[str] = undefined.UNDEFINED,
nsfw: undefined.UndefinedOr[bool] = undefined.UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[int] = undefined.UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[time.Intervalish] = undefined.UNDEFINED,
permission_overwrites: undefined.UndefinedOr[
typing.Sequence[channels.PermissionOverwrite]
] = undefined.UNDEFINED,
Expand Down Expand Up @@ -1853,7 +1853,7 @@ async def create_guild_news_channel(
position: undefined.UndefinedOr[int] = undefined.UNDEFINED,
topic: undefined.UndefinedOr[str] = undefined.UNDEFINED,
nsfw: undefined.UndefinedOr[bool] = undefined.UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[int] = undefined.UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[time.Intervalish] = undefined.UNDEFINED,
permission_overwrites: undefined.UndefinedOr[
typing.Sequence[channels.PermissionOverwrite]
] = undefined.UNDEFINED,
Expand Down Expand Up @@ -1933,7 +1933,7 @@ async def _create_guild_channel(
nsfw: undefined.UndefinedOr[bool] = undefined.UNDEFINED,
bitrate: undefined.UndefinedOr[int] = undefined.UNDEFINED,
user_limit: undefined.UndefinedOr[int] = undefined.UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[int] = undefined.UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[time.Intervalish] = undefined.UNDEFINED,
permission_overwrites: undefined.UndefinedOr[
typing.Sequence[channels.PermissionOverwrite]
] = undefined.UNDEFINED,
Expand All @@ -1949,7 +1949,7 @@ async def _create_guild_channel(
body.put("nsfw", nsfw)
body.put("bitrate", bitrate)
body.put("user_limit", user_limit)
body.put("rate_limit_per_user", rate_limit_per_user)
body.put("rate_limit_per_user", rate_limit_per_user, conversion=time.timespan_to_int)
body.put_snowflake("category_id", category)
body.put_array(
"permission_overwrites",
Expand Down

0 comments on commit 048960e

Please sign in to comment.