falko-team / talkie-framework

Talkie is a framework for creating bots across messaging platforms. Write code once, deploy everywere (for Telegram, Discord, and more). Also, its lightweight and modular design, parallel processing and native AOT compilation, keep your bots blazing fast with minimal memory usage
BSD 2-Clause "Simplified" License
3 stars 0 forks source link
bot-framework csharp dotnet dotnet-native-aot telegram-bot telegram-bot-api telegram-bot-framework

Talkie - Build Bots Once, Deploy Everywhere

Talkie is under active development. The underlying C# framework libraries is subject to change.

Talkie is a framework for creating bots across messaging platforms. Write code once, deploy everywere (for Telegram, Discord, and more). Also, its lightweight and modular design, parallel processing and native AOT compilation, keep your bots blazing fast with minimal memory usage.

Features

Usage

Add the Falko Team NuGet Repository:

Open your terminal and execute the following command, replacing placeholders with your GitHub credentials:

dotnet nuget add source "https://nuget.pkg.github.com/falko-team/index.json"
    --name falko-team
    --store-password-in-clear-text
    --username $YOUR_GITHUB_USERNAME
    --password $YOUR_GITHUB_ACCESS_TOKEN

Install the Talkie Platforms Package:

If you're using Telegram, install the Talkie Telegram Platform package:

dotnet add package Falko.Talkie.Platforms.Telegram

Explore the Examples:

To get started quickly, check out the Examples folder in the Talkie repository for illustrative code samples and usage demonstrations.

Or explore Simple Wallet Bot (Rider Coin Bot)!

Or watch simple example of code:

await using var disposables = new ReverseDisposableScope();

var flow = new SignalFlow()
    .DisposeWith(disposables);

var unobservedExceptionTask = flow.TakeUnobservedExceptionAsync()

flow.Subscribe<MessagePublishedSignal>(signals => signals
    .SkipSelfPublish()
    .SkipOlderThan(TimeSpan.FromMinutes(1))
    .Where(signal => signal
        .Message
        .GetText()
        .ToLowerInvariant()
        .Contains("hello"))
    .HandleAsync(context => context
        .ToMessageController()
        .PublishMessageAsync("hi")
        .AsValueTask()))
    .UnsubscribeWith(disposables);

await flow.ConnectTelegramAsync("YOUR_TOKEN")
    .DisposeAsyncWith(disposables);

throw await unobservedExceptionTask;

License

This project is licensed under the BSD 2-Clause License.

Contributions are welcome!

© 2024, Falko Team