private async Task OnReadyServicesAsync(EspeonDbContext context) { var onReadyServices = this.GetServices <IOnReadyService>(); foreach (var service in onReadyServices) { await service.OnReadyAsync(context); } }
public static async Task AddGlobalTagsAsync <T>( EspeonDbContext context, ICommandService commandService, ILogger <T> logger) { logger.LogInformation("Adding global tags"); await context.GlobalTags.LoadAsync(); commandService.AddModule <TagModule>(moduleBuilder => { foreach (var tag in context.GlobalTags) { logger.LogDebug("Adding global tag {name}", tag.Key); moduleBuilder.AddCommand( context => GlobalTagCallbackAsync((EspeonCommandContext)context), commandBuilder => commandBuilder.WithName(tag.Key).Aliases.Add(tag.Key)); } logger.LogDebug("Created global tag module"); }); }
private static async Task PersistGuildAsync(CachedGuild guild, EspeonDbContext context) { await context.GetOrCreateAsync(guild.Id.RawValue, guildId => new GuildPrefixes(guildId)); await context.GetOrCreateAsync(guild.Id.RawValue, guildId => new GuildTags(guildId)); }