Removed old code from utils

This commit is contained in:
Manuel Cortez 2020-06-09 10:45:09 -05:00
parent eefe5e6200
commit 7292b36137

View File

@ -72,16 +72,6 @@ def find_list(name, lists):
for i in range(0, len(lists)): for i in range(0, len(lists)):
if lists[i]["name"] == name: return lists[i]["id"] if lists[i]["name"] == name: return lists[i]["id"]
def find_previous_reply(id, listItem):
for i in range(0, len(listItem)):
if listItem[i]["id_str"] == str(id): return i
return None
def find_next_reply(id, listItem):
for i in range(0, len(listItem)):
if listItem[i]["in_reply_to_status_id_str"] == str(id): return i
return None
def is_audio(tweet): def is_audio(tweet):
try: try:
if len(find_urls(tweet)) < 1: if len(find_urls(tweet)) < 1:
@ -115,7 +105,7 @@ def is_media(tweet):
return False return False
def get_all_mentioned(tweet, conf, field="screen_name"): def get_all_mentioned(tweet, conf, field="screen_name"):
""" Gets all users that has been mentioned.""" """ Gets all users that have been mentioned."""
results = [] results = []
for i in tweet["entities"]["user_mentions"]: for i in tweet["entities"]["user_mentions"]:
if i["screen_name"] != conf["user_name"] and i["screen_name"] != tweet["user"]["screen_name"]: if i["screen_name"] != conf["user_name"] and i["screen_name"] != tweet["user"]["screen_name"]:
@ -151,18 +141,6 @@ def if_user_exists(twitter, user):
else: else:
return user return user
def api_call(parent=None, call_name=None, preexec_message="", success="", success_snd="", *args, **kwargs):
if preexec_message:
output.speak(preexec_message, True)
try:
val = getattr(parent.twitter.twitter, call_name)(*args, **kwargs)
output.speak(success)
parent.parent.sound.play(success_snd)
except TwythonError as e:
output.speak("Error %s: %s" % (e.error_code, e.msg), True)
parent.parent.sound.play("error.ogg")
return val
def is_allowed(tweet, settings, buffer_name): def is_allowed(tweet, settings, buffer_name):
clients = settings["twitter"]["ignored_clients"] clients = settings["twitter"]["ignored_clients"]
if "sender" in tweet: return True if "sender" in tweet: return True