Beispiel #1
0
 public Vote(Voteban voteban, User user, bool ban)
 {
     this.DateTime = DateTime.UtcNow;
     this.Voteban  = voteban;
     this.UserId   = user.Id;
     this.User     = user.Name;
     this.NeedBan  = ban;
 }
Beispiel #2
0
        public async static Task <Voteban> Create(CommandParameters command)
        {
            var voteban = new Voteban();

            voteban.Callback  = Guid.NewGuid().ToString();
            voteban.DateTime  = DateTime.UtcNow;
            voteban.TeamId    = command.Team_id;
            voteban.ChannelId = command.Channel_id;
            voteban.AuthorId  = command.User_id;
            voteban.Author    = command.User_name;

            if (command.Channel_name == "directmessage")
            {
                throw new ArgumentException("Voteban only for channel", nameof(command.Channel_name));
            }

            var user = await command.GetUserFromText();

            voteban.UserId = user.id;
            voteban.User   = user.name;
            return(voteban);
        }