Class ModerationModule
- Namespace
- FishMMO.DiscordBot.Modules
- Assembly
- FishMMO-DiscordBot.dll
Moderation commands for game server administration via Discord. Requires ManageGuild permission (moderator-level).
[Group("mod")]
[RequireUserPermission(GuildPermission.ManageGuild)]
public class ModerationModule : ModuleBase<SocketCommandContext>, IModuleBase
- Inheritance
-
ModuleBase<SocketCommandContext>ModerationModule
- Implements
-
IModuleBase
- Inherited Members
-
ModuleBase<SocketCommandContext>.BeforeExecuteAsync(CommandInfo)ModuleBase<SocketCommandContext>.BeforeExecute(CommandInfo)ModuleBase<SocketCommandContext>.AfterExecuteAsync(CommandInfo)ModuleBase<SocketCommandContext>.AfterExecute(CommandInfo)ModuleBase<SocketCommandContext>.OnModuleBuilding(CommandService, ModuleBuilder)ModuleBase<SocketCommandContext>.Context
Remarks
Kick, ban and unban act on game accounts, so they obey the game's rules, not Discord's. They used to write the account row directly: any holder of Discord's ManageGuild could ban or unban any account — an Admin's included — with no audit row, and the ban set the level alone, leaving the account's tokens and panel sessions live. Now:
-
The Discord user must be linked (
/link) to a game account at Game Master or above, and that account is the actor. The same guards the Control Panel and the in-game commands apply: not your own account, and not one at or above your own level. Two surfaces onto one capability must not disagree about who may use it, or the weaker one becomes the way round the stronger. -
The writes are the same service calls the panel makes —
BanAsyncis the level, the game tokens, the panel sessions and a kick request in one transaction. -
Every attempt by a resolved actor, refused or done, is written to the admin audit log with
source
discord. The typed command line is the reason, as it is for a chat command.
Constructors
ModerationModule(BridgeBanService, BotConfigurationService, AccountLinkingService, IAccountService, IKickRequestService, IAdminAuditService, ILogger<ModerationModule>)
public ModerationModule(BridgeBanService bridgeBanService, BotConfigurationService botConfigService, AccountLinkingService accountLinkingService, IAccountService accounts, IKickRequestService kickRequests, IAdminAuditService auditLog, ILogger<ModerationModule> logger)
Parameters
bridgeBanServiceBridgeBanServicebotConfigServiceBotConfigurationServiceaccountLinkingServiceAccountLinkingServiceaccountsIAccountServicekickRequestsIKickRequestServiceauditLogIAdminAuditServiceloggerILogger<ModerationModule>
Methods
BanAsync(string, string?)
Bans a game account: level, game tokens, panel sessions and a kick request, in one transaction.
[Command("ban")]
[Summary("Bans a game account (level, tokens, sessions and a kick, together). Needs your Discord linked to a Game Master account.")]
public Task BanAsync(string accountName, string? reason = null)
Parameters
Returns
BanBridgeAsync(string, string)
Bans a character or account from the Discord chat bridge. Messages from bridge-banned names are not forwarded in either direction.
[Command("ban-bridge")]
[Summary("Bans a character/account from the Discord-game chat bridge.")]
public Task BanBridgeAsync(string name, string reason = "No reason provided")
Parameters
Returns
KickAsync(string, string?)
Kicks a player by writing a kick request, which the game servers act on at their next poll.
[Command("kick")]
[Summary("Kicks a player from the game by account name. Needs your Discord linked to a Game Master account.")]
public Task KickAsync(string accountName, string? reason = null)
Parameters
Returns
ListBridgeBansAsync()
Lists all current bridge bans.
[Command("bridge-bans")]
[Summary("Lists all current bridge bans.")]
public Task ListBridgeBansAsync()
Returns
UnbanAsync(string, string?)
Lifts a ban, restoring Player. Revoked tokens and sessions stay revoked.
[Command("unban")]
[Summary("Unbans a game account (restores Player). Needs your Discord linked to a Game Master account.")]
public Task UnbanAsync(string accountName, string? reason = null)
Parameters
Returns
UnbanBridgeAsync(string)
Removes a bridge ban from a character or account.
[Command("unban-bridge")]
[Summary("Removes a bridge ban from a character/account.")]
public Task UnbanBridgeAsync(string name)
Parameters
namestring