xync-bot 0.3.24.dev6__tar.gz → 0.3.24.dev8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xync-bot might be problematic. Click here for more details.
- {xync_bot-0.3.24.dev6/xync_bot.egg-info → xync_bot-0.3.24.dev8}/PKG-INFO +1 -1
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/__init__.py +2 -2
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/pay/dep.py +6 -3
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/pay/handler.py +10 -9
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/pay/window.py +2 -2
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8/xync_bot.egg-info}/PKG-INFO +1 -1
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/.env.dist +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/.gitignore +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/.pre-commit-config.yaml +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/makefile +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/pyproject.toml +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/setup.cfg +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/test_main.http +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/__init__.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/loader.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/cond/__init__.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/cond/func.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/main.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/order.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/pay/cd.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/photo.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/vpn.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/routers/xicon.png +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/shared.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot/typs.py +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot.egg-info/SOURCES.txt +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot.egg-info/dependency_links.txt +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot.egg-info/requires.txt +0 -0
- {xync_bot-0.3.24.dev6 → xync_bot-0.3.24.dev8}/xync_bot.egg-info/top_level.txt +0 -0
|
@@ -61,9 +61,9 @@ class Store:
|
|
|
61
61
|
class Permanent:
|
|
62
62
|
msg_id: int = None
|
|
63
63
|
user: models.User = None
|
|
64
|
-
actors: dict[int, models.Actor] = None # key=
|
|
64
|
+
actors: dict[int, models.Actor] = None # key=actor_id
|
|
65
65
|
ex_actors: dict[int, list[int]] = None # key=ex_id
|
|
66
|
-
creds: dict[int, models.Cred] = None # key=
|
|
66
|
+
creds: dict[int, models.Cred] = None # key=cred_id
|
|
67
67
|
cur_creds: dict[int, list[int]] = None # pmcur_id:[cred_ids]
|
|
68
68
|
|
|
69
69
|
class Current:
|
|
@@ -89,10 +89,13 @@ async def fill_creds(person_id: int) -> tuple[dict[int, models.Cred], dict[int,
|
|
|
89
89
|
async def fill_actors(person_id: int) -> tuple[dict[int, models.Actor], dict[int, list[int]]]:
|
|
90
90
|
aq = models.Actor.filter(person_id=person_id)
|
|
91
91
|
actors = {a.id: a for a in await aq}
|
|
92
|
-
|
|
93
|
-
exi: ids
|
|
92
|
+
ex_act_id = {
|
|
93
|
+
exi: ids[0]
|
|
94
|
+
for exi, ids in await aq.annotate(ids=ArrayAgg("id")) # todo: check len(ids) == 1
|
|
95
|
+
.group_by("ex_id")
|
|
96
|
+
.values_list("ex_id", "ids")
|
|
94
97
|
}
|
|
95
|
-
return actors,
|
|
98
|
+
return actors, ex_act_id
|
|
96
99
|
|
|
97
100
|
|
|
98
101
|
async def edit(msg: Message, txt: str, rm: InlineKeyboardMarkup):
|
|
@@ -37,7 +37,7 @@ async def h_got_fiat_type(query: CallbackQuery, bot: PGram):
|
|
|
37
37
|
async def h_got_crypto_type(query: CallbackQuery, bot: PGram):
|
|
38
38
|
"""Step 2c: Select coin"""
|
|
39
39
|
bot.store.curr.is_fiat = False
|
|
40
|
-
(bot.store.perm.actors, bot.store.perm.
|
|
40
|
+
(bot.store.perm.actors, bot.store.perm.ex_actors), *_ = await gather(
|
|
41
41
|
fill_actors(bot.store.perm.user.person_id), window.coin_select(query.message), ans(query, "Понял, крипта")
|
|
42
42
|
)
|
|
43
43
|
|
|
@@ -97,14 +97,15 @@ async def h_got_cred_name(msg: Message, state: FSMContext):
|
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
@pay.callback_query(cd.Ex.filter())
|
|
100
|
-
async def h_got_ex(query: CallbackQuery, callback_data: cd.Ex):
|
|
100
|
+
async def h_got_ex(query: CallbackQuery, callback_data: cd.Ex, state: FSMContext):
|
|
101
101
|
"""Step 4c: Save target"""
|
|
102
102
|
store: Store = query.message.bot.store
|
|
103
103
|
ist = store.curr.is_target
|
|
104
|
-
setattr(store, ("t" if ist else "s") + "_ex_id", callback_data.id)
|
|
104
|
+
setattr(store.pay, ("t" if ist else "s") + "_ex_id", callback_data.id)
|
|
105
105
|
await gather(
|
|
106
106
|
(window.amount if ist else window.set_ppo)(query.message),
|
|
107
107
|
ans(query, f"Биржа {store.glob.exs[callback_data.id]} выбрана"),
|
|
108
|
+
state.set_state(dep.PaymentState.amount),
|
|
108
109
|
)
|
|
109
110
|
|
|
110
111
|
|
|
@@ -146,8 +147,8 @@ async def process_time_selection(query: CallbackQuery, callback_data: cd.Time, s
|
|
|
146
147
|
pay_until = datetime.now() + timedelta(minutes=callback_data.minutes)
|
|
147
148
|
|
|
148
149
|
if ex_id := (store.pay.t_ex_id or store.pay.s_ex_id):
|
|
149
|
-
actor_id = store.perm.
|
|
150
|
-
if not (addr_id := store.pay.
|
|
150
|
+
actor_id = store.perm.ex_actors[ex_id]
|
|
151
|
+
if not (addr_id := store.pay.addr_id):
|
|
151
152
|
coin_id = store.pay.t_coin_id or store.pay.s_coin_id
|
|
152
153
|
addr_id = await models.Addr.get(coin_id=coin_id, actor_id=actor_id).values_list("id", flat=True)
|
|
153
154
|
store.pay.addr_id = addr_id
|
|
@@ -162,8 +163,8 @@ async def process_time_selection(query: CallbackQuery, callback_data: cd.Time, s
|
|
|
162
163
|
cred_id=store.pay.cred_id,
|
|
163
164
|
user=store.perm.user,
|
|
164
165
|
)
|
|
165
|
-
pay_req,
|
|
166
|
-
models.PayReq.
|
|
166
|
+
(pay_req, _), *__ = await gather(
|
|
167
|
+
models.PayReq.update_or_create(**pr_data), ans(query, None), state.set_state(dep.PaymentState.timer)
|
|
167
168
|
)
|
|
168
169
|
|
|
169
170
|
await state.update_data(
|
|
@@ -219,8 +220,7 @@ async def payment_not_specified(msg: Message, state: FSMContext):
|
|
|
219
220
|
# NAVIGATION
|
|
220
221
|
@pay.callback_query(cd.PayNav.filter(F.to.in_([cd.PayStep.t_type, cd.PayStep.s_type])))
|
|
221
222
|
async def handle_home(query: CallbackQuery, state: FSMContext):
|
|
222
|
-
await ans(query,
|
|
223
|
-
await window.type_select(query.message, await state.get_value("is_target"))
|
|
223
|
+
await gather(window.type_select(query.message), state.clear(), ans(query, "Создаем платеж заново"))
|
|
224
224
|
|
|
225
225
|
|
|
226
226
|
@pay.callback_query(cd.PayNav.filter(F.to.in_([cd.PayStep.t_coin, cd.PayStep.s_coin])))
|
|
@@ -273,6 +273,7 @@ async def back_to_amount(query: CallbackQuery, state: FSMContext):
|
|
|
273
273
|
await ans(query, None)
|
|
274
274
|
await state.update_data(amount=None)
|
|
275
275
|
await window.amount(query.message)
|
|
276
|
+
await state.set_state(dep.PaymentState.amount)
|
|
276
277
|
|
|
277
278
|
|
|
278
279
|
@pay.callback_query(cd.PayNav.filter(F.to.in_([cd.PayStep.t_pm])))
|
|
@@ -42,7 +42,7 @@ async def cur_select(msg: Message):
|
|
|
42
42
|
builder.button(text="Назад к выбору типа", callback_data=cd.PayNav(to=cd.PayStep.t_type))
|
|
43
43
|
builder.adjust(3, 3, 3, 3, 3, 1)
|
|
44
44
|
sfx = "ую нужно" if ist else "ой платишь"
|
|
45
|
-
await msg
|
|
45
|
+
await edt(msg, "Выбери валюту котор" + sfx, builder.as_markup())
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
async def coin_select(msg: Message):
|
|
@@ -135,7 +135,7 @@ async def amount(msg: Message):
|
|
|
135
135
|
builder.button(text="Назад к вводу имени", callback_data=cd.PayNav(to=cd.PayStep.t_cred_name))
|
|
136
136
|
t_name = store.glob.pms[store.pay.t_pmcur_id]
|
|
137
137
|
else:
|
|
138
|
-
cur_coin = store.glob.
|
|
138
|
+
cur_coin = store.glob.coins[store.pay.t_coin_id]
|
|
139
139
|
builder.button(text="Назад к выбору биржи", callback_data=cd.PayNav(to=cd.PayStep.t_ex))
|
|
140
140
|
t_name = store.glob.exs[store.pay.t_ex_id]
|
|
141
141
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|