Created
December 15, 2019 02:30
-
-
Save Aervyon/2bf90f2b8016f6f17af9c9ce91624320 to your computer and use it in GitHub Desktop.
A databaseless schema for AxonCore, requires version 2.0 or higher to be used. Nothing is stored, nothing in memory either.
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
import DBService from '../src/Database/DBProvider'; | |
import AxonConfig from '../src/Structures/DataStructure/AxonConfig'; | |
import GuildConfig from '../src/Structures/DataStructure/GuildConfig'; | |
/** | |
* A schema designed to remove databases from AxonCore | |
* | |
* @author VoidNulll | |
* | |
* @class DatabaselessService | |
* @extends DBService | |
*/ | |
export default class DatabaselessService extends DBService { | |
// eslint-disable-next-line no-useless-constructor | |
constructor(axonClient) { | |
super(axonClient); | |
} | |
fetchAxon() { | |
return Promise.resolve(new AxonConfig(this.axon, {} ) ); | |
} | |
fetchGuild(gID) { | |
return Promise.resolve(new GuildConfig(this.axon, { guildID: gID } ) ); | |
} | |
initAxon() { | |
return Promise.resolve(new AxonConfig(this.axon, {} ) ); | |
} | |
initGuild(gID) { | |
return Promise.resolve(new GuildConfig(this.axon, { guildID: gID } ) ); | |
} | |
updateBlacklistUser(blacklistedUsers) { | |
return Promise.resolve(new AxonConfig(this.axon, { bannedUsers: blacklistedUsers } ) ); | |
} | |
updateBlacklistGuild(blacklistedGuilds) { | |
return Promise.resolve(new AxonConfig(this.axon, { bannedGuilds: blacklistedGuilds } ) ); | |
} | |
updateGuildPrefix(gID, prefixArr) { | |
return Promise.resolve(new GuildConfig(this.axon, { guildID: gID, prefixes: prefixArr } ) ); | |
} | |
updateModule(gID, modulesArr) { | |
return Promise.resolve(new GuildConfig(this.axon, { guildID: gID, modules: modulesArr } ) ); | |
} | |
updateCommand(gID, commandArr) { | |
return Promise.resolve(new GuildConfig(this.axon, { guildID: gID, commands: commandArr } ) ); | |
} | |
updateEvent(gID, eventArr) { | |
return Promise.resolve(new GuildConfig(this.axon, { guildID: gID, listeners: eventArr } ) ); | |
} | |
saveAxonSchema(axonSchema) { | |
return Promise.resolve(new AxonConfig(this.axon, axonSchema) ); | |
} | |
saveGuildSchema(gID, guildSchema) { | |
return Promise.resolve(new GuildConfig(this.axon, guildSchema) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment