Skip to content

Commit

Permalink
karma for non-ping replies maybe?
Browse files Browse the repository at this point in the history
  • Loading branch information
RheaAyase committed Jul 11, 2024
1 parent 6bda4b8 commit 9be47fb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Modules/Karma.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ private async Task OnMessageReceived(SocketMessage message)
{
UserData userData = dbContext.GetOrAddUser(server.Id, user.Id);
IEnumerable<UserData> mentionedUserData = message.MentionedUsers.Select(u => dbContext.GetOrAddUser(server.Id, u.Id));
if( message.Reference != null && message.Reference.MessageId.IsSpecified )
{
SocketUser referenceAuthor = channel.GetCachedMessage(message.Reference.MessageId.Value)?.Author;
if( referenceAuthor != null )
mentionedUserData = mentionedUserData.Append(dbContext.GetOrAddUser(server.Id, referenceAuthor.Id));
}
int count = mentionedUserData.Count();

if( (count > server.Config.KarmaLimitMentions || userData.LastThanksTime.AddMinutes(server.Config.KarmaLimitMinutes) > DateTimeOffset.UtcNow) )
Expand Down

0 comments on commit 9be47fb

Please sign in to comment.