DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
Creating a Channel Invite

/// Test.hpp -header for the "test" command.
/// https://github.com/RealTimeChris/DiscordCoreAPI
#pragma once
#include <index.hpp>
namespace discord_core_api {
class test : public base_function {
public:
test() {
commandName = "test";
helpDescription = "testing purposes!";
embed_data msgEmbed;
msgEmbed.setDescription("------\nSimply enter !test or /test!\n------");
msgEmbed.setTitle("__**test usage:**__");
msgEmbed.setTimeStamp(getTimeAndDate());
msgEmbed.setColor("fe_fe_fe");
helpEmbed = msgEmbed;
}
unique_ptr<base_function> create() {
return makeUnique<test>();
}
virtual void execute(base_function_arguments& args) {
try {
create_channel_invite_data dataPackage;
dataPackage.channelId = args.eventData.getChannelId();
dataPackage.targetType = invite_target_types::Embedded_Application;
dataPackage.temporary = true;
invite_data channelInvite = discord_core_api::channels::createChannelInviteAsync(dataPackage).get();
std::cout << "channel invite: " << channelInvite.inviter.userName << std::endl;
} catch (...) {
rethrowException("test::execute()");
}
}
};
}
static co_routine< invite_data > createChannelInviteAsync(create_channel_invite_data dataPackage)
Creates an invite to a selected channel_data.
The main namespace for the forward-facing interfaces.
Base class for the command classes.