Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/abdera7mane/cordot

Discord API wrapper for Godot Engine written in GDScript language
https://github.com/abdera7mane/cordot

addon api discord discord-api discord-bot gdscript godot godot-addon godot-engine godotengine plugin rest websocket

Last synced: about 1 month ago
JSON representation

Discord API wrapper for Godot Engine written in GDScript language

Awesome Lists containing this project

README

        

> :information_source: **Note:** If you are looking to integrate your game with the Discord client, check out [Discord RPC](https://github.com/Abdera7mane/Discord-RPC-GDScript).

# Cordot


icon



Discord API wrapper for Godot Engine written in GDScript language.




Godot version


Discord API version


License

# Features

* Object oriented
* Statically typed
* Supports gateway resumes and auto reconnects when possible

## Example

A minimal bot written using this library

```gdscript
extends Node

var token: String = "bot_token"
var client: DiscordClient = DiscordClient.new(token)

func _ready() -> void:
add_child(client)

client.connect("client_ready", self, "_on_bot_ready")
client.connect("message_sent", self, "_on_message")

client.login()

func _on_bot_ready(user: User) -> void:
print("Bot is ready !")
print("logged as: ", user.get_tag())

var presence := PresenceUpdate.new()
presence.set_status(Presence.Status.DND)\
.add_activity(Presence.playing("Godot Engine"))

client.update_presence(presence)

func _on_message(message: Message) -> void:
if message.author.is_bot:
return

if message.content.to_lower().begins_with("hello"):
message.channel.create_message("Greetings !").submit()

```

## Installation

```
git clone --recursive https://github.com/Abdera7mane/cordot
cd cordot
git submodule update --init --recursive
```
Open the folder as a Godot project or copy the `addons` directory to an existing project.

## Documentation

The documentation is hosted on [ReadTheDocs](https://cordot.readthedocs.io/).
Contributions to [cordot-docs](https://github.com/Abdera7mane/cordot-docs) are welcomed.

## Usage

Even though this may seem useless for a Godot game, I find this project being useful in some scenarios:
* Learning resource
* Running a discord bot in a Godot game server

It is always up to you and your creativity on how you will use this project as long as you **don't abuse the Discord API**.