Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added activity type marker to switch between them during status update of the bot #253

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion include/sleepy_discord/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ namespace SleepyDiscord {
DIRECT_MESSAGE_TYPING = 1 << 14,
};

enum ActivityType : int8_t {
GAME = 0,
STREAMING = 1,
LISTENING = 2,
WATCHING = 3,
//CUSTOM = 4, //not supported for bots
COMPETING =5
};

class BaseDiscordClient : public GenericMessageReceiver {
public:
BaseDiscordClient() = default;
Expand Down Expand Up @@ -413,7 +422,7 @@ namespace SleepyDiscord {
BoolResponse deleteStageInstance(Snowflake<Channel> channelID, RequestSettings<BoolResponse> settings = {});

//websocket functions
void updateStatus(std::string gameName = "", uint64_t idleSince = 0, Status status = online, bool afk = false);
void updateStatus(std::string gameName = "", uint64_t idleSince = 0, Status status = online, bool afk = false, ActivityType type = ActivityType::GAME);
void requestServerMembers(ServerMembersRequest request);

//CDN stuff
Expand Down
4 changes: 2 additions & 2 deletions sleepy_discord/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ namespace SleepyDiscord {
}
}

void BaseDiscordClient::updateStatus(std::string gameName, uint64_t idleSince, Status status, bool afk) {
void BaseDiscordClient::updateStatus(std::string gameName, uint64_t idleSince, Status status, bool afk, ActivityType type) {
std::string statusString[] = {
"", "online", "dnd", "idle", "invisible", "offline"
};
Expand All @@ -233,7 +233,7 @@ namespace SleepyDiscord {
{"since", idleSince != 0 ? json::UInteger(idleSince) : "null"},
{"game", gameName != "" ? json::createJSON({
{"name", json::string(gameName)},
{"type", json::integer(0)}
{"type", json::integer(type)}
}) : "null"},
{ "status", SleepyDiscord::json::string(statusString[status]) },
{ "afk", SleepyDiscord::json::boolean(afk) }
Expand Down