Bot guild abstractions and .NET core dev portal started
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user