Esempio n. 1
0
 async def update(self, telegram_message):
     self.ping
     chat = extract_chat_object(telegram_message)
     user = extract_user_object(telegram_message)
     if (self.chat_exists(chat.chat_id)) == False:
         await self.insert_chat(chat)
     if (self.user_exists(user.telegram_id)) == False:
         await self.insert_user(user)
Esempio n. 2
0
 async def return_user_id(message: types.Message):
     await bot.send_chat_action(message.chat.id, "typing")
     chat = extract_chat_object(message)
     if chat.chat_type != "group":
         await message.reply(
             "Por favor, execute este comando em um grupo para que a informação possa ser retornada corretamente."
         )
     else:
         await message.reply(chat.chat_id)
Esempio n. 3
0
 async def messages_helper(message: types.Message):
     if message.chat.type != "group":
         chat = extract_chat_object(message)
         user = extract_user_object(message)
         response = await self.validation.running_proccess(
             user.telegram_id, chat.chat_id, message)
         if response:
             await bot.send_message(chat.chat_id, response)
     else:
         return
Esempio n. 4
0
    def update(self, telegram_message):
        chat = extract_chat_object(telegram_message)
        user = extract_user_object(telegram_message)

        if not self.find_chat(chat.chat_id):
            self.insert_chat(chat)
        if not self.find_chat(chat.chat_id):
            self.insert_chat(chat)

        if not self.find_user(user.telegram_id):
            self.insert_user(user)
Esempio n. 5
0
 async def ticket_handler(message: types.Message):
     await bot.send_chat_action(message.chat.id, "typing")
     if (len(message.text) > 7):
         ticket_id = message.text.split(' ')[1]
         ticket_status = self.glpi.getTicket(ticket_id)
         await message.reply(ticket_status)
     else:
         chat = extract_chat_object(message)
         user = extract_user_object(message)
         response = await self.validation.ticket_creation_process(
             user.telegram_id, chat.chat_id)
         await message.reply(response)
Esempio n. 6
0
 async def registrate_glpi_user(message: types.Message):
     await bot.send_chat_action(message.chat.id, "typing")
     if self.connections['database'] == False:
         await message.reply(
             "Bot em manutenção. Por favor, contate os administradores."
         )
         return
     else:
         user = self.database.get_user(message)
         if user.glpi_user:
             await message.reply("Usuário já cadastrado")
         else:
             chat = extract_chat_object(message)
             user = extract_user_object(message)
             response = await self.validation.glpi_registration_process(
                 user.telegram_id, chat.chat_id)
             await message.reply(response)