<commit_before>addPlug("TwitchTV",{
  'creator' => 'RePod',
  'version' => '1',
  'name' => 'TwitchTV Status',
  'dependencies' => ['Fancify','Core_Utilities'],
  'modules' => ['LWP::Simple'],
  'description' => "Display information about TwitchTV streams either manually by name or automatically by URL.",
  'utilities' => {
    'info' => sub {
      # Input: FileHandle, Where, Twitch User
      # Output: Boolean (streaming/notstreaming)
      my $user = $_[2];
      my $json = get('https://api.twitch.tv/kraken/streams/'.$user);
      $json =~ s/^\[|\]$//g;
      my %twitch;
      eval { %twitch = %{decode_json($json)}; };
      if($@) { &{$utility{'Fancify_say'}}($_[0],$_[1],">>$user is offline. [\x04According to the API\x04] [http://twitch.tv/$user]"); return 0; }
      else {
        &{$utility{'Fancify_say'}}($_[0],$_[1],"[>>$twitch{stream}{viewers}] $twitch{stream}{channel}{status} [\x04$twitch{stream}{game}\x04] [http://twitch.tv/$user]");
        return 1;
      }
    },
  },
  'commands' => {
    '^Twitch (\w+)$' => {
      'tags' => ['media', 'utility', 'repod'],<commit_msg>TwitchTV - Cleanup, error handling.<commit_after>addPlug("TwitchTV",{
  'creator' => 'RePod',
  'version' => '1',
  'name' => 'TwitchTV Status',
  'dependencies' => ['Fancify','Core_Utilities'],
  'modules' => ['LWP::Simple'],
  'description' => "Display information about TwitchTV streams either manually by name or automatically by URL.",
  'utilities' => {
    'info' => sub {
      # Input: FileHandle, Where, Twitch User
      # Output: Boolean (streaming/notstreaming)
      my $user = $_[2];
      my $json = get('https://api.twitch.tv/kraken/streams/'.$user);
      my %twitch;
      eval { %twitch = %{decode_json($json)}; };
	  if($@ || !$twitch{stream}) {
		&{$utility{'Fancify_say'}}($_[0],$_[1],">>$user is offline. [\x04According to the API\x04] [http://twitch.tv/$user]"); return 0;
	  }
	  else {
		&{$utility{'Fancify_say'}}($_[0],$_[1],"[>>$twitch{stream}{viewers}] $twitch{stream}{channel}{status} [\x04$twitch{stream}{game}\x04] [http://twitch.tv/$user]");
		return 1;
      }
    },
  },
  'commands' => {
    '^Twitch (\w+)$' => {
      'tags' => ['media', 'utility', 'repod'],
{'fraction_non_alphanumeric': 0.23976342129208372, 'fraction_numerical': 0.014558689717925387, 'mean_word_length': 3.678723404255319, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5067861', 'n_tokens_mistral': 833, 'n_tokens_neox': 817, 'n_words': 151}