xync-bot 0.3.26.dev0__py3-none-any.whl → 0.3.27__py3-none-any.whl
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/routers/main/handler.py +39 -41
- xync_bot/routers/pay/handler.py +0 -11
- xync_bot/store.py +5 -5
- {xync_bot-0.3.26.dev0.dist-info → xync_bot-0.3.27.dist-info}/METADATA +1 -1
- {xync_bot-0.3.26.dev0.dist-info → xync_bot-0.3.27.dist-info}/RECORD +7 -7
- {xync_bot-0.3.26.dev0.dist-info → xync_bot-0.3.27.dist-info}/WHEEL +0 -0
- {xync_bot-0.3.26.dev0.dist-info → xync_bot-0.3.27.dist-info}/top_level.txt +0 -0
xync_bot/routers/main/handler.py
CHANGED
|
@@ -16,10 +16,13 @@ from aiogram.utils.deep_linking import create_start_link
|
|
|
16
16
|
from xync_schema import models
|
|
17
17
|
|
|
18
18
|
from xync_bot.shared import NavCallbackData
|
|
19
|
-
from xync_bot.store import Store
|
|
20
19
|
|
|
21
20
|
mr = Router(name="main")
|
|
22
21
|
|
|
22
|
+
txt = "Добро пожаловать в XyncPay, приветственный бонус: комиссия 0% на первые $10 000"
|
|
23
|
+
url = "https://pay.xync.net"
|
|
24
|
+
rm = InlineKeyboardMarkup(inline_keyboard=[[InlineKeyboardButton(text="Pay", web_app=WebAppInfo(url=url))]])
|
|
25
|
+
|
|
23
26
|
|
|
24
27
|
class RrCallbackData(CallbackData, prefix="reg_res"): # registration response
|
|
25
28
|
to: int
|
|
@@ -37,54 +40,49 @@ home_btns = InlineKeyboardMarkup(
|
|
|
37
40
|
)
|
|
38
41
|
|
|
39
42
|
|
|
40
|
-
@mr.message(CommandStart(deep_link=True, deep_link_encoded=True))
|
|
41
|
-
async def start_handler(msg: Message, command: CommandObject):
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
43
|
+
# @mr.message(CommandStart(deep_link=True, deep_link_encoded=True))
|
|
44
|
+
# async def start_handler(msg: Message, command: CommandObject):
|
|
45
|
+
# me: User = msg.from_user
|
|
46
|
+
# ref_id: int = command.args.isnumeric() and int(command.args)
|
|
47
|
+
# user = await models.User.get(username_id=me.id, blocked=False)
|
|
48
|
+
# rm = None
|
|
49
|
+
# logging.info(msg, {"src": "start"})
|
|
50
|
+
# if user:
|
|
51
|
+
# rs, rm = f"{me.full_name}, you have registered already😉", home_btns
|
|
52
|
+
# elif not (ref := await models.User.get_or_none(id=ref_id)):
|
|
53
|
+
# rs = f"No registered user #{ref_id}😬"
|
|
54
|
+
# else: # new user created
|
|
55
|
+
# user, cr = await models.User.tg2in(me, False)
|
|
56
|
+
# await user.update_from_dict({"ref": ref}).save()
|
|
57
|
+
# approve_btns = InlineKeyboardMarkup(
|
|
58
|
+
# inline_keyboard=[
|
|
59
|
+
# [
|
|
60
|
+
# InlineKeyboardButton(text="Отклонить", callback_data=RrCallbackData(to=user.id, res=False).pack()),
|
|
61
|
+
# InlineKeyboardButton(text="Одобрить", callback_data=RrCallbackData(to=user.id, res=True).pack()),
|
|
62
|
+
# ]
|
|
63
|
+
# ]
|
|
64
|
+
# )
|
|
65
|
+
# await msg.bot.send_message(
|
|
66
|
+
# ref.id, f"{me.full_name} просит что б Вы взяли за него/ее ответственность", reply_markup=approve_btns
|
|
67
|
+
# )
|
|
68
|
+
# return await msg.answer(f"Please wait for @{ref.username} approving...")
|
|
69
|
+
# return await msg.answer(rs, reply_markup=rm)
|
|
67
70
|
|
|
68
71
|
|
|
69
72
|
@mr.message(CommandStart(deep_link=True)) # attempt to reg by fake link
|
|
70
|
-
async def
|
|
73
|
+
async def arg_handler(msg: Message, command: CommandObject):
|
|
71
74
|
logging.warning(f"Start: {msg.from_user.id}. Msg: {msg}")
|
|
72
|
-
|
|
73
|
-
await
|
|
75
|
+
arg: dict[str, int | str] = {"id": int(command.args)} if command.args.isnumeric() else {"username": command.args}
|
|
76
|
+
if ref := await models.Username.get_or_none(**arg):
|
|
77
|
+
txt = f"Вас пригласил {ref.username and '@'+ref.username or ref.id}, бонус: комиссия 0% на первые $100 000"
|
|
78
|
+
await msg.answer(txt, reply_markup=rm, parse_mode="Markdown")
|
|
74
79
|
|
|
75
80
|
|
|
76
81
|
@mr.message(CommandStart()) # обычный /start
|
|
77
|
-
async def home(msg: Message
|
|
82
|
+
async def home(msg: Message):
|
|
78
83
|
me = msg.from_user
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
rr = "сначала вы должны найти поручителя, и перейти по его реферальной ссылке.\nhttps://telegra.ph/XyncNet-02-13"
|
|
82
|
-
if is_new: # has ref and created now
|
|
83
|
-
await msg.answer(f"Здравствуйте {me.full_name}, что бы использовать возможности нашей сети, {rr}")
|
|
84
|
-
elif not user.ref_id:
|
|
85
|
-
await msg.answer(rr.capitalize())
|
|
86
|
-
else:
|
|
87
|
-
await msg.answer(f"{me.full_name}, не балуйтесь, вы и так уже активный участник👌🏼", reply_markup=home_btns)
|
|
84
|
+
await models.User.tg_upsert(me, False)
|
|
85
|
+
await msg.answer(txt, reply_markup=rm, parse_mode="Markdown")
|
|
88
86
|
|
|
89
87
|
|
|
90
88
|
@mr.callback_query(RrCallbackData.filter())
|
xync_bot/routers/pay/handler.py
CHANGED
|
@@ -37,7 +37,6 @@ async def h_got_fiat_type(query: CallbackQuery, store: Store):
|
|
|
37
37
|
@pr.callback_query(cd.MoneyType.filter(F.is_fiat.__eq__(0)))
|
|
38
38
|
async def h_got_crypto_type(query: CallbackQuery, store: Store):
|
|
39
39
|
"""Step 2c: Select coin"""
|
|
40
|
-
uid = query.from_user.id
|
|
41
40
|
store.pers.curr.is_fiat = False
|
|
42
41
|
await gather(window.coin_select(query.message, store), ans(query, "Понял, крипта"))
|
|
43
42
|
|
|
@@ -45,7 +44,6 @@ async def h_got_crypto_type(query: CallbackQuery, store: Store):
|
|
|
45
44
|
@pr.callback_query(cd.Coin.filter())
|
|
46
45
|
async def h_got_coin(query: CallbackQuery, callback_data: cd.Coin, store: Store):
|
|
47
46
|
"""Step 3c: Select target ex"""
|
|
48
|
-
uid = query.from_user.id
|
|
49
47
|
setattr(store.pay, ("t" if store.pers.curr.is_target else "s") + "_coin_id", callback_data.id)
|
|
50
48
|
await gather(window.ex_select(query.message, store), ans(query, "Эта монета есть на следующих биржах"))
|
|
51
49
|
|
|
@@ -53,7 +51,6 @@ async def h_got_coin(query: CallbackQuery, callback_data: cd.Coin, store: Store)
|
|
|
53
51
|
@pr.callback_query(cd.Cur.filter())
|
|
54
52
|
async def h_got_cur(query: CallbackQuery, callback_data: cd.Cur, store: Store):
|
|
55
53
|
"""Step 3f: Select target pm"""
|
|
56
|
-
uid = query.from_user.id
|
|
57
54
|
setattr(store.pay, ("t" if store.pers.curr.is_target else "s") + "_cur_id", callback_data.id)
|
|
58
55
|
await gather(window.pm(query.message, store), ans(query, "Вот платежные системы доступные для этой валюты"))
|
|
59
56
|
|
|
@@ -61,7 +58,6 @@ async def h_got_cur(query: CallbackQuery, callback_data: cd.Cur, store: Store):
|
|
|
61
58
|
@pr.callback_query(cd.Pm.filter(F.is_target))
|
|
62
59
|
async def h_got_target_pm(query: CallbackQuery, callback_data: cd.Pm, state: FSMContext, store: Store):
|
|
63
60
|
"""Step 4f: Fill target cred.detail"""
|
|
64
|
-
uid = query.from_user.id
|
|
65
61
|
store.pay.t_pmcur_id = callback_data.pmcur_id
|
|
66
62
|
await gather(
|
|
67
63
|
window.fill_cred_dtl(query.message, store),
|
|
@@ -72,7 +68,6 @@ async def h_got_target_pm(query: CallbackQuery, callback_data: cd.Pm, state: FSM
|
|
|
72
68
|
|
|
73
69
|
@pr.callback_query(cd.Cred.filter())
|
|
74
70
|
async def h_got_cred(query: CallbackQuery, callback_data: cd.Cred, state: FSMContext, store: Store):
|
|
75
|
-
uid = query.from_user.id
|
|
76
71
|
store.pay.cred_id = callback_data.id
|
|
77
72
|
await gather(
|
|
78
73
|
window.amount(query.message, store), ans(query, "Теперь нужна сумма"), state.set_state(dep.PaymentState.amount)
|
|
@@ -121,7 +116,6 @@ async def h_got_ex(query: CallbackQuery, callback_data: cd.Ex, state: FSMContext
|
|
|
121
116
|
@pr.message(dep.PaymentState.amount)
|
|
122
117
|
async def h_got_amount(msg: Message, state: FSMContext, store: Store):
|
|
123
118
|
"""Step 6: Save a target amount"""
|
|
124
|
-
uid = msg.from_user.id
|
|
125
119
|
if not msg.text.isnumeric():
|
|
126
120
|
store.pers.curr.msg_to_del = await msg.answer("Пожалуйста, введите корректное число")
|
|
127
121
|
return
|
|
@@ -137,7 +131,6 @@ async def h_got_amount(msg: Message, state: FSMContext, store: Store):
|
|
|
137
131
|
|
|
138
132
|
@pr.callback_query(cd.Pm.filter(F.is_target.__eq__(0)))
|
|
139
133
|
async def h_got_source_pm(query: CallbackQuery, callback_data: cd.Pm, store: Store):
|
|
140
|
-
uid = query.from_user.id
|
|
141
134
|
store.pay.s_pmcur_id = callback_data.pmcur_id
|
|
142
135
|
await gather(
|
|
143
136
|
window.set_ppo(query.message, store),
|
|
@@ -147,7 +140,6 @@ async def h_got_source_pm(query: CallbackQuery, callback_data: cd.Pm, store: Sto
|
|
|
147
140
|
|
|
148
141
|
@pr.callback_query(cd.Ppo.filter())
|
|
149
142
|
async def h_got_ppo(query: CallbackQuery, callback_data: cd.Ppo, store: Store):
|
|
150
|
-
uid = query.from_user.id
|
|
151
143
|
store.pay.ppo = callback_data.num
|
|
152
144
|
await gather(window.set_urgency(query.message, store), ans(query, str(callback_data.num)))
|
|
153
145
|
|
|
@@ -163,7 +155,6 @@ async def h_got_urgency(query: CallbackQuery, callback_data: cd.Time, store: Sto
|
|
|
163
155
|
# ACTIONS
|
|
164
156
|
@pr.callback_query(cd.Action.filter(F.act.__eq__(cd.ActionType.received)))
|
|
165
157
|
async def payment_confirmed(query: CallbackQuery, state: FSMContext):
|
|
166
|
-
uid = query.from_user.id
|
|
167
158
|
await ans(query, None)
|
|
168
159
|
payed_at = datetime.now()
|
|
169
160
|
await state.update_data(timer_active=False, payed_at_formatted=payed_at)
|
|
@@ -178,7 +169,6 @@ async def payment_confirmed(query: CallbackQuery, state: FSMContext):
|
|
|
178
169
|
|
|
179
170
|
@pr.callback_query(cd.Action.filter(F.act.__eq__(cd.ActionType.not_received)))
|
|
180
171
|
async def no_payment(query: CallbackQuery, state: FSMContext):
|
|
181
|
-
uid = query.from_user.id
|
|
182
172
|
await ans(query, None)
|
|
183
173
|
await state.update_data(timer_active=False)
|
|
184
174
|
await query.message.edit_text("Платеж не получен!")
|
|
@@ -189,7 +179,6 @@ async def no_payment(query: CallbackQuery, state: FSMContext):
|
|
|
189
179
|
|
|
190
180
|
@pr.message(dep.Report.text)
|
|
191
181
|
async def payment_not_specified(msg: Message, state: FSMContext):
|
|
192
|
-
uid = msg.from_user.id
|
|
193
182
|
await state.update_data(text=msg.text)
|
|
194
183
|
data = await state.get_data()
|
|
195
184
|
complaint_text = (
|
xync_bot/store.py
CHANGED
|
@@ -3,7 +3,7 @@ from aiogram.types import Message
|
|
|
3
3
|
from tortoise.functions import Min
|
|
4
4
|
from x_model.func import ArrayAgg
|
|
5
5
|
from x_auth.enums import Role
|
|
6
|
-
from xync_schema.models import Addr, Asset, Cred, Coin,
|
|
6
|
+
from xync_schema.models import Addr, Asset, Cred, Coin, PmCur, Cur, User, Ex, PmEx
|
|
7
7
|
|
|
8
8
|
from xync_bot.shared import flags
|
|
9
9
|
|
|
@@ -20,7 +20,7 @@ class SingleStore(type):
|
|
|
20
20
|
cls._store.exs = {k: v for k, v in await Ex.all().values_list("id", "name")}
|
|
21
21
|
cls._store.pmcurs = {
|
|
22
22
|
k: v
|
|
23
|
-
for k, v in await
|
|
23
|
+
for k, v in await PmEx.filter(pm__pmcurs__cur_id__in=cls._store.curs.keys())
|
|
24
24
|
.annotate(sname=Min("name"))
|
|
25
25
|
.group_by("pm__pmcurs__id")
|
|
26
26
|
.values_list("pm__pmcurs__id", "sname")
|
|
@@ -30,14 +30,14 @@ class SingleStore(type):
|
|
|
30
30
|
}
|
|
31
31
|
cls._store.curpms = {
|
|
32
32
|
cur_id: ids
|
|
33
|
-
for cur_id, ids in await
|
|
33
|
+
for cur_id, ids in await PmCur.filter(cur_id__in=curs.keys())
|
|
34
34
|
.annotate(ids=ArrayAgg("id"))
|
|
35
35
|
.group_by("cur_id")
|
|
36
36
|
.values_list("cur_id", "ids")
|
|
37
37
|
}
|
|
38
38
|
cls._store.curpms = {
|
|
39
39
|
cur_id: ids
|
|
40
|
-
for cur_id, ids in await
|
|
40
|
+
for cur_id, ids in await PmCur.filter(cur_id__in=curs.keys())
|
|
41
41
|
.annotate(ids=ArrayAgg("id"))
|
|
42
42
|
.group_by("cur_id")
|
|
43
43
|
.values_list("cur_id", "ids")
|
|
@@ -140,7 +140,7 @@ class Store:
|
|
|
140
140
|
logging.error(f"No {coin} addr in {ex}")
|
|
141
141
|
return addr_in, f"{coin} на {ex} по id: `{addr_in.actor.exid}`"
|
|
142
142
|
# иначе: реквизиты для фиатной оплаты
|
|
143
|
-
s_pmcur = await
|
|
143
|
+
s_pmcur = await PmCur.get(id=self.s_pmcur_id).prefetch_related("pm__grp")
|
|
144
144
|
cred = await Cred.filter(
|
|
145
145
|
**({"pmcur__pm__grp": s_pmcur.pm.grp} if s_pmcur.pm.grp else {"pmcur_id": self.s_pmcur_id}),
|
|
146
146
|
person__user__role__gte=Role.ADMIN,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
xync_bot/__main__.py,sha256=uZH7tEJ1GQtLMKYG9ttiI6mTyXvLCs5bc_JiQd_2I0o,1032
|
|
2
2
|
xync_bot/loader.py,sha256=4ZeR-yVMoOmswdLS0UEBG19K7JVcuvH6WpP-_0yAK3I,573
|
|
3
3
|
xync_bot/shared.py,sha256=PPzvt1ewowCInKE1bk2CWHPjnrV2eQJzKxgyxe3h7vk,496
|
|
4
|
-
xync_bot/store.py,sha256=
|
|
4
|
+
xync_bot/store.py,sha256=zLpn3aQArTx5WxYwg11UR7-y9_rgXkF0sIeoG-jyPp8,6266
|
|
5
5
|
xync_bot/typs.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
xync_bot/routers/__init__.py,sha256=30W7PmD3stkRebGh5J-9CJIlY5P-Ixrtlxb_W9usSo4,1083
|
|
7
7
|
xync_bot/routers/order.py,sha256=ZKWDLyiWrXzcR-aHKLBTBCACwp-P0Vvnr22T-EuLHaM,274
|
|
@@ -11,13 +11,13 @@ xync_bot/routers/xicon.png,sha256=O57_kvzhVcCXSoGYZ61m0dW9pizY6gxR8Yj5aeCP0RQ,42
|
|
|
11
11
|
xync_bot/routers/cond/__init__.py,sha256=AUP_V1TGUIa8GFTC_V2LF5YYEBrXdfrSm_O8ew5sXU8,4214
|
|
12
12
|
xync_bot/routers/cond/func.py,sha256=m0NWDKunbqDJQmhv_5UnpjxjRzn78GFG94ThOFLVlQo,4720
|
|
13
13
|
xync_bot/routers/main/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
xync_bot/routers/main/handler.py,sha256=
|
|
14
|
+
xync_bot/routers/main/handler.py,sha256=j9RkTkVkHv0Js71WzN98TLd4ZXA_tv6QSovc1MILRgc,8819
|
|
15
15
|
xync_bot/routers/pay/cd.py,sha256=yu5U0j8f1RncfagiuycCeUFWwZtLmbT-Mx8G8whfdg8,927
|
|
16
16
|
xync_bot/routers/pay/dep.py,sha256=WvIkLsMHsy6Z8qeQYB0uvHi9xgJ-pCjRad0dSp_GQS0,3956
|
|
17
|
-
xync_bot/routers/pay/handler.py,sha256=
|
|
17
|
+
xync_bot/routers/pay/handler.py,sha256=mvxubzZ6BipmmPcvQC2MPl-66doZcFoU7kYmshHBjLo,10677
|
|
18
18
|
xync_bot/routers/pay/window.py,sha256=YKRwhw6J7gQVABgVEgUs-JmpvGoEyKMgbPtSCnuXQmE,11163
|
|
19
19
|
xync_bot/routers/send/__init__.py,sha256=Mccf__w_nF7CbDN7gndqXEQ985oCcKX4j7NCcgvq2Ok,3793
|
|
20
|
-
xync_bot-0.3.
|
|
21
|
-
xync_bot-0.3.
|
|
22
|
-
xync_bot-0.3.
|
|
23
|
-
xync_bot-0.3.
|
|
20
|
+
xync_bot-0.3.27.dist-info/METADATA,sha256=JF2m7KoPXK5szEa0Rb-894UnYGCes6SZd5kD3FgfVLA,746
|
|
21
|
+
xync_bot-0.3.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
22
|
+
xync_bot-0.3.27.dist-info/top_level.txt,sha256=O2IjMc1ryAf0rwIXWohSNT5Kzcs9johgKRDz8lCC0rs,9
|
|
23
|
+
xync_bot-0.3.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|