GithubHelp home page GithubHelp logo

raluvy95 / nimrevolt Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 29 KB

Revolt.chat API wrapper written in Nim (pre-alpha)

License: MIT License

Nim 100.00%
bot nim nim-lang revolt revolt-chat revoltchat wrapper

nimrevolt's Introduction

nimrevolt

A Nim wrapper for Revolt Chat API. This is pre-alpha working in progress. Expect missing features and bugs! Please contact us or open new issue if you want to join this project!

Feel free to fork this project and continue working independendly if you want!

Example code

import struct/[client, event], asyncdispatch, dotenv, os, strformat, json,
    jsony

load()

when isMainModule:
  if not existsEnv("TOKEN"):
    quit("TOKEN variable is required to run")


  let bot: RevoltClient = newRevoltClient(getEnv("TOKEN"))

  proc onReady(args: JsonNode) =
    echo fmt"I am ready! {bot.users.len} users, {bot.servers.len} servers, {bot.channels.len} channels, {bot.emojis.len} emojis have been cached"

  proc onMessage(args: JsonNode) =
    let message: MessageEvent = fromJson($args, MessageEvent)
    echo message.content

  bot.addRevoltEvent("ready", onReady)
  bot.addRevoltEvent("message", onMessage)

  waitFor bot.login()

Build from source

Make sure to have at least nim 1.6.14 (recommend 2.0.0) in order to compile!

Just simply run nimble build --verbose and then run with nimrevolt to test!


This project is licensed under GNU General Public License

nimrevolt's People

Contributors

raluvy95 avatar

Stargazers

 avatar

Watchers

 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.