bugfix to null ID in user point tally

This commit is contained in:
Erik 2022-07-13 20:11:46 +03:00
parent ae8ce8eead
commit cb92b1eea0
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 8 additions and 5 deletions

View File

@ -342,11 +342,14 @@ class ModerationManager {
if (response.error) return response;
if (response.infraction.targetType === 'USER') {
response.infraction.totalPoints = await targetWrapper.totalPoints(guild, {
points, expiration, timestamp: response.infraction.timestamp, id: response.infraction.id
});
response.infraction.totalPoints = await targetWrapper.totalPoints(guild);
response.infraction.totalPoints += points;
}
return response.infraction.execute();
const result = await response.infraction.execute();
await targetWrapper.totalPoints(guild, {
points, expiration, timestamp: response.infraction.timestamp, id: response.infraction.id
});
return result;
}

View File

@ -24,7 +24,7 @@ class UserWrapper {
async fetchPoints(guild) {
let index = this._points[guild.id];
if (index) return index;
if (index) return Promise.resolve(index);
this._points[guild.id] = {
expirations: [],
points: 0