-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.cpp
More file actions
34 lines (26 loc) · 955 Bytes
/
database.cpp
File metadata and controls
34 lines (26 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "sleepy_discord/sleepy_discord.h"
#include "discord_class.h"
#include "globals.h"
#include <sqlite3.h>
void openDB(SleepyDiscord::Message message, char* arg);
__attribute__((constructor))
void database_constructor(){
printf("database module loading...\n");
//printf("SQLite version %s\n", sqlite3_libversion());
std::string opendb_command = "open_database";
fptr_map[opendb_command] = (void*)openDB;
printf("open_database command registered...\n");
}
void openDB(SleepyDiscord::Message message, char* arg){
std::string contents = message.content;
char fileName[512];
printf("%s\n", sqlite3_libversion());
sscanf(contents.c_str(), "%*s %s", fileName);
}
__attribute__((destructor))
void database_destructor(){
printf("unloading database module...\n");
std::string opendb_command = "open_database";
fptr_map.erase(opendb_command);
printf("open_database command unregistered...\n");
}