Esempio n. 1
0
    def remove(self, bot, update, args):
        error_text = 'Verwijder als volgt een filter: /remove filter'
        if not args:
            return message_chat(bot, update, error_text)

        filter_text = ' '.join(args).lower().strip()
        for handler in self.dp.handlers[0]:
            if handler.filters and handler.filters.filter_text.lower().strip(
            ) == filter_text:
                self.dp.remove_handler(handler)
                message_chat(
                    bot, update, 'Removed filter for: {}'.format(
                        handler.filters.filter_text))

        self._remove_filter(filter_text)
Esempio n. 2
0
    def opdedom(bot, update):
        message = """
        .
        Als ik boven op de dom sta
        kjik ik even naar benee
        dan zie ik het ouwe graggie
        het Vreeburg en Wijk C
        Ja dan sprink me hartjie ope
        ik ben trots wat daggie wat
        er is geen mooier plekkie
        as Utereg me stad
        as Utereg me stad

        """
        message_chat(bot, update, message)
Esempio n. 3
0
 def new_reminder(self, bot, update, args):
     current_date = datetime.datetime.now()
     split = re.split(r'"|“', ' '.join(args))
     reminder_time = dateparser.parse(split[0])
     if reminder_time and reminder_time > current_date:
         context = {'message': split[1], 'chat_id': update.message.chat_id}
         self.jobs.run_once(self.reminder_message,
                            reminder_time,
                            context=context)
         self.reminder_to_file(reminder_time, context)
         message = 'Aight. Reminder op: {}'.format(
             reminder_time.strftime("%Y-%m-%d %H:%M:%S"))
         message_chat(bot, update, message)
     else:
         message = 'Sorry! Dat heb ik niet begrepen. Tijden moeten in het Engels: /remind tijd "bericht"'
         message_chat(bot, update, message)
Esempio n. 4
0
    def new_filter(self, bot, update, args):
        error_text = 'Voeg als volgt een filter toe: /filter filter text "reply"'
        if not args:
            return message_chat(bot, update, error_text)

        split_args = split(r'"|“', ' '.join(args))
        if not len(split_args) in [2, 3]:
            return message_chat(bot, update, error_text)

        filter_text = split_args[0].strip()
        reply = split_args[1].strip().replace('“', '').replace('"', '')

        self._add_filter(filter_text, reply)
        self._save_filter(filter_text, reply)
        message_chat(
            bot, update,
            'Filter voor "{}" met als reactie "{}" toegevoegd'.format(
                filter_text, reply))
Esempio n. 5
0
 def uuu(bot, update):
     message = 'UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU'
     message_chat(bot, update, message)
Esempio n. 6
0
 def reminder_message(bot, job):
     message = 'Reminder: ' + job.context['message']
     message_chat(bot, None, message, chat_id=job.context['chat_id'])
Esempio n. 7
0
 def enable_proactive_messages(self, bot, update):
     self.active = True
     message_chat(bot, update, 'Mogge!')
Esempio n. 8
0
 def disable_proactive_messages(self, bot, update):
     self.active = False
     message_chat(bot, update, 'Oke, ik zeg al niks meer')
Esempio n. 9
0
 def callback(self, bot, update):
     if self.get_active():
         message_chat(bot, update, self.reply)