9
9
10
10
namespace DiscordCPP {
11
11
12
+ class Guild ;
13
+
12
14
class Interaction : public DiscordObject {
13
15
public:
14
16
enum Type {
@@ -31,6 +33,7 @@ class Interaction : public DiscordObject {
31
33
std::optional<InteractionData> data;
32
34
// / The guild the interaction was sent from.
33
35
std::optional<std::string> guild_id;
36
+ Guild* guild = nullptr ;
34
37
// / The channel the interaction was sent from.
35
38
std::optional<std::string> channel_id;
36
39
// / The member that sent the interaction.
@@ -46,6 +49,8 @@ class Interaction : public DiscordObject {
46
49
47
50
public:
48
51
DLL_EXPORT Interaction (const json& data, const std::string& token);
52
+ DLL_EXPORT Interaction (const Interaction& old);
53
+ DLL_EXPORT ~Interaction ();
49
54
50
55
// / Send a Message as a reply to this interaction.
51
56
DLL_EXPORT void reply (const std::string& content, const bool tts = false );
@@ -58,25 +63,27 @@ class Interaction : public DiscordObject {
58
63
DLL_EXPORT void update_reply (Embed embed);
59
64
60
65
// / @return ID of the application this interaction is for.
61
- DLL_EXPORT std::string get_application_id () { return application_id; }
66
+ DLL_EXPORT std::string get_application_id () const { return application_id; }
62
67
// / @return The type of the invoked command.
63
- DLL_EXPORT Type get_type () { return type; }
68
+ DLL_EXPORT Type get_type () const { return type; }
64
69
// / @return The command data payload.
65
- DLL_EXPORT std::optional<InteractionData> get_data () { return data; }
70
+ DLL_EXPORT std::optional<InteractionData> get_data () const { return data; }
71
+ // / @return The guild the interaction was sent from.
72
+ DLL_EXPORT std::optional<std::string> get_guild_id () const { return guild_id; }
66
73
// / @return The guild the interaction was sent from.
67
- DLL_EXPORT std::optional<std::string> get_guild_id () { return guild_id; }
74
+ DLL_EXPORT std::optional<DiscordCPP::Guild> get_guild ();
68
75
// / @return The channel the interaction was sent from.
69
- DLL_EXPORT std::optional<std::string> get_channel_id () { return channel_id; }
76
+ DLL_EXPORT std::optional<std::string> get_channel_id () const { return channel_id; }
70
77
// / @return The member that sent the interaction.
71
- DLL_EXPORT std::optional<Member> get_member () { return member; }
78
+ DLL_EXPORT std::optional<Member> get_member () const { return member; }
72
79
// / @return The user that sent the interaction.
73
- DLL_EXPORT std::optional<User> get_user () { return user; }
80
+ DLL_EXPORT std::optional<User> get_user () const { return user; }
74
81
// / @return For components, the message they were attached to.
75
- DLL_EXPORT std::optional<Message> get_message () { return message; }
82
+ DLL_EXPORT std::optional<Message> get_message () const { return message; }
76
83
// / @return The selected locale of the user who sent this interaction.
77
- DLL_EXPORT std::optional<std::string> get_locale () { return locale; }
84
+ DLL_EXPORT std::optional<std::string> get_locale () const { return locale; }
78
85
// / @return The guild's preferred locale.
79
- DLL_EXPORT std::optional<std::string> get_guild_locale () { return guild_locale; }
86
+ DLL_EXPORT std::optional<std::string> get_guild_locale () const { return guild_locale; }
80
87
};
81
88
82
89
} // namespace DiscordCPP
0 commit comments