https://github.com/raluvy95/nimrevolt
Revolt.chat API wrapper written in Nim (pre-alpha)
https://github.com/raluvy95/nimrevolt
bot nim nim-lang revolt revolt-chat revoltchat wrapper
Last synced: about 1 month ago
JSON representation
Revolt.chat API wrapper written in Nim (pre-alpha)
- Host: GitHub
- URL: https://github.com/raluvy95/nimrevolt
- Owner: raluvy95
- License: mit
- Created: 2023-07-18T09:50:13.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-08T19:37:18.000Z (over 1 year ago)
- Last Synced: 2025-03-26T11:48:28.630Z (about 1 month ago)
- Topics: bot, nim, nim-lang, revolt, revolt-chat, revoltchat, wrapper
- Language: Nim
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```nimimport struct/[client, event], asyncdispatch, dotenv, os, strformat, json,
jsonyload()
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.contentbot.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*