Skip to content

Commit

Permalink
Use lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
Pythonic-Rainbow committed Mar 18, 2024
1 parent 07d939b commit 66060b3
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Bot/Discord/Dc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,19 @@ static string ProcessViolator(Violator v)
private static async Task DonationsChangedAsync(IEnumerable<Tuple<string, int>> donDelta, IEnumerable<Tuple<string, int>> recDelta)
{
string msg = "[DNT] ";
string[] donItems = new string[donDelta.Count()];
for (int i = 0; i < donDelta.Count(); i++)
msg += string.Join(", ", donDelta.Select(t =>
{
(string tag, int donated) = donDelta.ElementAt(i);
(string tag, int donated) = t;
string name = Coc.GetMember(tag).Name;
donItems[i] = $"{name}: {donated}";
}
msg += string.Join(", ", donItems);
return $"{name}: {donated}";
}));
msg += "\n=> ";
string[] recItems = new string[recDelta.Count()];
for (int i = 0; i < recDelta.Count(); i++)
msg += string.Join(", ", recDelta.Select(t =>
{
(string tag, int received) = recDelta.ElementAt(i);
(string tag, int received) = t;
string name = Coc.GetMember(tag).Name;
recItems[i] = $"{name}: {received}";
}
msg += string.Join(", ", recItems);
return $"{name}: {received}";
}));
await s_botLog.SendMessageAsync(msg);
}

Expand Down

0 comments on commit 66060b3

Please sign in to comment.