-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Arius Bronte edited this page Feb 25, 2020
·
2 revisions
VkNet.FluentCommands.UserBot is a library that will allow you to create your bot in just a couple of minutes.
This library is suitable for beginners in programming, for people who need to quickly implement a bot, for small and medium-sized projects.
Install package vid Nuget. Package Manager
PM> Install-Package VkNet.FluentCommands.UserBot
.NET CLI
> dotnet add package VkNet.FluentCommands.UserBot
First connect the library in your namespace.
using VkNet.FluentCommands.UserBot;
Next, create an instance of the FluentGroupBotCommands to authorize in and add triggers.
FluentUserBotCommands commands = new FluentUserBotCommands();
Authorize.
await commands.InitBotAsync("login", "very hard password");
Add commands.
commands.OnText("^ping$", "pong");
commands.OnText("^hello$", new[] {"hi!", "hey!", "good day!"});
commands.OnText("command not found");
Configure error handling. Is not required.
commands.OnException((e, token) =>
{
Console.WriteLine("Wake up, everything is broken");
Console.WriteLine($"[{DateTime.UtcNow}] {e.Message} {Environment.NewLine} {e.StackTrace}");
return Task.CompletedTask;
});
Start receiving messages.
await commands.ReceiveMessageAsync();