Przeglądaj źródła

fix&update Twitter bot

Dastan-glitch 2 lat temu
rodzic
commit
7341a13587

+ 1 - 2
bin/darkirc/script/README.md

@@ -26,8 +26,7 @@ a link in a `PRIVMSG`.
 the tweet text and print it out in irc.
 
 ## Requirment
- `git clone https://github.com/Dastan-glitch/tweety.git`\
- `cd tweety && pip install .`
+ `pip install tweety-ns`
 
 ## `tau-notifier`
 sends notifications about some `tau` commands (namely: adding a new 

+ 3 - 3
bin/darkirc/script/bots/tweetifier.py

@@ -2,7 +2,7 @@
 
 import re
 import irc
-from tweety.bot import Twitter
+from tweety import Twitter
 from urllib.parse import urlparse
 
 ## IRC Config
@@ -14,7 +14,7 @@ ircc = irc.IRC()
 ircc.connect(server, port, channels, botnick)
 
 while True:
-    text = ircc.get_response()
+    text = ircc.get_response().strip()
     if not len(text) > 0:
         continue
     print(text)
@@ -33,7 +33,7 @@ while True:
             print(f"tweet id: {tweetId}")
             if not (parsed_url.netloc.lower() in ['twitter.com','t.co', 'x.com'] and parsed_url.scheme == 'https'):
                 continue
-            app = Twitter()
+            app = Twitter("session")
             try:
                 tweet_text = app.tweet_detail(tweetId)
             except: