RikoBot changes
This commit is contained in:
parent
bf3e8a65e1
commit
a77fb812eb
4
Bot.cs
4
Bot.cs
@ -104,7 +104,7 @@ namespace RSSBot {
|
||||
|
||||
public static async void Save() {
|
||||
if (RssBotFeeds.Count > 0) {
|
||||
Logger.Info("Speichere Daten...");
|
||||
/* Logger.Info("Speichere Daten..."); */
|
||||
}
|
||||
|
||||
foreach (RssBotFeed feed in RssBotFeeds) {
|
||||
@ -119,7 +119,7 @@ namespace RSSBot {
|
||||
await Configuration.Database.SetAddAsync($"{Configuration.RedisHash}:feeds", feed.Url);
|
||||
}
|
||||
|
||||
Logger.Info("Gespeichert!");
|
||||
/* Logger.Info("Gespeichert!"); */
|
||||
}
|
||||
}
|
||||
}
|
12
Commands.cs
12
Commands.cs
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -17,7 +17,7 @@ namespace RSSBot {
|
||||
public static async void Welcome(Message message, GroupCollection matches) {
|
||||
await Bot.BotClient.SendTextMessageAsync(
|
||||
message.Chat,
|
||||
"<b>Willkommen beim RSS-Bot!</b>\nSende /help, um zu starten.",
|
||||
"<b>Willkommen bei RikoBot!</b>\nSende /help, um zu starten.",
|
||||
ParseMode.Html
|
||||
);
|
||||
}
|
||||
@ -183,7 +183,7 @@ namespace RSSBot {
|
||||
}
|
||||
|
||||
if (feed.NewEntries.Count == 0) {
|
||||
Logger.Info("Keine neuen Beiträge.");
|
||||
/* Logger.Info("Keine neuen Beiträge."); */
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -216,8 +216,8 @@ namespace RSSBot {
|
||||
else if (!string.IsNullOrWhiteSpace(entry.Description))
|
||||
content = Utils.ProcessContent(entry.Description);
|
||||
|
||||
var text = $"<b>{postTitle}</b>\n<i>{feed.Title}</i>\n{content}";
|
||||
text += $"\n<a href=\"{postLink}\">Weiterlesen auf {linkName}</a>";
|
||||
var text = $"<b>[#RSS] {postTitle}</b>\n{content}";
|
||||
text += $"\n<a href=\"{postLink}\">Auf {linkName} ansehen.</a>";
|
||||
|
||||
// Send
|
||||
foreach (var chatId in feed.Subs.ToList())
|
||||
@ -236,7 +236,7 @@ namespace RSSBot {
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Info("Nächster Check in 60 Sekunden");
|
||||
/* Logger.Info("Nächster Check in 60 Sekunden"); */
|
||||
|
||||
if (hadEntries) Bot.Save();
|
||||
|
||||
|
16
Utils.cs
16
Utils.cs
@ -15,7 +15,9 @@ namespace RSSBot {
|
||||
|
||||
private static string CleanRss(string input) {
|
||||
string[] replacements = {
|
||||
"[←]",
|
||||
"[…]",
|
||||
"[...]",
|
||||
"[bilder]",
|
||||
"[boerse]",
|
||||
"[mehr]",
|
||||
@ -41,17 +43,23 @@ namespace RSSBot {
|
||||
"(more…)",
|
||||
"View On WordPress",
|
||||
"Continue reading →",
|
||||
"» weiterlesen",
|
||||
"Ein Kommentar.",
|
||||
"Änderungen zeigen",
|
||||
"(Feed generated with FetchRSS)",
|
||||
"(RSS generated with FetchRss)",
|
||||
"-- Delivered by Feed43 service",
|
||||
"Meldung bei www.tagesschau.de lesen"
|
||||
};
|
||||
|
||||
string[] regexReplacements = {
|
||||
"Der Beitrag.*erschien zuerst auf .+.",
|
||||
"The post.*appeared first on .+.",
|
||||
"http://www.serienjunkies.de/.*.html"
|
||||
"http://www.serienjunkies.de/.*.html",
|
||||
"Nächstältere Version.*",
|
||||
"Die Seite wurde neu angelegt.*",
|
||||
"Weiterleitung nach.*erstellt.*"
|
||||
};
|
||||
|
||||
input = input.Replace("\n", " ");
|
||||
input = replacements.Aggregate(input, (current, replacement) => current.Replace(replacement, ""));
|
||||
input = regexReplacements.Aggregate(input,
|
||||
(current, replacement) => Regex.Replace(current, replacement, ""));
|
||||
@ -79,4 +87,4 @@ namespace RSSBot {
|
||||
return chatMember.Status.Equals(ChatMemberStatus.Administrator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user