-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from minisbett/master
release: version 2.2.0
- Loading branch information
Showing
15 changed files
with
254 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# These are supported funding model platforms | ||
|
||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: minisbett | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
polar: # Replace with a single Polar username | ||
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using Discord; | ||
using Discord.Interactions; | ||
using Discord.WebSocket; | ||
using huisbot.Models.Huis; | ||
using huisbot.Models.Osu; | ||
using huisbot.Models.Persistence; | ||
using huisbot.Services; | ||
using huisbot.Utilities.Discord; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net.Http.Headers; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace huisbot.Modules.Huis; | ||
|
||
public class FeedbackCommandModule : ModuleBase | ||
{ | ||
public FeedbackCommandModule(HuisApiService huis) : base(huis) { } | ||
|
||
[SlashCommand("feedback", "Feedback")] | ||
public async Task HandleAsync( | ||
[Summary("rework", "An identifier for the rework. This can be it's ID, internal code or autocompleted name.")] | ||
[Autocomplete(typeof(ReworkAutocompleteHandler))] string reworkId) | ||
{ | ||
// Get the specified rework. | ||
HuisRework? rework = await GetReworkAsync(reworkId); | ||
if (rework is null) | ||
return; | ||
|
||
// Make sure the rework is eligible. | ||
if(rework.IsLive || !rework.IsActive || rework.IsHistoric || rework.IsConfirmed) | ||
{ | ||
await RespondAsync(embed: Embeds.Error("The specified rework cannot receive feedback.")); | ||
return; | ||
} | ||
|
||
// Build the modal and respond. | ||
await RespondWithModalAsync<FeedbackModal>($"pp_feedback_{rework.Id}"); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// The interaction module for the "rework" select menu from the <see cref="ReworksCommandModule"/> command. | ||
/// </summary> | ||
public class FeedbackModalModule : ModuleBase | ||
{ | ||
public FeedbackModalModule(HuisApiService huis) : base(huis) { } | ||
|
||
[ModalInteraction("pp_feedback_.*", TreatAsRegex = true)] | ||
public async Task HandleAsync(FeedbackModal modal) | ||
{ | ||
await DeferAsync(); | ||
|
||
// Get the rework from it's ID. | ||
HuisRework? rework = await GetReworkAsync(((SocketModal)Context.Interaction).Data.CustomId.Substring(12) /* pp_feedback_<rework ID> */); | ||
if (rework is null) | ||
return; | ||
|
||
#if DEVELOPMENT || CUTTING_EDGE | ||
// In development or cutting edge mode, always send the feedback into the same channel. | ||
ISocketMessageChannel channel = Context.Channel; | ||
#else | ||
// Get the PP Discord feedback channel. (WIP, other temp channel for now) | ||
ISocketMessageChannel channel = Context.Client.GetGuild(1166126757141827775).GetTextChannel(1264243048821293105); | ||
#endif | ||
|
||
// Respond to the user and send the feedback in the feedback channel. | ||
await FollowupAsync(embed: Embeds.Success("Your feedback was submitted.")); | ||
await channel.SendMessageAsync(embed: Embeds.Feedback(Context.User, rework, modal.FeebackText)); | ||
} | ||
} | ||
|
||
public class FeedbackModal : IModal | ||
{ | ||
public string Title => "PP Feedback Form"; | ||
|
||
/// <summary> | ||
/// The text of the feedback. | ||
/// </summary> | ||
[InputLabel("Feedback")] | ||
[ModalTextInput("text", TextInputStyle.Paragraph, "Type your feedback here... NOTE: The feedback is NOT anonymous, and publically visible.", 200)] | ||
public required string FeebackText { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.