ma wiki-irc-bot: obsolete

This commit is contained in:
makefu 2021-01-27 23:02:53 +01:00
parent f7443e2835
commit ae3f6ff1ac
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
2 changed files with 0 additions and 64 deletions

View File

@ -1,19 +0,0 @@
{ config, pkgs, ... }:
let
pkg = pkgs.lib.overrideDerivation pkgs.newsbot-js (original: {
patches = [ ./wiki-output.patch ];
});
newsfile = pkgs.writeText "feeds" ''
nixoswiki-bot|https://nixos.wiki/api.php?days=7&limit=50&hidecategorization=1&action=feedrecentchanges&feedformat=rss|#krebs
'';
in {
krebs.newsbot-js = {
enable = true;
package = pkg;
ircServer = "chat.freenode.net";
feeds = newsfile;
urlShortenerHost = "go";
urlShortenerPort = "80";
};
}

View File

@ -1,45 +0,0 @@
diff --git a/newsbot.js b/newsbot.js
index 42d0666..a284011 100644
--- a/newsbot.js
+++ b/newsbot.js
@@ -92,8 +92,9 @@ function create_feedbot (nick, uri, channels) {
}
function broadcast_new_item (item) {
+ console.log('Broadcasting item ',item.link)
return getShortLink(item.link, function (error, shortlink) {
- return broadcast(item.title + ' ' + shortlink)
+ return broadcast('"'+ item.title + '" edited by ' + item.author + ' ' + shortlink)
})
}
@@ -152,15 +153,18 @@ function create_feedbot (nick, uri, channels) {
if (client.lastItems) {
items.forEach(function (item) {
- if (!client.lastItems.hasOwnProperty(item.title)) {
+
+ if (!client.lastItems.hasOwnProperty(item.guid)) {
broadcast_new_item(item)
+ }else {
+ console.log("Item already seen:",item.guid)
}
})
}
client.lastItems = {}
items.forEach(function (item) {
- client.lastItems[item.title] = true
+ client.lastItems[item.guid] = true
})
return continue_loop()
@@ -199,6 +203,8 @@ function run_command (methodname, params, callback) {
}
function getShortLink (link, callback) {
+ callback(null,link)
+ return
var form = new FormData()
try {
form.append('uri', link)