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