Skip to content
Closed
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
16 changes: 14 additions & 2 deletions src/unittest/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1847,14 +1847,15 @@ Markdown lol \\|\\|spoiler\\|\\| \\~\\~strikethrough\\~\\~ \\`small \\*code\\* b
set_test(INVITE_CREATE, false);
set_test(INVITE_GET, false);
set_test(INVITE_DELETE, false);
set_test(GETCHANNELINVS, false);
if (!offline) {
dpp::channel channel;
channel.id = TEST_TEXT_CHANNEL_ID;
dpp::invite invite;
invite.max_age = 0;
invite.max_uses = 100;
set_test(INVITE_CREATE_EVENT, false);
bot.channel_invite_create(channel, invite, [&bot, invite](const dpp::confirmation_callback_t &event) {
bot.channel_invite_create(channel, invite, [&bot, channel, invite](const dpp::confirmation_callback_t &event) {
if (event.is_error()) {
return;
}
Expand All @@ -1864,6 +1865,17 @@ Markdown lol \\|\\|spoiler\\|\\| \\~\\~strikethrough\\~\\~ \\`small \\*code\\* b
set_test(INVITE_CREATE, true);
}

bot.channel_invites_get(channel, [created](const dpp::confirmation_callback_t &event) {
if (event.is_error()) {
return;
}

auto invites = event.get<dpp::invite_map>();
if (!invites.empty() && invites.contains(created.code)) {
set_test(GETCHANNELINVS, true);
}
});

bot.invite_get(created.code, [&bot, created](const dpp::confirmation_callback_t &event) {
if (!event.is_error()) {
auto retrieved = event.get<dpp::invite>();
Expand Down Expand Up @@ -2422,7 +2434,7 @@ Markdown lol \\|\\|spoiler\\|\\| \\~\\~strikethrough\\~\\~ \\`small \\*code\\* b
singleparam_api_test(guild_get, TEST_GUILD_ID, dpp::guild, GETGUILD);
singleparam_api_test_list(roles_get, TEST_GUILD_ID, dpp::role_map, GETROLES);
singleparam_api_test_list(channels_get, TEST_GUILD_ID, dpp::channel_map, GETCHANS);
singleparam_api_test_list(guild_get_invites, TEST_GUILD_ID, dpp::invite_map, GETINVS);
singleparam_api_test_list(guild_get_invites, TEST_GUILD_ID, dpp::invite_map, GETGUILDINVS);
multiparam_api_test_list(guild_get_bans, TEST_GUILD_ID, dpp::ban_map, GETBANS);
singleparam_api_test_list(channel_pins_get, TEST_TEXT_CHANNEL_ID, dpp::message_map, GETPINS);
singleparam_api_test_list(guild_events_get, TEST_GUILD_ID, dpp::scheduled_event_map, GETEVENTS);
Expand Down
4 changes: 3 additions & 1 deletion src/unittest/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ DPP_TEST(CURRENTUSER, "cluster::current_user_get()", tf_online);
DPP_TEST(GETGUILD, "cluster::guild_get()", tf_online);
DPP_TEST(GETCHAN, "cluster::channel_get()", tf_online);
DPP_TEST(GETCHANS, "cluster::channels_get()", tf_online);
DPP_TEST(GETCHANNELINVS, "cluster::channel_invites_get()", tf_online);
DPP_TEST(GETROLES, "cluster::roles_get()", tf_online);
DPP_TEST(GETINVS, "cluster::guild_get_invites()", tf_online);
DPP_TEST(GETGUILDINVS, "cluster::guild_get_invites()", tf_online);
DPP_TEST(GETBANS, "cluster::guild_get_bans()", tf_online);
DPP_TEST(GETPINS, "cluster::channel_pins_get()", tf_online);
DPP_TEST(GETEVENTS, "cluster::guild_events_get()", tf_online);
Expand Down Expand Up @@ -229,6 +230,7 @@ DPP_TEST(INVITE_CREATE_EVENT, "cluster::on_invite_create", tf_online);
DPP_TEST(INVITE_DELETE_EVENT, "cluster::on_invite_delete", tf_online);
DPP_TEST(INVITE_CREATE, "cluster::channel_invite_create", tf_online);
DPP_TEST(INVITE_GET, "cluster::invite_get", tf_online);
DPP_TEST(INVITE_GET, "cluster::invite_get", tf_online);
DPP_TEST(INVITE_DELETE, "cluster::invite_delete", tf_online);

/* Extended set -- Less important, skipped on the master branch due to rate limits and GitHub actions limitations */
Expand Down
Loading