Skip to content

Commit

Permalink
use cleaned discord username
Browse files Browse the repository at this point in the history
  • Loading branch information
loukylor committed Dec 21, 2024
1 parent 763392f commit c1ba635
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions TrickFireDiscordBot/Services/RoleSyncer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
}
}

private async Task<DiscordMember?> SyncRoles(Page notionPage, bool dryRun = true)
{
DiscordMember? member = await GetMember(notionPage);
if (member is null)
private async Task<DiscordMember?> SyncRoles(Page notionPage, bool dryRun = true)
{
return null;
}
Console.WriteLine(JsonConvert.SerializeObject(notionPage, Formatting.Indented));

DiscordMember? member = await GetMember(notionPage);
if (member is null)
{
return null;
}

IEnumerable<DiscordRole> newRoles = await GetRoles(notionPage);
logger.LogInformation(member.DisplayName);
Expand All @@ -151,16 +153,14 @@ await member.ModifyAsync(model =>
await Task.Delay(1000);
}

Console.WriteLine(JsonConvert.SerializeObject(notionPage, Formatting.Indented));

return member;
}
return member;
}

private async Task<DiscordMember?> GetMember(Page notionPage)
{
// We want this to fail hard if something is wrong
string? username = (notionPage.Properties[options.Value.DiscordUsernamePropertyName]
as PhoneNumberPropertyValue)!.PhoneNumber;
private async Task<DiscordMember?> GetMember(Page notionPage)
{
// We want this to fail hard if something is wrong
string? username = (notionPage.Properties[options.Value.DiscordUsernamePropertyName]
as FormulaPropertyValue)!.Formula.String;

if (string.IsNullOrWhiteSpace(username))
{
Expand Down
2 changes: 1 addition & 1 deletion TrickFireDiscordBot/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"TeamsDatabaseId": "1301fd41-ff5b-81f2-8a91-f837f0ea28a4",
"TeamNamePropertyName": "Team name",
"MembersDatabaseId": "1301fd41-ff5b-817a-9a5d-fee3f7572db2",
"DiscordUsernamePropertyName": "Discord Username",
"DiscordUsernamePropertyName": "Cleaned Discord",
"ActivePropertyName": "Active?",
"ClubPositionsPropertyName": "Club Position(s)",
"TeamsPropertyName": "Teams",
Expand Down

0 comments on commit c1ba635

Please sign in to comment.