Пример #1
0
    /// <inheritdoc />
    protected override void ConfigureServices(IServiceProvider serviceProvider)
    {
        var coreDatabase = serviceProvider.GetRequiredService <CoreDatabaseContext>();

        coreDatabase.Database.Create();

        var charactersDatabase = serviceProvider.GetRequiredService <CharactersDatabaseContext>();

        charactersDatabase.Database.Create();

        this.Database = charactersDatabase;

        this.Characters      = serviceProvider.GetRequiredService <ICharacterService>();
        this.CharacterEditor = serviceProvider.GetRequiredService <ICharacterEditor>();

        serviceProvider.GetRequiredService <UserService>();

        this.DefaultOwner = this.Database.CreateProxy <User>(new Snowflake(0));
        this.Database.Update(this.DefaultOwner);

        this.DefaultServer = this.Database.CreateProxy <Server>(new Snowflake(1));
        this.Database.Update(this.DefaultServer);

        this.Database.SaveChanges();

        // Default pronouns
        var pronounService = serviceProvider.GetRequiredService <PronounService>();

        pronounService.WithPronounProvider(new TheyPronounProvider());
    }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterDiscordService"/> class.
 /// </summary>
 /// <param name="characters">The character service.</param>
 /// <param name="characterEditor">The character editor.</param>
 /// <param name="users">The user service.</param>
 /// <param name="servers">The server service.</param>
 /// <param name="characterRoles">The character role service.</param>
 /// <param name="guildAPI">The guild API.</param>
 public CharacterDiscordService
 (
     ICharacterService characters,
     ICharacterEditor characterEditor,
     UserService users,
     ServerService servers,
     CharacterRoleService characterRoles,
     IDiscordRestGuildAPI guildAPI
 )
 {
     _characters      = characters;
     _characterEditor = characterEditor;
     _users           = users;
     _servers         = servers;
     _characterRoles  = characterRoles;
     _guildAPI        = guildAPI;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterDiscordService"/> class.
 /// </summary>
 /// <param name="characters">The character service.</param>
 /// <param name="characterEditor">The character editor.</param>
 /// <param name="users">The user service.</param>
 /// <param name="servers">The server service.</param>
 /// <param name="commands">The command service.</param>
 /// <param name="ownedEntities">The owned entity service.</param>
 /// <param name="discord">The Discord service.</param>
 /// <param name="characterRoles">The character role service.</param>
 public CharacterDiscordService
 (
     ICharacterService characters,
     ICharacterEditor characterEditor,
     UserService users,
     ServerService servers,
     CommandService commands,
     OwnedEntityService ownedEntities,
     DiscordService discord,
     CharacterRoleService characterRoles
 )
 {
     _characters      = characters;
     _characterEditor = characterEditor;
     _users           = users;
     _servers         = servers;
     _commands        = commands;
     _ownedEntities   = ownedEntities;
     _discord         = discord;
     _characterRoles  = characterRoles;
 }