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

Added missing "default_forum_layout" property for DiscordChannel #466

Merged
merged 7 commits into from Apr 4, 2024

Conversation

LaPepega
Copy link
Contributor

Description

Added missing "default_forum_layout" property for DiscordChannel
Fixes #436

Type of change

  • Bug fix (non-breaking change which fixes an issue)

@LaPepega LaPepega requested review from NyuwBot, Lulalaby and a team as code owners March 18, 2024 15:10
@LaPepega LaPepega requested a review from Chibi310 March 18, 2024 15:10
@CLAassistant
Copy link

CLAassistant commented Mar 18, 2024

CLA assistant check
All committers have signed the CLA.

@Lulalaby
Copy link
Member

Thank you! Could you also check if it's in the modify / create function?
I don't remember it right now.

@LaPepega
Copy link
Contributor Author

@Lulalaby If you mean the ModifyChannelAsync and CreateChannelAsync methods, I believe it's not, but I can try adding it. (Sorry, I might do/understand something wrong, its my first PR)

@Lulalaby
Copy link
Member

Yeah exactly!
If you want, try it, and if u need help, ask.
I'm a bit busy the next hours but after that I can help out, or you ask @TheXorog

@LaPepega
Copy link
Contributor Author

LaPepega commented Mar 18, 2024

Uh, so I've been trying to wrap my head around the whole structure, and these methods use modify/create payload types to build queries.
I'm not sure if it's ok to edit them? Should I add ForumLayout? defaultForumLayout argument to these functions and a defaultForumLayout property for payload classes? And then there is the same thing for create and edit Models...
Not to be annoying, just want to know if I'm doing the right thing :)

@Lulalaby
Copy link
Member

yeah that's exactly how to do it

@Lulalaby
Copy link
Member

Take a look at 93aee4e

@LaPepega
Copy link
Contributor Author

Great! Then I'll do it tomorrow.

@Lulalaby
Copy link
Member

Sounds good

@LaPepega
Copy link
Contributor Author

I noticed right now, wouldn't, CreateGuildForumChannelAsync be a better name for CreateForumChannelAsync method in DiscordApiClient, since it uses guild_id? Analogous to CreateGuildChannelAsync

@Lulalaby
Copy link
Member

If you look at https://github.com/Aiko-IT-Systems/DisCatSharp/pull/466/files, you'll see the missing places.
Also CreateGuildForumChannelAsync would be wrong because the method exists only on DiscordGuild, which implies it already.

@LaPepega
Copy link
Contributor Author

LaPepega commented Mar 20, 2024

This seems to be it.

@LaPepega
Copy link
Contributor Author

the method exists only on DiscordGuild, which implies it already.

I might be wrong, but i meant this one, which is in DiscordApiClient

@Lulalaby
Copy link
Member

Ohhhhh. Yeah sure go for it!

@LaPepega
Copy link
Contributor Author

Done! :)

@Lulalaby
Copy link
Member

@TheXorog can you also take a look

@TheXorog
Copy link
Member

TheXorog commented Mar 20, 2024

lgtm

not quite familiar with how the forum stuff works for the most part though, so i trust your word that everythings implemented thats needed. what is implemented looks to be in line with everything else.

Copy link
Member

@Lulalaby Lulalaby left a comment

Choose a reason for hiding this comment

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

One small thing tho, audit log reason should always be the last arg

@Lulalaby
Copy link
Member

@LaPepega can you work on the last feedback please

@LaPepega
Copy link
Contributor Author

Sorry, i totally forgot, should be all good now though

@Lulalaby
Copy link
Member

Lulalaby commented Apr 3, 2024

@TheXorog could u test?

@TheXorog
Copy link
Member

TheXorog commented Apr 4, 2024

@TheXorog could u test?

Will do in about half an hour 👍

@TheXorog
Copy link
Member

TheXorog commented Apr 4, 2024

Tested with this:

[SlashCommand("forum", "Test.")]
public async Task DefaultForum(InteractionContext ctx, [Option("channel", "channel"), ChannelTypes(ChannelType.Forum)]DiscordChannel channel, [Option("layout", "layout")]ForumLayout layout)
{
    await channel.ModifyForumAsync(x => x.DefaultForumLayout = layout);
    await ctx.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource, new DiscordInteractionResponseBuilder().AsEphemeral());
}

[SlashCommand("forum2", "Test.")]
public async Task DefaultForum2(InteractionContext ctx, [Option("layout", "layout")]ForumLayout layout)
{
    await ctx.Guild.CreateForumChannelAsync("test", ctx.Guild.GetChannel(1019898956316151850), defaultLayout: layout);
    await ctx.CreateResponseAsync(InteractionResponseType.DeferredChannelMessageWithSource, new DiscordInteractionResponseBuilder().WithContent("Success").AsEphemeral());
}

Seems all to be working.
Once i get some clarification on my review, this can be merged.

@Lulalaby Lulalaby requested a review from TheXorog April 4, 2024 07:34
@Lulalaby Lulalaby merged commit 30e0d90 into Aiko-IT-Systems:main Apr 4, 2024
6 checks passed
@TheXorog
Copy link
Member

TheXorog commented Apr 4, 2024

Thanks for your contribution! @LaPepega

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Missing properties in api response for DiscordChannel
4 participants