patches
This commit is contained in:
parent
b978dd998f
commit
2ee04ba9ca
@ -7,4 +7,5 @@
|
|||||||
#include <utils/functions.hpp>
|
#include <utils/functions.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
#endif
|
#endif
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef API_BOT_HPP_
|
#ifndef API_BOT_HPP_
|
||||||
#define API_BOT_HPP_
|
#define API_BOT_HPP_
|
||||||
#include <includes.hpp>
|
#include <includes.hpp>
|
||||||
|
#include <variant>
|
||||||
template<typename...Args>
|
template<typename...Args>
|
||||||
class Discord {
|
class Discord {
|
||||||
private:
|
private:
|
||||||
@ -17,9 +18,9 @@ public:
|
|||||||
Discord(const nlohmann::json& data) : data(data) {
|
Discord(const nlohmann::json& data) : data(data) {
|
||||||
initializeNets(data);
|
initializeNets(data);
|
||||||
}
|
}
|
||||||
template<unsigned long Index>
|
template<class T>
|
||||||
auto& get() const {
|
auto& get() const {
|
||||||
return *std::get<Index>(net);
|
return *std::get<std::unique_ptr<T>>(net);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
class Bot {
|
class Bot {
|
||||||
|
@ -6,10 +6,9 @@ int main(int argc, char* argv[]) {
|
|||||||
bot->on(GatewayEvents::READY, [](const nlohmann::json&) {
|
bot->on(GatewayEvents::READY, [](const nlohmann::json&) {
|
||||||
std::cout << DiscordEndpoints::details::latest << std::endl;
|
std::cout << DiscordEndpoints::details::latest << std::endl;
|
||||||
});
|
});
|
||||||
bot->on(GatewayEvents::MESSAGE_CREATE, [](const Discord<Message, User, Author, Message::Api>& msg) {
|
bot->on(GatewayEvents::MESSAGE_CREATE, [](const Discord<Message, User, Author, Message::Api>& ctx) {
|
||||||
if (!msg.get<2>().isBot) {
|
if (!ctx.get<Author>().isBot) {
|
||||||
msg.get<0>().send("939957962972229634", msg.get<0>().pack("content", msg.get<2>().avatar));
|
ctx.get<Message>().send("939957962972229634", ctx.get<Message>().pack("content", ctx.get<Author>().avatar));
|
||||||
msg.get<0>().send("939957962972229634", msg.get<0>().pack("content", std::to_string(msg.get<3>().latency()) + "ms"));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bot->start();
|
bot->start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user