-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start removing channel hiding/showing
- Loading branch information
1 parent
3f5a544
commit 90e9f1c
Showing
4 changed files
with
129 additions
and
269 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,56 @@ | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Accord.Bot.Helpers; | ||
using Remora.Commands.Attributes; | ||
using Remora.Discord.API.Abstractions.Rest; | ||
using Remora.Discord.Commands.Attributes; | ||
using Remora.Discord.Commands.Contexts; | ||
using Remora.Discord.Commands.Feedback.Services; | ||
using Remora.Results; | ||
|
||
namespace Accord.Bot.CommandGroups; | ||
|
||
// TODO: This needs to be enabled after more extensive testing | ||
|
||
[Group("nitro"), AutoConstructor] | ||
public partial class NitroBoosterCommandGroup : AccordCommandGroup | ||
{ | ||
private readonly FeedbackService _feedbackService; | ||
private readonly IDiscordRestGuildAPI _guildApi; | ||
private readonly ICommandContext _commandContext; | ||
|
||
private const string NITRO_ROLE = "Nitro Booster"; | ||
private const string RANKED_NITRO_ROLE = "Ranked Nitro Booster"; | ||
|
||
[Command("apply"), Description("Applies Ranked Nitro Booster role to your profile so you become all pink and special"), Ephemeral] | ||
public async Task<IResult> Apply() | ||
{ | ||
var proxy = _commandContext.GetCommandProxy(); | ||
|
||
var roles = await _guildApi.GetGuildRolesAsync(proxy.GuildId); | ||
|
||
if (roles.IsSuccess && roles.Entity.Any(x => x.Name == RANKED_NITRO_ROLE)) | ||
{ | ||
var role = roles.Entity.Single(x => x.Name == RANKED_NITRO_ROLE); | ||
await _guildApi.AddGuildMemberRoleAsync(proxy.GuildId, proxy.UserId, role.ID); | ||
} | ||
|
||
return await _feedbackService.SendContextualAsync("Applied!"); | ||
} | ||
|
||
[Command("remove"), Description("Removes Ranked Nitro Booster role from your profile so you go back to your default role colour"), Ephemeral] | ||
public async Task<IResult> Remove() | ||
{ | ||
var proxy = _commandContext.GetCommandProxy(); | ||
var roles = await _guildApi.GetGuildRolesAsync(proxy.GuildId); | ||
|
||
if (roles.IsSuccess && roles.Entity.Any(x => x.Name == RANKED_NITRO_ROLE)) | ||
{ | ||
var role = roles.Entity.Single(x => x.Name == RANKED_NITRO_ROLE); | ||
await _guildApi.RemoveGuildMemberRoleAsync(proxy.GuildId, proxy.UserId, role.ID); | ||
} | ||
|
||
return await _feedbackService.SendContextualAsync("Removed!"); | ||
} | ||
} |
Oops, something went wrong.