Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/abdera7mane/cordot
- Owner: Abdera7mane
- License: mit
- Created: 2021-09-15T17:10:55.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-18T02:00:05.000Z (over 1 year ago)
- Last Synced: 2023-05-02T20:38:25.637Z (over 1 year ago)
- Topics: addon, api, discord, discord-api, discord-bot, gdscript, godot, godot-addon, godot-engine, godotengine, plugin, rest, websocket
- Language: GDScript
- Homepage: https://cordot.readthedocs.io
- Size: 421 KB
- Stars: 13
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
Discord API wrapper for Godot Engine written in GDScript language.
# Features
* Object oriented
* Statically typed
* Supports gateway resumes and auto reconnects when possible## Example
A minimal bot written using this library
```gdscript
extends Nodevar 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:
returnif 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 serverIt 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**.