code: def attach_events(self, *events, **kwargs):
          
          reg = self.registry
          insert = 'insert' in kwargs
          for e in events:
              cregexp = e.compile(self.config)
              regexp = getattr(e.regexp, 're', e.regexp)
              if regexp not in reg.events[e.iotype]:
                  if insert:
                      reg.events_re[e.iotype].insert(0, (regexp, cregexp))
                  else:
                      reg.events_re[e.iotype].append((regexp, cregexp))
              if insert:
                  reg.events[e.iotype][regexp].insert(0, e)
              else:
                  reg.events[e.iotype][regexp].append(e)
docs: Attach one or more events to the bot instance