Exemplo n.º 1
0
        async def add_order_price(message: types.Message):

            prices = Translate.get_prices(str(message.text))

            if prices is not None:
                if self.order_type == 'buy':
                    self.order_opening_price = prices[0]
                    self.order_limit_price = prices[1]
                elif self.order_type == 'sell':
                    self.order_opening_price = prices[1]
                    self.order_limit_price = prices[0]

                reply_message = self.order_review()

                if is_time_between(self.OPENING_TIME, self.CHECK_OUT_TIME,
                                   datetime.now().time()):
                    reply_message += '❕ امروزی یا فردایی؟'
                    await message.reply(
                        reply_message,
                        reply_markup=keyboards.order_today_tomorrow_kb)
                else:
                    reply_message += 'از ساعت تسویه حساب گذشته است. \nفقط سفارش امروزی ممکن می‌باشد.'
                    await message.reply(reply_message,
                                        reply_markup=keyboards.order_today_kb)
                await BotStates.ENTER_TODAY_TOMORROW.set()

            else:
                await message.reply('قیمت‌ها تشخیص داده نشد!',
                                    reply_markup=keyboards.cancel_kb)