Workshop.DiscordBot 1.2.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Workshop.DiscordBot --version 1.2.0
NuGet\Install-Package Workshop.DiscordBot -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Workshop.DiscordBot" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Workshop.DiscordBot --version 1.2.0
#r "nuget: Workshop.DiscordBot, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Workshop.DiscordBot as a Cake Addin
#addin nuget:?package=Workshop.DiscordBot&version=1.2.0

// Install Workshop.DiscordBot as a Cake Tool
#tool nuget:?package=Workshop.DiscordBot&version=1.2.0

Build-A-Bot Workshop Build-A-Bot Workshop

Workshop.DiscordBot
The Build-A-Bot Workshop is a quick and easy way for you to get started building your own Discord Bot.
Getting your bot online is as simple as:

Imports Workshop.DiscordBot

Namespace VB.Example
    Module Program
        Sub Main(args As String())
            'Create an instance of DiscordBot. 
            'Provide the token file filename and a bot prefix.  
            Dim simpleBot = New DiscordBot(New BaseBotConfig("token.txt", "/"))
            
            'Start the bot! 
            simpleBot.StartAsync().GetAwaiter().GetResult() 'Log-in & connect to Discord
        End Sub
    End Module
End Namespace
using Workshop.DiscordBot;

namespace CSharp.Example
{
    class Program
    {
        private static void Main(string[] args)
        {
            //Create an instance of DiscordBot. 
            //Provide the token file filename and a bot prefix.
            //Call StartAsync to log-in and connect to Discord
            new DiscordBot(new BaseBotConfig("token.txt", "/")).StartAsync().GetAwaiter().GetResult();
        }
    }
}

Your bot is now onine and listening for commands (any message prefixed with /, for this example, or a bot mention).

NOTE!
This project uses the Discord.Net wrapper for interfacing with the Discord API.
So, it'll propbably be a good idea to get familiar with their documentation for actually creating your commands.
That said, there is a WorkshopModule that can be used to replace Discord.Net ModuleBase and extend the command module funcationality.

Getting Started

Installation

Release builds are available from Nuget

Initial Visual Studio Project

  • Create a new project (preferably a .Net Core Console Application)
  • Install the Workshop.DiscordBot nuget package via the Visual Studio Packet Manager
  • Follow the code snippet above to get connected
  • Profit?

Take a look at the Examples provided.
SampleBot_Basic should be enough to give you an idea of adding commands, services and custom typereaders (if needed).

Things to Note

Auto-magic management

  • Dependency Injection: An IServiceProvider is included for storing and retrieving services.
  • Adding Services: Classes decorated with the ServiceAttribute are automatically loaded into the ServiceCollection.
  • Initializing Services on Startup: The InitializeAttribute can be used to instantiate a service on startup (if necessary).
  • Adding Commands: The Discord.Net Command Service is the expected approach for creating commands.
    All modules tha inherit from either Discord.Net's ModuleBase or from WorkshopModule, are automatically loaded into the provided CommandService.
  • Registering Type Readers: Custom Type Readers should be decorated with the TypeReaderAttribute.
    This allows them to be automatically added to the CommandService.

Command Module Extension

The WorkshopModule overrides the ModuleBase provided by Discord.Net and includes additional helper methods for working with commands.
Utilizing the InteractiveService from Discord.Addon.Interactive, the WorkshopModule also assists with adding interactivity to your bot commands. Basic methods are provided for both interactive messages and interactive reactions. See the SampleBot_Interactive for usage examples.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated