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