summaryrefslogtreecommitdiff
path: root/src/discord/webhook.hpp
blob: 3b9eeb9bd6210155abddd2c618cee77e2a57f242 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once
#include <optional>
#include "json.hpp"
#include "snowflake.hpp"
#include "user.hpp"

enum class WebhookType {
    Incoming = 1,
    ChannelFollower = 2,
};

struct WebhookData {
    Snowflake ID;
    WebhookType Type;
    std::optional<Snowflake> GuildID;
    Snowflake ChannelID;
    std::optional<UserData> User;
    std::string Name;   // null
    std::string Avatar; // null
    std::optional<std::string> Token;
    Snowflake ApplicationID; // null

    friend void from_json(const nlohmann::json &j, WebhookData &m);
};

struct WebhookMessageData {
    Snowflake MessageID;
    Snowflake WebhookID;
    std::string Username;
    std::string Avatar;

    std::string GetAvatarURL() const;
};