Added MongoDb connection string to config options

This commit is contained in:
2024-12-06 13:11:47 +03:30
parent 321f48660d
commit 4495e6b605
5 changed files with 12 additions and 12 deletions

View File

@@ -14,7 +14,7 @@ namespace mstdnCats.Services
{
public static async Task HandleCallbackQuery(CallbackQuery callbackQuery, IDocumentCollection<Post> _db, TelegramBotClient _bot, ILogger<MastodonBot>? logger)
{
var config = configData.fetchData();
var config = ConfigData.fetchData();
// Extract media ID from callback query data
string[] parts = callbackQuery.Data.Split('-');

View File

@@ -12,7 +12,7 @@ namespace mstdnCats.Services
{
public static async Task<List<MediaAttachment>> checkAndInsertPostsAsync(IDocumentCollection<Post> _db, TelegramBotClient _bot, List<Post> fetchedPosts, ILogger<MastodonBot>? logger)
{
var config = configData.fetchData();
var config = ConfigData.fetchData();
// Get existing posts
var existingPosts = _db.AsQueryable().Select(x => x.mstdnPostId).ToArray();

View File

@@ -10,8 +10,8 @@ namespace mstdnCats.Services
public static async Task<bool> runAsync(IDocumentCollection<Post> _db, TelegramBotClient _bot, string _tag, ILogger<MastodonBot>? logger, string _instance)
{
// Run check
//try
//{
try
{
// First get posts
var posts = await PostResolver.GetPostsAsync(_tag, logger, _instance);
@@ -22,12 +22,11 @@ namespace mstdnCats.Services
// Then process them
await ProcessPosts.checkAndInsertPostsAsync(_db, _bot, posts, logger);
//}
//catch (Exception ex)
//{
// logger?.LogCritical("Error while running check: " + ex.Message);
// throw new Exception("Error while running check: " + ex.Message);
//}
}
catch (Exception ex)
{
logger?.LogCritical("Error while running check: " + ex.Message);
}
return true;
}
}