forked from rcxpony/sparkle
small fixes
This commit is contained in:
parent
61a4ce5e61
commit
8ccf76e479
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
build/
|
||||
.vscode/
|
||||
.vscode/
|
||||
libs/example.hpp
|
@ -1,13 +1,12 @@
|
||||
#ifndef API_AUTHOR_HPP_
|
||||
#define API_AUTHOR_HPP_
|
||||
#include <utils/json.hpp>
|
||||
#include <utils/types.hpp>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using json = nlohmann::json;
|
||||
class Author {
|
||||
private:
|
||||
json data;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef API_BOT_HPP_
|
||||
#define API_BOT_HPP_
|
||||
#include <utils/json.hpp>
|
||||
#include <utils/types.hpp>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
@ -8,7 +8,6 @@
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using json = nlohmann::json;
|
||||
template<typename...Args>
|
||||
class Bot {
|
||||
private:
|
||||
|
@ -1,6 +1,5 @@
|
||||
#ifndef API_CHANNEL_HPP_
|
||||
#define API_CHANNEL_HPP_
|
||||
#include <utils/json.hpp>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
@ -10,7 +9,6 @@
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using json = nlohmann::json;
|
||||
class Channel {
|
||||
private:
|
||||
json data;
|
||||
|
@ -1,13 +1,12 @@
|
||||
#ifndef API_EMBED_HPP_
|
||||
#define API_EMBED_HPP_
|
||||
#include <utils/json.hpp>
|
||||
#include <utils/types.hpp>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using json = nlohmann::json;
|
||||
class EmbedBuilder {
|
||||
private:
|
||||
json embed = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifndef API_GUILD_HPP_
|
||||
#define API_GUILD_HPP_
|
||||
#include <json.hpp>
|
||||
#include <utils/types.hpp>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
|
@ -1,16 +1,14 @@
|
||||
#ifndef API_MESSAGE_HPP_
|
||||
#define API_MESSAGE_HPP_
|
||||
#include <utils/json.hpp>
|
||||
#include <utils/types.hpp>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <tls/network.hpp>
|
||||
#include <gateway/websocket.hpp>
|
||||
#include <utils/types.hpp>
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using json = nlohmann::json;
|
||||
class Message {
|
||||
private:
|
||||
json data;
|
||||
|
@ -1,16 +1,14 @@
|
||||
#ifndef API_USER_HPP_
|
||||
#define API_USER_HPP_
|
||||
#include <json.hpp>
|
||||
#include <utils/types.hpp>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <tls/network.hpp>
|
||||
#include <gateway/websocket.hpp>
|
||||
#include <utils/types.hpp>
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using json = nlohmann::json;
|
||||
class User {
|
||||
private:
|
||||
json data;
|
||||
@ -28,7 +26,7 @@ public:
|
||||
try {
|
||||
return data["d"]["author"]["bot"];
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
catch (...) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ private:
|
||||
int heartbeat_interval, lastS;
|
||||
json payload = { {"op", 1},{"d", nullptr} }, id, res;
|
||||
std::unordered_map<std::string_view, std::function<void(const json&)>> eventHandlers;
|
||||
WebSocket(const std::string& token, const int intents, bool isBot) : lastS(0), heartbeat_interval(-1) {
|
||||
WebSocket(const std::string& token, const int& intents, bool& isBot) : lastS(0), heartbeat_interval(-1) {
|
||||
WebSocket::t = token;
|
||||
WebSocket::i = intents;
|
||||
WebSocket::isBot = isBot;
|
||||
|
@ -5,6 +5,8 @@
|
||||
#define je(...) {__VA_ARGS__}
|
||||
#define g(x, y) (std::get<x>(y))
|
||||
#define ALL_INTENTS 131071
|
||||
#include <utils/json.hpp>
|
||||
using json = nlohmann::json;
|
||||
#include <iostream>
|
||||
void chngcol(const std::string& text, int rBg, int gBg, int bBg) {
|
||||
std::cout << "\033[48;2;" << rBg << ";" << gBg << ";" << bBg << "m";
|
||||
|
@ -23,7 +23,8 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
});
|
||||
bot->on(GatewayEvents::MESSAGE_REACTION_REMOVE, [bot](const Bot<Message>& msg) {
|
||||
g(0, msg.net)->send("939957962972229634", j("content", "bye"));
|
||||
g(0, msg.net)->send("939957962972229634",
|
||||
j("content", "bye"));
|
||||
});
|
||||
bot->on(GatewayEvents::MESSAGE_REACTION_ADD, [](const Bot<Message>& msg) {
|
||||
g(0, msg.net)->send("939957962972229634", j("content", "hello"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user