Skip to content

Commit

Permalink
feat: add suggester member to thread
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Jul 24, 2023
1 parent 944de32 commit 0d06ff8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.5.1] - 2023-07-24

### Added

- The user who posted the suggestion is now automatically added to the suggestion thread.

## [1.5.0] - 2023-07-24

### Added
Expand Down Expand Up @@ -86,6 +92,7 @@ implemented, accepted, or rejected.

- Initial release.

[1.5.1]: https://github.com/BrackeysBot/SuggestionBot/releases/tag/v1.5.1
[1.5.0]: https://github.com/BrackeysBot/SuggestionBot/releases/tag/v1.5.0
[1.4.0]: https://github.com/BrackeysBot/SuggestionBot/releases/tag/v1.4.0
[1.3.2]: https://github.com/BrackeysBot/SuggestionBot/releases/tag/v1.3.2
Expand Down
11 changes: 10 additions & 1 deletion SuggestionBot/Services/SuggestionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,17 @@ public Uri GetSuggestionLink(Suggestion suggestion)
if (configuration.CreateThreadForSuggestion)
{
const AutoArchiveDuration archiveDuration = AutoArchiveDuration.Week;
var threadName = $"Suggestion from {GetAuthor(suggestion).GetUsernameWithDiscriminator()}";

DiscordUser author = GetAuthor(suggestion);
var threadName = $"Suggestion from {author.GetUsernameWithDiscriminator()}";
var thread = await message.CreateThreadAsync(threadName, archiveDuration).ConfigureAwait(false);

DiscordMember? member = await author.GetAsMemberOfAsync(guild);
if (member is not null)
{
await thread.AddThreadMemberAsync(member).ConfigureAwait(false);
}

SetThread(suggestion, thread);
}

Expand Down

0 comments on commit 0d06ff8

Please sign in to comment.