remove tweepy and twitter related stuff
This commit is contained in:
parent
5ed96b0ddf
commit
b06a606fd7
48
bert.py
48
bert.py
|
@ -7,7 +7,6 @@ import sys
|
||||||
import os
|
import os
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import launch
|
import launch
|
||||||
import tweepy
|
|
||||||
import threading
|
import threading
|
||||||
import re
|
import re
|
||||||
import html
|
import html
|
||||||
|
@ -34,12 +33,6 @@ password = ""
|
||||||
chan = ""
|
chan = ""
|
||||||
fefe_chans = [""]
|
fefe_chans = [""]
|
||||||
|
|
||||||
# Twitter settings
|
|
||||||
consumer_key = ""
|
|
||||||
consumer_secret = ""
|
|
||||||
access_token = ""
|
|
||||||
access_secret = ""
|
|
||||||
|
|
||||||
# fml endpoint
|
# fml endpoint
|
||||||
fml_url = "http://www.fmylife.com/random"
|
fml_url = "http://www.fmylife.com/random"
|
||||||
|
|
||||||
|
@ -430,31 +423,6 @@ def command_loop():
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print("Error getting rep! - "+str(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"):
|
elif msg.startswith(".konfuzius"):
|
||||||
try:
|
try:
|
||||||
quote = konfuzius.random_quote()
|
quote = konfuzius.random_quote()
|
||||||
|
@ -493,18 +461,6 @@ def command_loop():
|
||||||
else:
|
else:
|
||||||
say(channel, "You are not my master!")
|
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:
|
# elif urlinfo.is_url(msg) != None:
|
||||||
# try:
|
# try:
|
||||||
# url = urlinfo.is_url(msg)
|
# url = urlinfo.is_url(msg)
|
||||||
|
@ -602,10 +558,6 @@ class gc_thread(threading.Thread):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
start(host, port, nick, password, set(join_chans + fefe_chans))
|
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_command = command_thread(1)
|
||||||
#thread_fefe = fefe_thread(2)
|
#thread_fefe = fefe_thread(2)
|
||||||
#thread_gc = gc_thread(3)
|
#thread_gc = gc_thread(3)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user