# Class ModerationController | EchoHub Documentation

# Class ModerationController

Namespace
  EchoHub.Server.Controllers

Assembly
  EchoHub.Server.dll

    [ApiController]
    [Route("api/moderation")]
    [Authorize]
    [EnableRateLimiting("general")]
    public class ModerationController : ControllerBase

Inheritance
  object
  ControllerBase
  ModerationController

Inherited Members
  object.GetType()
  object.MemberwiseClone()
  object.ToString()
  object.Equals(object)
  object.Equals(object, object)
  object.ReferenceEquals(object, object)
  object.GetHashCode()

## Constructors

### ModerationController(EchoHubDbContext, IChatService, PresenceTracker, FileStorageService, IEnumerable<IChatBroadcaster>, ServerStatsCollector, ILogger<ModerationController>)

    public ModerationController(EchoHubDbContext db, IChatService chatService, PresenceTracker presenceTracker, FileStorageService fileStorage, IEnumerable<IChatBroadcaster> broadcasters, ServerStatsCollector statsCollector, ILogger<ModerationController> logger)

#### Parameters

`db` EchoHubDbContext
`chatService` IChatService
`presenceTracker` PresenceTracker
`fileStorage` FileStorageService
`broadcasters` IEnumerable<IChatBroadcaster>
`statsCollector` ServerStatsCollector
`logger` ILogger<ModerationController>

## Methods

### AssignRole(AssignRoleRequest)

    [HttpPost("role")]
    public Task<IActionResult> AssignRole(AssignRoleRequest request)

#### Parameters

`request` AssignRoleRequest

#### Returns

Task<IActionResult>

### BanUser(string, BanRequest?)

    [HttpPost("ban/{username}")]
    public Task<IActionResult> BanUser(string username, BanRequest? request = null)

#### Parameters

`username` string
`request` BanRequest

#### Returns

Task<IActionResult>

### DeleteMessage(Guid)

    [HttpDelete("messages/{messageId:guid}")]
    public Task<IActionResult> DeleteMessage(Guid messageId)

#### Parameters

`messageId` Guid

#### Returns

Task<IActionResult>

### KickUser(string, KickRequest?)

    [HttpPost("kick/{username}")]
    public Task<IActionResult> KickUser(string username, KickRequest? request = null)

#### Parameters

`username` string
`request` KickRequest

#### Returns

Task<IActionResult>

### MuteUser(string, MuteRequest?)

    [HttpPost("mute/{username}")]
    public Task<IActionResult> MuteUser(string username, MuteRequest? request = null)

#### Parameters

`username` string
`request` MuteRequest

#### Returns

Task<IActionResult>

### NukeChannel(string)

    [HttpDelete("channels/{channel}/nuke")]
    public Task<IActionResult> NukeChannel(string channel)

#### Parameters

`channel` string

#### Returns

Task<IActionResult>

### UnbanUser(string)

    [HttpPost("unban/{username}")]
    public Task<IActionResult> UnbanUser(string username)

#### Parameters

`username` string

#### Returns

Task<IActionResult>

### UnmuteUser(string)

    [HttpPost("unmute/{username}")]
    public Task<IActionResult> UnmuteUser(string username)

#### Parameters

`username` string

#### Returns

Task<IActionResult>