TrueVote.Bot - DEPRECATED. All functionality moved to TrueVote.Comms
TrueVote.Bot is an implementation of interacting with the TrueVote Voting Suite of Applications via bots. It's deployed as an Azure Functions project.
The main technology stack platform is .NET Core 9.0.
- Install Visual Studio 2022 (preview) or later, or Visual Studio Code. Ensure that
$ dotnet --versionis at least 9.0.
Telegram is the first bot implemented. Additional Bot frameworks will be added in the future.
Create a new file at the root of the TrueVote.Bot project named local.settings.json. To use the functions of the Telegram Bot locally, create a new Bot using 'BotFather' and place the key in the local.settings.json file.
Get the ServiceBusConnectionString from Azure portal. Currently Service Bus is not available to run locally.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"BaseApiUrl": "https://localhost:7253/api",
"TelegramBotKey": "<TelegramBotKey>",
"TelegramRuntimeChannel": "TrueVote_Api_Runtime_Channel_Dev",
"ServiceBusConnectionString": "<ServiceBusConnectionString>",
"ServiceBusApiEventQueueName": "apieventqueue-dev"
}
}$ dotnet restore
$ dotnet tool restoreOpen TrueVote.Bot.sln solution in Visual Studio, and build the solution.
TrueVote.Bot makes REST calls to TrueVote.Api and uses C# models via the OpenAPI spec from the TrueVote.Api schema.
To refresh the models, use nswag.
Nswag is installed in this project as a dotnet tool.
Local: $ dotnet nswag openapi2csclient /input:https://localhost:7253/swagger/v1/swagger.json /output:TrueVote.Api.cs /namespace:TrueVote.Api
Production: $ dotnet nswag openapi2csclient /input:https://api.truevote.org/swagger/v1/swagger.json /output:TrueVote.Api.cs /namespace:TrueVote.Api
TrueVote.Bot uses sementic versioning, starting with 1.0.0.
The patch (last segment of the 3 segments) is auto-incremented via a GitHub action when a pull request is merged to master. The GitHub action is configured in .github/workflows/truevote-bot-version.yml. To update the major or minor version, follow the instructions specified in the bumping section of the action - use #major or #minor in the commit message to auto-increment the version.
We welcome useful contributions. Please read our contributing guidelines before submitting a pull request.
TrueVote.Bot is licensed under the MIT license.
