Giter VIP home page Giter VIP logo

kitten's Introduction

icon

Kitten

An experimental API for making chat bots in V

vlang discord

Project State

As presented in the title, this project is still in its initial stages. This document will describe the project closer to its design than its available content. Kitten is not production safe. Currently, the bot tends to crash by itself after a few hours. The official documentation will be more accurate for real use in your project. In order to keep Kitten's development going, the Genius team has decided to use this as the main library for the Genius bot. Anything Genius does in regards of the APIs will be feasible with Kitten, and... contributions are always welcome!

Features

Multi-platform Support

Kitten allows developers to simultaneously listen to multiple chat applications. Deploying to Discord+Guilded for example is as easy as just to Discord.

Rich Abstractions

Unlike libraries such as discordgo, Kitten is provided with a variety of abstractions to empower the users' productivity without sacrificing control. We believe that chatbots can be very complex projects and therefore it's often a good idea to present more than one way of getting something done.

API Compliance

Kitten makes its best efforts to respect API requirements and ratelimits. Developers should never get ratelimited thanks to the client-side caching mechanisms.

Safe and Efficient

Kitten has been written in the V programming langauge. So we can expect performance that is on par with C/C++; all while enjoying safe and modern language features that come with a simple (Go-like) syntax. V binaries are compact and generally don't require the language toolchain to be installed on the host. The average bot instance will use no more than a few megabytes of memory, making this ideal for running on micro computers such as Raspberry Pi's.

Installation

To use Kitten in your V project, simply install it with

v install "https://github.com/geniushq/kitten"

Example

module main

import os

import kitten
import kitten.universe
import kitten.discord.intents

fn handle_ready(mut client kitten.Client) ! {
    println('Ready')
}

// This will reply to Discord and Guilded "!ping" messages
fn handle_message(mut client kitten.Client, message &universe.Message) ! {
	if message.content.to_lower() == "!ping" {
		client.universe_channel_message_send(message.platform, message.channel, "pong")!
	}
}

fn main() {
    mut client := kitten.new_client()
	
    client.with_discord(
        os.getenv("DISCORD_TOKEN"),
        intents.guild_messages | intents.message_content)
		
    client.with_guilded(
        os.getenv("GUILDED_TOKEN"))

    client.universe_on_ready(handle_ready)
    client.universe_on_message_create(handle_message)

    client.start()!
    client.wait()!
}

More examples can be found here

kitten's People

Contributors

bbsnavy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.