def handle_unsubscribe_from_num_message(database, message, payload):
     Logger.log('Unsub from num')
     removed = database.remove_subscription_by_number(str(message.author), int(payload))
     subs = database.get_subscriptions_by_user(str(message.author))
     if removed:
         message.reply(inbox.compose_unsubscribe_from_num_message(str(message.author), removed, subs))
     else:
         message.reply(inbox.compose_unsubscribe_invalid_sub_message(str(message.author), subs))
     message.mark_as_read()
Exemplo n.º 2
0
 def handle_unsubscribe_from_num_message(database, message, payload):
     Logger.log('Unsub from num')
     removed = database.remove_subscription_by_number(str(message.author), int(payload))
     subs = database.get_subscriptions_by_user(str(message.author))
     if removed:
         InboxHandler.reply(message, inbox.compose_unsubscribe_from_num_message(str(message.author), removed, subs))
     else:
         InboxHandler.reply(message, inbox.compose_unsubscribe_invalid_sub_message(str(message.author), subs))
     message.mark_read()
 def handle_unsubscribe_message(reddit, database, message):
     Logger.log('Unsub message')
     message_id = reddit.get_original_message(message, database).id
     removed_subs = database.remove_subscriptions_by_message_id(str(message.author), message_id)
     subs = database.get_subscriptions_by_user(str(message.author))
     if len(removed_subs) > 0:
         message.reply(inbox.compose_unsubscribe_message(str(message.author), removed_subs, subs))
     else:
         message.reply(inbox.compose_unsubscribe_invalid_sub_message(str(message.author), subs))
     message.mark_as_read()
Exemplo n.º 4
0
 def handle_unsubscribe_message(reddit, database, message):
     Logger.log('Unsub message')
     parent_m_id = reddit.get_original_message_id(message, database)
     removed_subs = database.remove_subscriptions_by_message_id(str(message.author), parent_m_id)
     subs = database.get_subscriptions_by_user(str(message.author))
     if len(removed_subs) > 0:
         InboxHandler.reply(message, inbox.compose_unsubscribe_message(str(message.author), removed_subs, subs))
     else:
         InboxHandler.reply(message, inbox.compose_unsubscribe_invalid_sub_message(str(message.author), subs))
     message.mark_read()