Show profile of a specific user
"""
t = Twitter(auth=authen())
- screen_name = g['stuff'].split()[0]
+ try:
+ screen_name = g['stuff'].split()[0]
+ except:
+ printNicely(red('Sorry I can\'t understand.'))
+ return
if screen_name.startswith('@'):
try:
user = t.users.show(
Friend view
"""
t = Twitter(auth=authen())
- user = g['stuff'].split()[0]
+ try:
+ user = g['stuff'].split()[0]
+ except:
+ printNicely(red('Sorry I can\'t understand.'))
+ return
if user[0] == '@':
try:
num = int(g['stuff'].split()[1])
t = Twitter(auth=authen())
# Setup query
query = g['stuff'].strip()
+ if not query:
+ printNicely(red('Sorry I can\'t understand.'))
+ return
type = c['SEARCH_TYPE']
if type not in ['mixed', 'recent', 'popular']:
type = 'mixed'
tid = c['tweet_dict'][id]
original_tweet = t.statuses.show(id=tid)
text = original_tweet['text']
- owner = '@' + original_tweet['user']['screen_name']
- nick_ary = ['@' + re.sub('[\W_]', '', w)
- for w in text.split() if w.startswith('@')] + [owner]
+ nick_ary = [original_tweet['user']['screen_name']]
+ for user in tweet['entities']['user_mentions']:
+ if user['screen_name'] not in nick_ary:
+ nick_ary.append(user['screen_name'])
+ if g['original_name'] in nick_ary:
+ nick_ary.remove(g['original_name'])
status = ' '.join(g['stuff'].split()[1:])
- status = ' '.join(nick_ary) + ' ' + str2u(status)
+ status = ' '.join(['@' + nick for nick in nick_ary]) + ' ' + str2u(status)
t.statuses.update(status=status, in_reply_to_status_id=tid)
target = g['stuff'].split()[0]
except:
printNicely(red('Omg some syntax is wrong.'))
+ return
# Init cursor
d = {'fl': 'followers', 'fr': 'friends'}
next_cursor = -1
# The Logo
art_dict = {
c['USER_DOMAIN']: name,
- c['PUBLIC_DOMAIN']: args.track_keywords,
+ c['PUBLIC_DOMAIN']: args.track_keywords or 'Global',
c['SITE_DOMAIN']: name,
}
if c['ASCII_ART']:
if keyword[0] == '#':
keyword = keyword[1:]
args.track_keywords = keyword
- # Set the variable to tracked keyword
- g['keyword'] = keyword
- g['listname'] = ''
- # Reset prefix
+ g['keyword'] = keyword
+ else:
+ g['keyword'] = 'Global'
g['PREFIX'] = u2str(emojize(format_prefix(keyword=g['keyword'])))
+ g['listname'] = ''
# Start new thread
th = threading.Thread(
target=stream,
owner, slug = check_slug(stuff)
except:
owner, slug = get_slug()
-
+
# Force python 2 not redraw readline buffer
listname = '/'.join([owner, slug])
# Set the listname variable
target = args.stream.split()[0]
if target == 'mine' :
spawn_personal_stream(args)
- else :
+ else:
try:
stuff = args.stream.split()[1]
- spawn_dict = {
- 'public': spawn_public_stream,
- 'list': spawn_list_stream,
- }
- spawn_dict.get(target)(args, stuff)
except:
- printNicely(red('Wrong -s/--stream argument given. Loading your personal stream.'))
- spawn_personal_stream(args)
-
+ stuff = None
+ spawn_dict = {
+ 'public': spawn_public_stream,
+ 'list': spawn_list_stream,
+ }
+ spawn_dict.get(target)(args, stuff)
+
# Start listen process
time.sleep(0.5)
g['reset'] = True