Bot guild abstractions and .NET core dev portal started

This commit is contained in:
plane000
2018-10-25 18:07:42 +01:00
parent 5d513ade65
commit 37bbb84ec3
13 changed files with 11802 additions and 2 deletions

View File

@@ -8,10 +8,24 @@ export class GuildTools extends BaseDatabase {
const Guild = super.Guild;
try {
return await Guild.create({
id: id,
name: serverName
});
} catch (e) {
Logger.error(`An error occured inserting guild id: ${id}`);
return -1;
}
}
static async deleteGuild(id) {
const Guild = super.Guild;
try {
return Guild.destroy({where: {id: id}});
} catch (e) {
Logger.error(`An error occured while deleting guild id: ${id}`);
return -1;
}
}
}

View File

@@ -15,7 +15,8 @@ async function init() {
config.load();
await Database.init();
new Database.Guilds.newGuild();
Logger.debug(JSON.stringify(await Database.Guilds.newGuild(1234, "Hello"), null, 4));
Logger.debug(JSON.stringify(await Database.Guilds.deleteGuild(1234), null, 4));
client = new Discord.Client();
}