From 7d594addcfe23a732bd740f329a7a8c048d3b440 Mon Sep 17 00:00:00 2001 From: 3ddelano <3ddelano@gmail.com> Date: Mon, 4 Oct 2021 10:51:00 +0530 Subject: [PATCH] update 1.1.5 --- CHANGELOG.md | 6 ++++++ addons/discord_gd/classes/message_button.gd | 13 +++++++++++-- addons/discord_gd/discord.gd | 9 +++++++++ addons/discord_gd/plugin.cfg | 2 +- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54b93f5..d16e6be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Changelog This is a high-level changelog for each released versions of the plugin. For a more detailed list of past and incoming changes, see the commit history. +1.1.5 +------ +- Added `DiscordBot.create_dm_channel()` +- Added `DiscordBot.get_guild_emojis()` +- Added emoji support for `MessageButton` + 1.1.4 ------ - Added `DiscordBot.get_guild_member()` diff --git a/addons/discord_gd/classes/message_button.gd b/addons/discord_gd/classes/message_button.gd index 8e5ba12..492cf1f 100644 --- a/addons/discord_gd/classes/message_button.gd +++ b/addons/discord_gd/classes/message_button.gd @@ -8,7 +8,7 @@ var label: String setget set_label, get_label var custom_id: String setget set_custom_id, get_custom_id var url: String setget set_url, get_url var disabled: bool = false setget set_disabled, get_disabled -#var emoji: String +var emoji: Dictionary var _style setget set_style, get_style var type: int = 2 @@ -61,6 +61,14 @@ func get_disabled() -> bool: return disabled +func set_emoji(new_emoji: Dictionary): + emoji = new_emoji + return self + +func get_emoji() -> Dictionary: + return emoji + + func _init(): return self @@ -89,5 +97,6 @@ func _to_dict() -> Dictionary: 'style': _style, 'label': label, 'custom_id': custom_id, - 'disabled': disabled + 'disabled': disabled, + 'emoji': emoji } diff --git a/addons/discord_gd/discord.gd b/addons/discord_gd/discord.gd index 671dd04..d9ede35 100644 --- a/addons/discord_gd/discord.gd +++ b/addons/discord_gd/discord.gd @@ -154,11 +154,20 @@ func get_guild_icon(guild_id: String, size: int = 256) -> PoolByteArray: return png_bytes +func get_guild_emojis(guild_id: String) -> Array: + var res = yield(_send_get('/guilds/%s/emojis' % guild_id), 'completed') + return res + func get_guild_member(guild_id: String, member_id: String) -> Dictionary: var member = yield(_send_get('/guilds/%s/members/%s' % [guild_id, member_id]), 'completed') return member +func create_dm_channel(user_id: String) -> Dictionary: + var res = yield(_send_request('/users/@me/channels', {"recipient_id": user_id}), 'completed') + return res + + func remove_member_role(guild_id: String, member_id: String, role_id: String): var res = yield(_send_get('/guilds/%s/members/%s/roles/%s' % [guild_id, member_id, role_id], HTTPClient.METHOD_DELETE), 'completed') return res diff --git a/addons/discord_gd/plugin.cfg b/addons/discord_gd/plugin.cfg index 1bf7d56..689d8b9 100644 --- a/addons/discord_gd/plugin.cfg +++ b/addons/discord_gd/plugin.cfg @@ -3,5 +3,5 @@ name="discord.gd" description="A Discord bot API wrapper for Godot." author="Delano Lourenco" -version="1.1.4" +version="1.1.5" script="plugin.gd"