-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathReputationManager.cs
More file actions
28 lines (25 loc) · 829 Bytes
/
ReputationManager.cs
File metadata and controls
28 lines (25 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using CSharpAcademyBot.Services;
using DSharpPlus.Entities;
using DSharpPlus.EventArgs;
namespace CSharpAcademyBot;
public class ReputationManager
{
private readonly IAcademyService service;
public ReputationManager(IAcademyService service)
{
this.service = service;
}
public async Task UpdateUserReputation(DiscordChannel channel, DiscordUser discordUser, int delta)
{
// This is where we will be checking if the user has now met any role requirements.
service.UpdateUserReputation(discordUser, delta);
if (service.TryGetUserReputation(discordUser, out int rep))
{
await channel.SendMessageAsync($"{discordUser.Username}'s reputation is now {rep}.");
}
else
{
await channel.SendMessageAsync($"Something went wrong trying to fetch {discordUser.Username}'s reputation.");
}
}
}