adds stuff to prevent my token from being leaked again
This commit is contained in:
parent
683fbbf5d4
commit
1ab3194bbf
1
.gitignore
vendored
1
.gitignore
vendored
@ -36,3 +36,4 @@
|
|||||||
|
|
||||||
balances.txt
|
balances.txt
|
||||||
gbp-bot
|
gbp-bot
|
||||||
|
config.json
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"token": "token here",
|
"token": "OTQ5MTIxNDU2MTY2NTM5Mjk2.YiFwPA.uGYrCakjTDG2eaCRrg0560vWcrs",
|
||||||
"bot_command": "!gbp"
|
"bot_command": "!gbp"
|
||||||
}
|
}
|
||||||
|
24
src/main.cpp
24
src/main.cpp
@ -5,16 +5,11 @@
|
|||||||
#include <dpp/message.h>
|
#include <dpp/message.h>
|
||||||
#include <dpp/once.h>
|
#include <dpp/once.h>
|
||||||
#include <dpp/queues.h>
|
#include <dpp/queues.h>
|
||||||
|
#include <dpp/nlohmann/json.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "gbp.h"
|
#include "gbp.h"
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
//TODO: put these into a gitignored text file :))))))))
|
|
||||||
const std::string BOT_TOKEN = "OTQ5MTIxNDU2MTY2NTM5Mjk2.YiFwPA.Hrj5LxqQuApFZfNuSUBVXe3kYEQ";
|
|
||||||
const std::string BOT_COMMAND = "!gbp";
|
|
||||||
|
|
||||||
|
|
||||||
const dpp::snowflake GUILD_ID = 865347537287249980;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ##hasCommand
|
* ##hasCommand
|
||||||
@ -26,7 +21,10 @@ const dpp::snowflake GUILD_ID = 865347537287249980;
|
|||||||
*/
|
*/
|
||||||
bool hasCommand(dpp::message msg)
|
bool hasCommand(dpp::message msg)
|
||||||
{
|
{
|
||||||
return msg.content.substr(0, (msg.content.find(" "))) == BOT_COMMAND;
|
json config;
|
||||||
|
std::ifstream configFile("../config.json");
|
||||||
|
configFile >> config;
|
||||||
|
return msg.content.substr(0, (msg.content.find(" "))) == config["bot_command"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,9 +50,15 @@ void onMessage(dpp::cluster &bot, dpp::message msg)
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
//Setup bot
|
/* Setup the bot **/
|
||||||
dpp::cluster bot(BOT_TOKEN, dpp::i_default_intents | dpp::i_message_content);
|
json config;
|
||||||
|
std::ifstream configFile("../config.json");
|
||||||
|
configFile >> config;
|
||||||
|
|
||||||
|
std::string token = config["token"];
|
||||||
|
dpp::cluster bot(token, dpp::i_default_intents | dpp::i_message_content);
|
||||||
|
|
||||||
|
/* Start listening to commands */
|
||||||
bot.on_log(dpp::utility::cout_logger());
|
bot.on_log(dpp::utility::cout_logger());
|
||||||
|
|
||||||
bot.on_message_create([&](const dpp::message_create_t &event) {
|
bot.on_message_create([&](const dpp::message_create_t &event) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user