gunnbr / GthxNetBot

3 stars 0 forks source link

GthxNetBot

This is the gthx IRC bot reimplemented in C# instead of the original python. The main reasons for this are :

TODO

Setup

Database

GthxNetBot supports both MariaDB and SQL Server. One of these must be installed with a database created for the bot and a user granted all permissions on the database.

Visual Studio

To use with Visual Studio, install Visual Studio with the following features enabled:

Then install the .NET 6 SDK

Command Line

Via Docker

Cloning the source

GthxNetBot uses a source subrepo, so when cloning to build, be sure use the --recurse-submodules when cloning: git clone --recurse-submodules https://github.com/gunnbr/GthxNetBot.git Or if you have cloned without doing this, the subrepo can be initialized by running:

git submodule update --init

Adding features

Modifying or adding features is done mainly in the Modules folder in the Gthx.Bot project. To add a new module, add a new .cs file here that implements IGthxModule, then implement the interface, following the pattern from the existing modules.

Building

Visual Studio

Use Ctrl-Shift-B or the Build->Build Solution menu item to build from Visual Studio

Command Line

dotnet build

Docker

To build and tag with docker, use

docker build -t gthxnetbot:latest .

Configuring

Edit appsettings.json before running or set environment variables before running

Running

Visual Studio

Use F5 to run through the debugger, Ctrl-F5 to run without the debugger or the Debug->Start Debugging menu item to run through Visual Studio

Command line

dotnet run

Or find the compiled executables in the bin/Debug/net6.0

Docker

To run with environment overrides and network access to localhost and automatic restart, use:

docker run -d --env-file ./gthx.env --network="host" --restart unless-stopped gthxnetbot:latest

If you have modified the appsettings.json or added environment variables to configure, then you can leave out the "--env-file ./gthx.env" part. Otherwise, copy "gthx.env.example" to "gthx.env" and edit it to suit your installation.

Then status can be monitored by way of the configured logging.