Table of Contents

Class BotConfigurationService

Namespace
FishMMO.DiscordBot.Services
Assembly
FishMMO-DiscordBot.dll

Manages loading and saving of persistent bot configuration, including the dynamic channel states mapping and persistent bot data (linked accounts, bridge bans, muted zones). All inner dictionaries use ConcurrentDictionary<TKey, TValue> for thread safety.

public class BotConfigurationService
Inheritance
BotConfigurationService
Inherited Members

Constructors

BotConfigurationService(ILogger<BotConfigurationService>)

Initializes a new instance of the BotConfigurationService class.

public BotConfigurationService(ILogger<BotConfigurationService> logger)

Parameters

logger ILogger<BotConfigurationService>

Logger instance.

Methods

LoadConfigurationsAsync()

Loads dynamic channel state from the JSON configuration file on disk. If the file does not exist or is invalid, starts with an empty state.

public Task LoadConfigurationsAsync()

Returns

Task

SaveConfigurationsAsync()

Persists the current dynamic channel state to the JSON configuration file. Uses atomic write-to-temp-then-rename to prevent corruption on crash.

public Task SaveConfigurationsAsync()

Returns

Task

SavePersistentDataAsync()

Saves the persistent bot data to disk.

public Task SavePersistentDataAsync()

Returns

Task

UpdateDynamicChannelState(ulong, long, long, DynamicGameChatChannelState)

Updates or inserts a channel state entry for the given guild/world/scene combination. Thread-safe for concurrent access from multiple services.

public void UpdateDynamicChannelState(ulong guildId, long worldServerId, long sceneServerId, DynamicGameChatChannelState state)

Parameters

guildId ulong

The Discord guild ID.

worldServerId long

The game world server ID.

sceneServerId long

The game scene server ID.

state DynamicGameChatChannelState

The channel state to store.