Skip to content

Commit

Permalink
Add support for adding a verified role
Browse files Browse the repository at this point in the history
  • Loading branch information
Pasi4K5 committed Mar 25, 2024
1 parent cbe749f commit dcb55c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions Numerous/ApiClients/Osu/OsuUserGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Numerous.ApiClients.Osu;

public enum OsuUserGroup
{
[UsedImplicitly] [ChoiceDisplay("Verified")] Verified = 0,
[UsedImplicitly] [ChoiceDisplay("Unranked Mapper")] UnrankedMapper = -1,
[UsedImplicitly] [ChoiceDisplay("Ranked Mapper")] RankedMapper = -2,
[UsedImplicitly] [ChoiceDisplay("Loved Mapper")] LovedMapper = -3,
Expand Down
5 changes: 3 additions & 2 deletions Numerous/Discord/OsuVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,15 @@ await db.GuildOptions.UpdateOneAsync(
private async Task AssignRolesAsync(IGuildUser guildUser)
{
var osuUser = await GetOsuUserAsync(guildUser);
var guildConfig = await (await db.GuildOptions.FindAsync(x => x.Id == guildUser.GuildId)).SingleAsync();

await AssignRoleAsync(OsuUserGroup.Verified, osuUser is not null);

if (osuUser is null)
{
return;
}

var guildConfig = await (await db.GuildOptions.FindAsync(x => x.Id == guildUser.GuildId)).SingleAsync();

foreach (var osuRole in guildConfig.OsuRoles.Where(osuRole => osuRole.Group > 0))
{
var role = guildUser.Guild.GetRole(osuRole.RoleId);
Expand Down

0 comments on commit dcb55c0

Please sign in to comment.