项目作者: Terisback

项目描述 :
Discord Bot Framework written in V
高级语言: V
项目地址: git://github.com/Terisback/discord.v.git
创建时间: 2020-09-21T22:48:22Z
项目社区:https://github.com/Terisback/discord.v

开源协议:MIT License

下载


discord.v

[!CAUTION]
I dropped the support of this lib at the end of 2021. The reason is that I don’t care anymore about V, fixing “bugs” around new syntax and catching segfaults from socket interactions is not fun. Feel free to fork and keep alive if you need it.

There is another beginning at DarpHome/discord.v, please check them.

Example

  1. import terisback.discordv as vd
  2. fn main() {
  3. mut client := vd.new(token: 'token') ?
  4. client.on_message_create(on_ping)
  5. client.run().wait()
  6. }
  7. fn on_ping(mut client vd.Client, evt &vd.MessageCreate) {
  8. if evt.content == '!ping' {
  9. client.channel_message_send(evt.channel_id, content: 'pong!') or { }
  10. }
  11. }

More examples

How to install

discord.v uses openssl, be sure it is installed apt install libssl-dev

Only way to run it on Windows is to use WSL (or install openssl headers somehow)

Install via vpm

  1. v install Terisback.discordv

Install via git

  1. git clone https://github.com/Terisback/discord.v.git ~/.vmodules/terisback/discordv

And then import terisback.discordv wherever you like

TODO()

First milestone

  • Connect to gateway
  • Handle heartbeat
  • Event system (pub/sub)
  • REST for sending messages
  • Implement multipart/form-data for file sending
  • Do usual application/json for sending without binary data
  • Handle Gateway events
    • Audit Log
    • Channel
    • Emoji
    • Guild
    • Invite
    • User
    • Voice
    • Webhook
    • Slash Command
  • Create examples (3/4)
  • Documentation

Second milestone

  • Handle REST
    • Audit Log
    • Channel
    • Emoji
    • Guild
    • Invite
    • User
    • Voice
    • Webhook
    • Slash Command
    • Observe rate limits (thanks to @div72)
  • Slash Commands
  • Fancy log
  • Command router
  • Think about tests

Third milestone (till V v0.3)

  • Translate dispatch to generics (not sure about that)
  • Build cache ontop map’s (memcache, redis in future)

The Main one

  • Make a cool library

Contact

Feel free to contribute ;)
You can contact me at discord: TERISBACK#9125