Skip to content

Commit

Permalink
Forgot to add savers
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasAunvik committed May 13, 2020
1 parent 96c7433 commit ada37fc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions AnimeListBot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ public async Task OnJoinedGuild(SocketGuild guild)

await _logger.Log("Updated guild count: " + _client.Guilds.Count);
await _dbl.UpdateStats(_client.Guilds.Count);
await db.SaveChangesAsync();
}

private async Task OnLeftGuild(SocketGuild arg)
Expand All @@ -214,6 +215,7 @@ private async Task OnLeftGuild(SocketGuild arg)

await _logger.Log("Updated guild count: " + _client.Guilds.Count);
await _dbl.UpdateStats(_client.Guilds.Count);
await db.SaveChangesAsync();
}

private async Task OnUserBanned(SocketUser arg1, SocketGuild arg2)
Expand All @@ -224,6 +226,7 @@ private async Task OnUserBanned(SocketUser arg1, SocketGuild arg2)
DiscordUser user = await db.GetUserById(arg1.Id);
user.Servers.RemoveAll(x => x.ServerId == arg2.Id.ToString());
}
await db.SaveChangesAsync();
}

private async Task OnUserLeft(SocketGuildUser arg)
Expand All @@ -234,6 +237,7 @@ private async Task OnUserLeft(SocketGuildUser arg)
DiscordUser user = await db.GetUserById(arg.Id);
user.Servers.RemoveAll(x => x.ServerId == arg.Guild.Id.ToString());
}
await db.SaveChangesAsync();
}

private async Task OnRoleUpdated(SocketRole arg1, SocketRole arg2)
Expand All @@ -242,20 +246,23 @@ private async Task OnRoleUpdated(SocketRole arg1, SocketRole arg2)
DiscordServer server = await db.GetServerById(arg2.Guild.Id);
server.UpdateGuildRoles();
server.ranks.UpdateRankPermission(arg2.Id, arg2.Permissions.RawValue);
await db.SaveChangesAsync();
}

private async Task OnRoleAdded(SocketRole arg1)
{
IDatabaseService db = _services.GetRequiredService<IDatabaseService>();
DiscordServer server = await db.GetServerById(arg1.Guild.Id);
server.UpdateGuildRoles();
await db.SaveChangesAsync();
}

private async Task OnRoleDeleted(SocketRole arg1)
{
IDatabaseService db = _services.GetRequiredService<IDatabaseService>();
DiscordServer server = await db.GetServerById(arg1.Guild.Id);
server.UpdateGuildRoles();
await db.SaveChangesAsync();
}

private Task OnReactionAdded(Cacheable<IUserMessage, ulong> arg1, ISocketMessageChannel arg2, SocketReaction arg3)
Expand Down

0 comments on commit ada37fc

Please sign in to comment.