forked from Galactic/galactic-bot
bugfix to null ID in user point tally
This commit is contained in:
parent
ae8ce8eead
commit
cb92b1eea0
@ -342,11 +342,14 @@ class ModerationManager {
|
|||||||
if (response.error) return response;
|
if (response.error) return response;
|
||||||
|
|
||||||
if (response.infraction.targetType === 'USER') {
|
if (response.infraction.targetType === 'USER') {
|
||||||
response.infraction.totalPoints = await targetWrapper.totalPoints(guild, {
|
response.infraction.totalPoints = await targetWrapper.totalPoints(guild);
|
||||||
points, expiration, timestamp: response.infraction.timestamp, id: response.infraction.id
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class UserWrapper {
|
|||||||
|
|
||||||
async fetchPoints(guild) {
|
async fetchPoints(guild) {
|
||||||
let index = this._points[guild.id];
|
let index = this._points[guild.id];
|
||||||
if (index) return index;
|
if (index) return Promise.resolve(index);
|
||||||
this._points[guild.id] = {
|
this._points[guild.id] = {
|
||||||
expirations: [],
|
expirations: [],
|
||||||
points: 0
|
points: 0
|
||||||
|
Loading…
Reference in New Issue
Block a user