Inital bot commit
This commit is contained in:
44
EventBot/Entities/Event.cs
Normal file
44
EventBot/Entities/Event.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
|
||||
namespace EventBot.Entities
|
||||
{
|
||||
public class Event
|
||||
{
|
||||
public Event()
|
||||
{
|
||||
Active = true;
|
||||
Opened = DateTime.Now;
|
||||
}
|
||||
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public bool Active { get; set; }
|
||||
public ulong MessageId { get; set; }
|
||||
public ulong MessageChannelId { get; set; }
|
||||
public virtual ICollection<EventRole> Roles { get; set; }
|
||||
public virtual ICollection<EventParticipant> Participants { get; set; }
|
||||
public int ParticipantCount => Participants == null ? 0 : Participants.Count;
|
||||
public DateTime Opened { get; set; }
|
||||
public virtual EventParticipactionType Type { get; set; }
|
||||
public ulong GuildId { get; set; }
|
||||
[ForeignKey("GuildId")]
|
||||
public virtual GuildConfig Guild { get; set; }
|
||||
public int RemainingOpenings => Roles.Sum(r => r.ReamainingOpenings);
|
||||
|
||||
public enum EventParticipactionType
|
||||
{
|
||||
Unspecified = -1,
|
||||
Quick,
|
||||
Detailed
|
||||
}
|
||||
|
||||
}
|
||||
}
|
24
EventBot/Entities/EventParticipant.cs
Normal file
24
EventBot/Entities/EventParticipant.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace EventBot.Entities
|
||||
{
|
||||
public class EventParticipant
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int EventRoleId { get; set; }
|
||||
[ForeignKey("EventRoleId")]
|
||||
public virtual EventRole Role { get; set; }
|
||||
public int EventId { get; set; }
|
||||
[ForeignKey("EventId")]
|
||||
public virtual Event Event { get; set; }
|
||||
public ulong UserId { get; set; }
|
||||
public string UserData { get; set; }
|
||||
}
|
||||
}
|
34
EventBot/Entities/EventRole.cs
Normal file
34
EventBot/Entities/EventRole.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace EventBot.Entities
|
||||
{
|
||||
public class EventRole
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Emote { get; set; }
|
||||
public int MaxParticipants { get; set; }
|
||||
public int EventId { get; set; }
|
||||
[ForeignKey("EventId")]
|
||||
public virtual Event Event { get; set; }
|
||||
public virtual ICollection<EventParticipant> Participants { get; set; }
|
||||
public int ParticipantCount => Participants == null ? 0 : Participants.Count;
|
||||
public int ReamainingOpenings => MaxParticipants < 0 ? 1 : MaxParticipants - ParticipantCount;
|
||||
|
||||
public int SortNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MaxParticipants < 0) return int.MaxValue;
|
||||
return MaxParticipants;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
18
EventBot/Entities/GuildConfig.cs
Normal file
18
EventBot/Entities/GuildConfig.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
|
||||
namespace EventBot.Entities
|
||||
{
|
||||
public class GuildConfig
|
||||
{
|
||||
[Key]
|
||||
public ulong GuildId { get; set; }
|
||||
public string Prefix { get; set; }
|
||||
public ulong EventRoleConfirmationChannelId { get; set; }
|
||||
public ulong ParticipantRoleId { get; set; }
|
||||
public virtual ICollection<Event> Events { get; set; }
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user