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 voice channel statuses #312

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

VelvetToroyashi
Copy link
Contributor

As it says on the tin; see also discord/discord-api-docs#6398 (this requires merging #311 first)

This commit implements the new permissions (USE_CLYDE_AI, SET_VOICE_CHANNEL_STATUS, and CREATE_GUILD_EXPRESSIONS) as seen in these PRs:

discord/discord-api-docs#6354
discord/discord-api-docs#6398
discord/discord-api-docs#6120
@MazeXP
Copy link
Contributor

MazeXP commented Sep 6, 2023

You have the commit about adding the new permissions in this PR as well by accident.

@VelvetToroyashi
Copy link
Contributor Author

VelvetToroyashi commented Sep 6, 2023

Intentional; it'll be absolved when #311 is merged.
(Though, I do have to see why the build is failing, oops)

Copy link
Contributor

@MazeXP MazeXP 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 minor change

@MazeXP
Copy link
Contributor

MazeXP commented Sep 6, 2023

Seems like we will get a new endpoint for setting the voice channel status: discord/discord-api-docs#6400
According to discord/discord-api-docs#6398 (comment) it will not be set through the typical Modify Channel call.

@VelvetToroyashi
Copy link
Contributor Author

Yeah oops, don't know why I did it like this when I literally linked the PR haha.

CancellationToken ct = default
)
{
return this.RestHttpClient.PatchAsync
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing AddAuditReason call

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't exist on the non-generic methods it seems. cc @Nihlus

@@ -109,6 +126,7 @@ public virtual Task<Result<IChannel>> GetChannelAsync
Optional<IReadOnlyList<Snowflake>> appliedTags = default,
Optional<SortOrder> defaultSortOrder = default,
Optional<ForumLayout> defaultForumLayout = default,
Optional<string?> status = default,
Copy link
Contributor

Choose a reason for hiding this comment

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

ModifyChannelAsync should not be modified as it is not meant to be used for setting the voice channel status by documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I swear I removed that. Bwah

Copy link
Contributor

Choose a reason for hiding this comment

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

dw, there are many Modify...Channel calls

CancellationToken ct = default
)
{
return this.RestHttpClient.PatchAsync
Copy link
Contributor

Choose a reason for hiding this comment

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

Add the check about status length here

@Nihlus
Copy link
Member

Nihlus commented Apr 4, 2024

Please rebase this PR as well - there are now merge conflicts, and the new inspection support should catch a couple of issues in the code. Merging is blocked by Discord not having merged the corresponding PRs fow now.

# Conflicts:
#	Backend/Remora.Discord.API.Abstractions/API/Objects/Permissions/DiscordPermission.cs
/// <summary>
/// Gets the ID of the channel being updated.
/// </summary>
Snowflake ID { get; }

Check notice

Code scanning / InspectCode

Type member is never used: Non-private accessibility Note

Property 'ID' is never used
/// <summary>
/// Gets the ID of the guild.
/// </summary>
Snowflake GuildID { get; }

Check notice

Code scanning / InspectCode

Type member is never used: Non-private accessibility Note

Property 'GuildID' is never used
/// <summary>
/// Gets the new status of the voice channel.
/// </summary>
Optional<string> Status { get; }

Check notice

Code scanning / InspectCode

Type member is never used: Non-private accessibility Note

Property 'Status' is never used
namespace Remora.Discord.API.Gateway.Events.Channels;

/// <inheritdoc cref="Remora.Discord.API.Abstractions.Gateway.Events.IVoiceChannelStatusUpdate"/>
public record VoiceChannelStatusUpdate

Check notice

Code scanning / InspectCode

Type is never used: Non-private accessibility Note

Record 'VoiceChannelStatusUpdate' is never used
CancellationToken ct = default
)
{
if (status is { HasValue: true, Value: { Length: > 500 } })

Check notice

Code scanning / InspectCode

Merge nested property patterns Note

Merge nested property patterns
return this.RestHttpClient.PatchAsync
(
$"channels/{channelID}/voice-status",
b => b.WithJson(b => b.Write("status", status, this.JsonOptions)).WithRateLimitContext(this.RateLimitCache),

Check warning

Code scanning / InspectCode

Variable in local function hides variable from outer scope Warning

Parameter 'b' hides outer parameter with the same name
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.

None yet

3 participants