Merge remote-tracking branch 'origin/main'
This commit is contained in:
10
Program.cs
10
Program.cs
@@ -41,8 +41,9 @@ public class MastodonBot
|
||||
|
||||
var me = await bot.GetMeAsync();
|
||||
await bot.DropPendingUpdatesAsync();
|
||||
bot.OnUpdate += OnUpdate;
|
||||
bot.OnMessage += OnMessage;
|
||||
bot.OnUpdate += OnUpdate;
|
||||
|
||||
|
||||
logger.LogInformation($"Bot is running as {me.FirstName}.");
|
||||
|
||||
@@ -52,8 +53,9 @@ public class MastodonBot
|
||||
switch (update)
|
||||
{
|
||||
case { CallbackQuery: { } callbackQuery }: {
|
||||
if(callbackQuery.Data == "new_random") await HandleStartMessage.HandleStartMessageAsync(callbackQuery.Message, bot, db, logger);
|
||||
else await HandlePostAction.HandleCallbackQuery(callbackQuery, db, bot, logger); break;
|
||||
if(callbackQuery.Data == "new_random"){ await HandleStartMessage.HandleStartMessageAsync(callbackQuery.Message, bot, db, logger); break;}
|
||||
|
||||
else {await HandlePostAction.HandleCallbackQuery(callbackQuery, db, bot, logger); break;}
|
||||
|
||||
}
|
||||
default: logger.LogInformation($"Received unhandled update {update.Type}"); break;
|
||||
@@ -70,7 +72,7 @@ public class MastodonBot
|
||||
}
|
||||
|
||||
// Set a timer to fetch and process posts every 15 minutes
|
||||
_timer = new Timer(async _ => await RunCheck.runAsync(db, bot, DotNetEnv.Env.GetString("TAG"), logger, DotNetEnv.Env.GetString("CUSTOM_INSTANCE")), null, TimeSpan.Zero, TimeSpan.FromMinutes(15));
|
||||
//_timer = new Timer(async _ => await RunCheck.runAsync(db, bot, DotNetEnv.Env.GetString("TAG"), logger, DotNetEnv.Env.GetString("CUSTOM_INSTANCE")), null, TimeSpan.Zero, TimeSpan.FromMinutes(15));
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
|
10
README.md
10
README.md
@@ -8,7 +8,7 @@ I am not responsible for any misuse or unauthorized use of the scraped data. It
|
||||
|
||||
| Variable Name | Description | Default Value | Format |
|
||||
|---|---|---|---|
|
||||
| DB_NAME | Database file name | (Required) | Must end in *.json |
|
||||
| DB_NAME | Database file name | (Required) | Must not have any extension, plain text |
|
||||
| BOT_TOKEN | Telegram bot token | (Required) | Standard Telegram bot token format |
|
||||
| TAG | Mastodon timeline tag | (Required) | Text with no spaces |
|
||||
| CHANNEL_NUMID | Telegram channel number ID | (Required) | Telegram channel number ID format |
|
||||
@@ -26,8 +26,8 @@ I am not responsible for any misuse or unauthorized use of the scraped data. It
|
||||
|
||||
### Published Executable
|
||||
|
||||
1. Download the published executable for your operating system from the project releases.
|
||||
2. Navigate to the directory containing the downloaded executable in your terminal.
|
||||
1. Download the published executable for `Linux-x86` from the [pipeline artifacts](https://gitlab.com/mahdium/cats-of-mastodon-telegram-bot/-/pipelines/latest)
|
||||
2. Navigate to the directory containing the downloaded archive in your terminal and extract the archive.
|
||||
|
||||
**Providing Environment Variables:**
|
||||
|
||||
@@ -35,9 +35,9 @@ I am not responsible for any misuse or unauthorized use of the scraped data. It
|
||||
1. Create a file named .env in the root directory of your project.
|
||||
2. Add each environment variable on a separate line in the format KEY=VALUE. For example:
|
||||
```
|
||||
DB_NAME=my_data.json
|
||||
DB_NAME=my_data
|
||||
BOT_TOKEN=your_telegram_bot_token
|
||||
TAG=important_data
|
||||
TAG=mastodontimelinetag
|
||||
CHANNEL_NUMID=1234567890
|
||||
ADMIN_NUMID=9876543210
|
||||
```
|
||||
|
Reference in New Issue
Block a user