[Activity] Add full check
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Cocotte.Modules.Activities;
|
||||
/// </summary>
|
||||
[Group("activite", "Organise des activités")]
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public class ActivityModule : InteractionModuleBase<SocketInteractionContext>
|
||||
public partial class ActivityModule : InteractionModuleBase<SocketInteractionContext>
|
||||
{
|
||||
private readonly ILogger<ActivityModule> _logger;
|
||||
private readonly ActivityOptions _options;
|
||||
@@ -129,6 +129,17 @@ public class ActivityModule : InteractionModuleBase<SocketInteractionContext>
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if activity is full
|
||||
if (await _activitiesRepository.ActivityPlayerCount(activity) >= activity.MaxPlayers)
|
||||
{
|
||||
await RespondAsync(
|
||||
ephemeral: true,
|
||||
embed: EmbedUtils.ErrorEmbed("L'activité est complète").Build()
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogTrace("Player {Player} joined activity {Id}", user.DisplayName, activityId);
|
||||
|
||||
var roles = _activityHelper.GetPlayerRoles(user.Roles);
|
||||
|
||||
Reference in New Issue
Block a user