Files
EventDiscordBot/EventBot/Entities/EventRole.cs
Karolis2011 e9f59780ed Adds role specific channels.
Read ME update

Updating tile of role will update revelant channels and roles.

Added command examples.

Fixese leaks
2019-08-01 20:25:28 +03:00

40 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using System.Text.RegularExpressions;
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 ulong ChannelId { get; set; }
public ulong RoleId { 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 string ChannelName => Regex.Replace(Title.Replace(' ', '-'), "(?!\\w)", "");
public int SortNumber
{
get
{
if (MaxParticipants < 0) return int.MaxValue;
return MaxParticipants;
}
}
}
}