remove tweepy and twitter related stuff

This commit is contained in:
jkhsjdhjs 2023-07-16 22:32:30 +00:00
parent 5ed96b0ddf
commit b06a606fd7

48
bert.py
View File

@ -7,7 +7,6 @@ import sys
import os
from time import sleep
import launch
import tweepy
import threading
import re
import html
@ -34,12 +33,6 @@ password = ""
chan = ""
fefe_chans = [""]
# Twitter settings
consumer_key = ""
consumer_secret = ""
access_token = ""
access_secret = ""
# fml endpoint
fml_url = "http://www.fmylife.com/random"
@ -430,31 +423,6 @@ def command_loop():
except Exception as err:
print("Error getting rep! - "+str(err))
elif msg.startswith(".twitter"):
try:
twittername = msg.split()[1]
try:
lasttweet = api.user_timeline(screen_name=twittername, count=1, tweet_mode="extended")[0]
twit = lasttweet.full_text
user = lasttweet.user.name
text = html.unescape(re.sub(r'\n', ' ', twit))
say(channel, b+user+": "+c+text)
except Exception as err:
print("Could not get last tweet! "+err)
except:
say(channel, "You have to give me a username")
elif msg.startswith(".trump"):
try:
twittername = "realdonaldtrump"
lasttweet = api.user_timeline(screen_name=twittername, count=1, tweet_mode="extended")[0]
twit = lasttweet.full_text
user = lasttweet.user.name
text = html.unescape(re.sub(r'\n', ' ', twit))
say(channel, b+user+": "+c+text)
except Exception as err:
print("Could not get last tweet! "+err)
elif msg.startswith(".konfuzius"):
try:
quote = konfuzius.random_quote()
@ -493,18 +461,6 @@ def command_loop():
else:
say(channel, "You are not my master!")
elif "twitter.com" in msg:
try:
p = re.compile('twitter\.com/[A-Za-z0-9]*/status/[0-9]*')
tweet_link = p.search(msg).group(0)
status_id = tweet_link.split("/")[3]
status = api.get_status(status_id, tweet_mode="extended")
user = status.user.name
text = status.full_text
print("found twitter link\n"+user+" - "+text)
say(channel, b+user+": "+c+text)
except Exception as err:
print("twitter link invalid "+str(err))
# elif urlinfo.is_url(msg) != None:
# try:
# url = urlinfo.is_url(msg)
@ -602,10 +558,6 @@ class gc_thread(threading.Thread):
def main():
start(host, port, nick, password, set(join_chans + fefe_chans))
global api
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_secret)
api = tweepy.API(auth)
thread_command = command_thread(1)
#thread_fefe = fefe_thread(2)
#thread_gc = gc_thread(3)