-
-
Save Jestre/0c8a9d50f8d4ecbf880f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Term::ANSIColor; | |
#Open a text file with a list of users to highlight | |
open our $handle, '<', "/home/<your username>/tweetersToHighlight.txt"; | |
chomp(our @customConsole = <$handle>); | |
#Convert array to hash/dictionary | |
our %users = map { $_ => 1 } @customConsole; | |
close $handle; | |
#Setup ttytter hook | |
$handle = sub { | |
#Store reference to the origin function | |
my $ref = shift; | |
#Store the text for later processeing (even though i never got to it) | |
my $text = &descape($ref->{'text'}); | |
#If the user is in the highlight file then color the username red | |
if($users{$ref->{'user'}->{'name'}}){ | |
print color 'bold red'; | |
print $streamout (&descape($ref->{'user'}->{'name'})," (@",&descape($ref->{'user'}->{'screen_name'}),") : \n"); | |
print color 'reset'; | |
print $streamout ("\t[ ", $text, " ]", "\n"); | |
return 1; | |
}else{ | |
#Otherwise print my custom output | |
print color 'reset'; | |
print $streamout (&descape($ref->{'user'}->{'name'})," (@",&descape($ref->{'user'}->{'screen_name'}),") : \n"); | |
print $streamout ("\t[ ", $text, " ]", "\n"); | |
return 1; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment