spellfixes
This commit is contained in:
@@ -15,7 +15,7 @@ namespace EventBot.Misc
|
|||||||
{
|
{
|
||||||
var database = services.GetRequiredService<DatabaseService>();
|
var database = services.GetRequiredService<DatabaseService>();
|
||||||
if (context.Guild == null)
|
if (context.Guild == null)
|
||||||
return Task.FromResult(TypeReaderResult.FromError(CommandError.UnmetPrecondition, "Event roles are avaivable only inside guild context."));
|
return Task.FromResult(TypeReaderResult.FromError(CommandError.UnmetPrecondition, "Event roles are available only inside guild context."));
|
||||||
EventRole er = null;
|
EventRole er = null;
|
||||||
if (int.TryParse(input, out int id))
|
if (int.TryParse(input, out int id))
|
||||||
er = database.EventRoles.FirstOrDefault(r => r.Id == id);
|
er = database.EventRoles.FirstOrDefault(r => r.Id == id);
|
||||||
|
@@ -15,7 +15,7 @@ namespace EventBot.Misc
|
|||||||
{
|
{
|
||||||
var events = services.GetRequiredService<EventManagementService>();
|
var events = services.GetRequiredService<EventManagementService>();
|
||||||
if (context.Guild == null)
|
if (context.Guild == null)
|
||||||
return Task.FromResult(TypeReaderResult.FromError(CommandError.UnmetPrecondition, "Events are avaivable only inside guild context."));
|
return Task.FromResult(TypeReaderResult.FromError(CommandError.UnmetPrecondition, "Events are available only inside guild context."));
|
||||||
Event ev;
|
Event ev;
|
||||||
if (input == null)
|
if (input == null)
|
||||||
ev = events.FindEventBy(context.Guild, true);
|
ev = events.FindEventBy(context.Guild, true);
|
||||||
|
@@ -30,9 +30,9 @@ namespace EventBot.Services
|
|||||||
public async Task TryJoinEvent(IGuildUser user, EventRole er, string extra, bool extraChecks = true)
|
public async Task TryJoinEvent(IGuildUser user, EventRole er, string extra, bool extraChecks = true)
|
||||||
{
|
{
|
||||||
if (er.Event.GuildId != user.GuildId)
|
if (er.Event.GuildId != user.GuildId)
|
||||||
throw new Exception("Cross guild events are fobidden.");
|
throw new Exception("Cross guild events are forbidden.");
|
||||||
if (extraChecks && er.ReamainingOpenings <= 0)
|
if (extraChecks && er.ReamainingOpenings <= 0)
|
||||||
throw new Exception("No openings left.");
|
throw new Exception("No openings are left.");
|
||||||
if(er.Event.Participants.Where(p => p.UserId == user.Id).Count() > 0)
|
if(er.Event.Participants.Where(p => p.UserId == user.Id).Count() > 0)
|
||||||
throw new Exception("You are already participating.");
|
throw new Exception("You are already participating.");
|
||||||
if(extraChecks && !er.Event.Active)
|
if(extraChecks && !er.Event.Active)
|
||||||
@@ -95,12 +95,12 @@ namespace EventBot.Services
|
|||||||
if (@event.Type == Event.EventParticipactionType.Quick)
|
if (@event.Type == Event.EventParticipactionType.Quick)
|
||||||
embed.Description += "\r\nTo participate in this event react with following emotes:";
|
embed.Description += "\r\nTo participate in this event react with following emotes:";
|
||||||
if (@event.Type == Event.EventParticipactionType.Detailed)
|
if (@event.Type == Event.EventParticipactionType.Detailed)
|
||||||
embed.Description += "\r\nTo participate in this event use command `join <emote or id> <extra information>` as following emotes are awaivable:";
|
embed.Description += "\r\nTo participate in this event use command `join <emote or id> <extra information>` as following emotes are available:";
|
||||||
|
|
||||||
embed.WithFields(@event.Roles
|
embed.WithFields(@event.Roles
|
||||||
.OrderBy(e => e.SortNumber)
|
.OrderBy(e => e.SortNumber)
|
||||||
.Select(e => new EmbedFieldBuilder()
|
.Select(e => new EmbedFieldBuilder()
|
||||||
.WithName($"{e.Emote} `{e.Id}`: *{e.Title}*`{ (e.MaxParticipants > 0 ? $" - {e.ReamainingOpenings} ramaining" : "")} - {e.ParticipantCount} participating.`")
|
.WithName($"{e.Emote} `{e.Id}`: *{e.Title}*`{ (e.MaxParticipants > 0 ? $" - {e.ReamainingOpenings} remaining" : "")} - {e.ParticipantCount} participating.`")
|
||||||
.WithValue($"{e.Description}")
|
.WithValue($"{e.Description}")
|
||||||
));
|
));
|
||||||
return embed;
|
return embed;
|
||||||
@@ -141,7 +141,7 @@ namespace EventBot.Services
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (reaction.User.IsSpecified)
|
if (reaction.User.IsSpecified)
|
||||||
await reaction.User.Value.SendMessageAsync($"Error ocured while processing your reaction: \r\n{ex.GetType()}: {ex.Message}");
|
await reaction.User.Value.SendMessageAsync($"Error occured while processing your reaction: \r\n{ex.GetType()}: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user