Table of Contents

Class AccountLinkingService

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

Manages Discord-to-game account linking via verification codes. Users request a link with a character name, receive a code, type it in-game, and the polling service confirms the link when the code appears in chat.

public sealed class AccountLinkingService : IDisposable
Inheritance
AccountLinkingService
Implements
Inherited Members

Constructors

AccountLinkingService(BotConfigurationService, ILogger<AccountLinkingService>)

Initializes a new instance of the AccountLinkingService class.

public AccountLinkingService(BotConfigurationService botConfigService, ILogger<AccountLinkingService> logger)

Parameters

botConfigService BotConfigurationService
logger ILogger<AccountLinkingService>

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetLinkedAccount(ulong)

Gets the linked account for a Discord user, if any.

public LinkedAccount? GetLinkedAccount(ulong discordUserId)

Parameters

discordUserId ulong

Returns

LinkedAccount

HasPendingVerification(ulong)

Checks if a Discord user has a pending verification.

public bool HasPendingVerification(ulong discordUserId)

Parameters

discordUserId ulong

Returns

bool

StartLinkRequest(ulong, string)

Starts a link request for the given Discord user and character name. Returns the verification code the user must type in-game.

public string? StartLinkRequest(ulong discordUserId, string characterName)

Parameters

discordUserId ulong

The Discord user ID.

characterName string

The character name claimed by the user.

Returns

string

The verification code, or null if the user already has a linked account.

TryVerifyFromChat(string, string, string)

Checks whether a chat message from the game contains a pending verification code. If it matches, confirms the link and returns the associated Discord user ID.

public ulong? TryVerifyFromChat(string characterName, string accountName, string message)

Parameters

characterName string

The character name that sent the message.

accountName string

The game account name.

message string

The chat message content.

Returns

ulong?

The Discord user ID if verification succeeded; null otherwise.

Removes a linked account for the specified Discord user.

public bool Unlink(ulong discordUserId)

Parameters

discordUserId ulong

Returns

bool

True if the account was unlinked.