def get_proper_dict(channel_id): """ get_proper_dict: returns a proper markov dictionary based on channel name Args: channel_id (string): id of the channel Returns: a markov dictionary based on the channel name or based on softdev_history if unsuccessful Comment: FIXME this is extremely duct tape """ try: markov_dict = markov.get_dictionary("history/" + channel_id + '_history.txt') except IOError, FileNotFoundError: # if we don't have history for it try: grab_history(channel_id, False) markov_dict = markov.get_dictionary("history/" + channel_id + '_history.txt') except: # default = softdev channel markov_dict = markov.get_dictionary("history/C0ADBSKC4_history.txt")
FIXME this is extremely duct tape """ try: markov_dict = markov.get_dictionary("history/" + channel_id + '_history.txt') except IOError, FileNotFoundError: # if we don't have history for it try: grab_history(channel_id, False) markov_dict = markov.get_dictionary("history/" + channel_id + '_history.txt') except: # default = softdev channel markov_dict = markov.get_dictionary("history/C0ADBSKC4_history.txt") except: # default = softdev channel markov_dict = markov.get_dictionary("history/C0ADBSKC4_history.txt") if markov_dict == {}: # maybe its private try: grab_history(channel_id, True) markov_dict = markov.get_dictionary("history/" + channel_id + '_history.txt') except: # default = softdev channel markov_dict = markov.get_dictionary("history/C0ADBSKC4_history.txt") if markov_dict == {}: # idk what happened markov_dict = markov.get_dictionary("history/C0ADBSKC4_history.txt") return markov_dict def message(channel, text):