Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fluxter/Fluxter.ThreadedBotManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fluxter.ThreadedBotManager

The ThreadedBotManager is used to start and stop bots.

It will automatically spawn threads for each bot

How to use it

Create a Bot Class

namespace YourApp.Model
{
    using Fluxter.ThreadedBotManager;

    class MyBot : IBot
    {
        public string BotId { get; } 

        public void Run()
        {
            // Run your bot endlessly
        }
    }
}

Create a basic BotManager and extend from ThreadedBotManager like so

namespace YourApp
{
    using Fluxter.ThreadedBotManager;
    using System.Collections.Generic;
    using Fluxter.ThreadedBotManager;
    using Fluxter.ThreadedBotManager.Model.EventArgs;

    class MyBotManager : ThreadedBotManager<MyBot>
    {
        public BotManager()
        {
            this.BotPendingStopResolved += this.OnBotPendingStopResolved;
            this.BotStop += this.OnBotStop;
            this.BotStart += this.OnBotStart;
        }

        protected override T GetBotById(string botId)
        {
            throw new Exception("Please overwrite this method!");
        }

        protected override IEnumerable<string> GetAllBotIds()
        {
            throw new Exception("Please overwrite this method!");
        }

        protected override IEnumerable<string> GetBotIdsToStop()
        {
            throw new Exception("Please overwrite this method!");
        }

        private void OnBotStart(OnBotStartEventArgs args)
        {
        }

        private void OnBotStop(OnBotStopEventArgs args)
        {
        }
        
        private void OnBotPendingStopResolved(OnBotStopEventArgs args)
        {
        }
    }
}

Logging

The Bot Manager uses Nlog to log everything

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published