Search Results for

    Show / Hide Table of Contents

    Class DiscordHostedService

    Simple implementation for DiscordClient to work as a Microsoft.Extensions.Hosting.BackgroundService

    Inheritance
    System.Object
    Microsoft.Extensions.Hosting.BackgroundService
    BaseHostedService
    DiscordHostedService
    Implements
    IDiscordHostedService
    Microsoft.Extensions.Hosting.IHostedService
    Inherited Members
    BaseHostedService.Logger
    BaseHostedService.ApplicationLifetime
    BaseHostedService.Configuration
    BaseHostedService.ServiceProvider
    BaseHostedService.BotSection
    BaseHostedService.OnInitializationError(Exception)
    BaseHostedService.InitializeExtensions(DiscordClient)
    BaseHostedService.PreConnectAsync()
    BaseHostedService.PostConnectAsync()
    BaseHostedService.ExecuteAsync(CancellationToken)
    Microsoft.Extensions.Hosting.BackgroundService.StartAsync(System.Threading.CancellationToken)
    Microsoft.Extensions.Hosting.BackgroundService.StopAsync(System.Threading.CancellationToken)
    Microsoft.Extensions.Hosting.BackgroundService.Dispose()
    Microsoft.Extensions.Hosting.BackgroundService.ExecuteTask
    Namespace: DisCatSharp.Hosting
    Assembly: DisCatSharp.Hosting.dll
    Syntax
    public abstract class DiscordHostedService : BaseHostedService, IDisposable, IDiscordHostedService, IHostedService

    Constructors

    | Improve this Doc View Source

    DiscordHostedService(IConfiguration, ILogger<DiscordHostedService>, IServiceProvider, IHostApplicationLifetime, String)

    Initializes a new instance of the DiscordHostedService class.

    Declaration
    protected DiscordHostedService(IConfiguration config, ILogger<DiscordHostedService> logger, IServiceProvider serviceProvider, IHostApplicationLifetime applicationLifetime, string configBotSection = "DisCatSharp")
    Parameters
    Type Name Description
    Microsoft.Extensions.Configuration.IConfiguration config

    IConfiguration provided via Dependency Injection. Aggregate method to access configuration files

    Microsoft.Extensions.Logging.ILogger<DiscordHostedService> logger

    An ILogger to work with, provided via Dependency Injection

    System.IServiceProvider serviceProvider

    ServiceProvider reference which contains all items currently registered for Dependency Injection

    Microsoft.Extensions.Hosting.IHostApplicationLifetime applicationLifetime

    Contains the appropriate methods for disposing / stopping BackgroundServices during runtime

    System.String configBotSection

    The name of the JSON/Config Key which contains the configuration for this Discord Service

    Properties

    | Improve this Doc View Source

    Client

    Reference to connected client

    Declaration
    public DiscordClient Client { get; protected set; }
    Property Value
    Type Description
    DiscordClient

    Methods

    | Improve this Doc View Source

    ConfigureAsync()

    Declaration
    protected override Task ConfigureAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    BaseHostedService.ConfigureAsync()
    | Improve this Doc View Source

    ConfigureExtensionsAsync()

    Declaration
    protected override Task ConfigureExtensionsAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    BaseHostedService.ConfigureExtensionsAsync()
    | Improve this Doc View Source

    ConnectAsync()

    Declaration
    protected sealed override async Task ConnectAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    BaseHostedService.ConnectAsync()

    Implements

    IDiscordHostedService
    Microsoft.Extensions.Hosting.IHostedService

    Extension Methods

    ReflectionUtilities.ToDictionary<T>(T)
    • Improve this Doc
    • View Source
    In This Article
    Back to top © 2021-2022 Aiko IT Systems