Skip to content

Edgelord is a library for Cloudflare Workers. You can scaffold a basic bot for discord, slack, etc.

License

Notifications You must be signed in to change notification settings

sizumita/edgelord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Edge Computing + chūnibyō = Edgelord ✨👿

Edgelord

Edgelord is now working. You can contribute for it.

Edgelord is a Rust library for cloudflare workers. You can use Edgelord to scaffold a basic bot for social networking service.

Edgelord supports previous bot:

  • 🚧 discord -> edgecord
  • 🚧 slack

Since Edgelord is a Light Wrapper for cloudflare workers, you can use as a foundation to build a bot on.

Features

  • 🚧 discord bot support
  • 🚧 slack bot support
  • 🚧 Documentation

🚧 Edgecord - Discord http interaction bot handler

edgecord is a fast, light weight, powerful discord http interaction bot framework. It provides type safely commands, automatically publish system.

Example

use edgecord::{
    command, ChatInputCommandContext, InteractionHandler, InteractionResponse,
};
use worker::*;

#[event(fetch)]
pub async fn fetch(req: Request, env: Env, worker_context: worker::Context) -> Result<Response> {
    edgelord::set_panic_hook();

    let router = Router::with_data(worker_context);

    router
        .post_async("/", |req, ctx| async move {
            let RouteContext { env, data, .. } = ctx;
            let handler = InteractionHandler::builder()
                .command(help_command())
                .public_key(&*env.secret("APPLICATION_PUBLIC_KEY")?.to_string())
                .application_id(&*env.secret("APPLICATION_ID")?.to_string())
                .token(&*env.secret("DISCORD_BOT_TOKEN")?.to_string())
                .build()
                .unwrap();
            handler.process(req, env, data).await
        })
        .run(req, env)
        .await
}

#[command(
    name = "help",
    description = "help command.",
)]
pub async fn help_command(ctx: ChatInputCommandContext) -> InteractionResponse {
    ctx.message("this is what you want")
}

Contribution

You can create issue or PR to contribute.

I want to you to contribute 💪

🚧 Documentation

now working

About

Edgelord is a library for Cloudflare Workers. You can scaffold a basic bot for discord, slack, etc.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages