示例#1
0
    def add_box(self, action: BlockAction, user: User):
        order = self.orders.find(today(), user)
        box = self.find_box(action.selected_option.value)
        if box:
            order = replace(order, boxes=order.boxes + [box])
        self.orders.update(order)

        return Message.replace(self.ui.my_order(self.menu, order))
示例#2
0
    def add_dessert(self, action: BlockAction, user: User):
        order = self.orders.find(today(), user)
        dessert = self.find_dessert(action.selected_option.value)
        if dessert:
            order = replace(order, desserts=order.desserts + [dessert])
        self.orders.update(order)

        return Message.replace(self.ui.my_order(self.menu, order))
示例#3
0
    def order_confirm(self, channel: Channel, user: User):
        order = self.orders.find(today(), user)
        new_order = not order.complete
        points = self.update_points(order)
        order = replace(order,
                        complete=True,
                        in_edition=False,
                        points_given=points)
        self.orders.update(order)
        self.complete_order(channel, user, new_order)

        return Message.replace(self.ui.my_order(self.menu, order))
示例#4
0
 def order_edit(self, user: User):
     order = self.orders.find(today(), user)
     order = replace(order, in_edition=True)
     self.orders.update(order)
     return Message.replace(self.ui.my_order(self.menu, order))
示例#5
0
    def clear_dessert(self, user: User):
        order = self.orders.find(today(), user)
        order = replace(order, desserts=[])
        self.orders.update(order)

        return Message.replace(self.ui.my_order(self.menu, order))