<commit_before># !note
# !getnotes
module BertieBot
  class Note
    include Cinch::Plugin
    
    listen_to :join
    match /note (.+?) (.+)/
    match 'getnotes', method: :execute_getnotes
    
    def initialize(*args)
      super
      @notes = Hash.new {|h,k| h[k] = []}
    end
    
    def listen(m)
      if @notes.key?(m.user.nick) && @notes[m.user.nick].size > 0
        m.reply "#{m.user.nick}: You have notes type !getnotes to retrieve them."
      end
    end
    
    def execute(m, nick, note)
      @notes[nick] << MemoStruct.new(m.user.nick, m.channel, note, Time.now)
      m.reply "Your note has been left for #{nick}"
    end
    
    def execute_getnotes(m)
      if @notes.key?(m.user.nick)
        while note = @notes[m.user.nick].shift
          m.reply note.to_s
        end
        @notes[m.user.nick] = []
      else
        m.reply "No notes for you"
      end
    end
  end
  
  class MemoStruct < Struct.new(:nick, :channel, :text, :time)
    def to_s
      "[#{time.asctime}] <#{nick}> #{text}"
    end
  end
end<commit_msg>make note plugin pm notes<commit_after># !note
# !getnotes
module BertieBot
  class Note
    include Cinch::Plugin
    
    listen_to :join
    match /note (.+?) (.+)/
    match 'getnotes', method: :execute_getnotes
    
    def initialize(*args)
      super
      @notes = Hash.new {|h,k| h[k] = []}
    end
    
    def listen(m)
      if @notes.key?(m.user.nick) && @notes[m.user.nick].size > 0
        m.reply "#{m.user.nick}: You have notes, type !getnotes to retrieve them."
      end
    end
    
    def execute(m, nick, note)
      @notes[nick] << MemoStruct.new(m.user.nick, m.channel, note, Time.now)
      m.reply "Your note has been left for #{nick}"
    end
    
    def execute_getnotes(m)
      if @notes.key?(m.user.nick)
        while note = @notes[m.user.nick].shift
          bot.msg m.user.nick, note.to_s
        end
        @notes[m.user.nick] = []
      else
        m.reply "No notes for you"
      end
    end
  end
  
  class MemoStruct < Struct.new(:nick, :channel, :text, :time)
    def to_s
      "[#{time.asctime}] <#{nick}> #{text}"
    end
  end
end
{'fraction_non_alphanumeric': 0.14405986903648269, 'fraction_numerical': 0.0009354536950420954, 'mean_word_length': 2.0821325648414986, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '5237934', 'n_tokens_mistral': 766, 'n_tokens_neox': 767, 'n_words': 194}