Do you want to implement a Discord Bot in Godot? Thanks to Discord.GD, you can make a bot in less than 10 lines of code!

Last Updategithub|3ddelano|discord.gd|main
Author3ddelano
Supported Versions3.3

Features

  • Make a Discord Bot in less than 10 lines of code
  • Supports Buttons and SelectMenus
  • Supports Application Commands aka Slash Commands
  • Uses Godot signals to emit events like bot_ready, guild_create, message_create, message_delete, etc
  • Get User Avatar and Guild Icon as Godot’s ImageTexture
  • Uses coroutine async functions i.e Promises

Installation

  • Copy addons/discord_gd into your project
  • In the Godot Editor, go to Project Settings > Plugins and enable the discord.gd plugin

Usage

  1. After activating the plugin. There will be a new DiscordBot node added to Godot. Click on any node in the scene tree of your scene for example Root and add the DiscordBot node as a child
  2. Connect the various signals (bot_ready, guild_create, message_create, message_delete, etc) of the DiscordBot node to the parent node, either through the editor or in the script using the connect() method
  3. Attach a script to the Root node
extends Node2D
func _ready():
   var discord_bot = $DiscordBot
   discord_bot.TOKEN = "your_bot_token_here"
   discord_bot.login()
   discord_bot.connect("bot_ready", self, "_on_DiscordBot_bot_ready")

func _on_DiscordBot_bot_ready(bot: DiscordBot):
   print('Logged in as ' + bot.user.username + '#' + bot.user.discriminator)
   print('Listening on ' + str(bot.channels.size()) + ' channels and ' + str(bot.guilds.size()))

License

MIT

Extra

Nothing yet. If you want to recommend a tutorial resource for this, use the suggestions page.