Compare commits

..

2 commits

Author SHA1 Message Date
Er2
0b2a7ac8e5 update lib, add some random 2022-02-28 10:17:49 +03:00
Er2
daa848cecd bugfixes, redebalo 2022-02-27 23:29:37 +03:00
4 changed files with 23 additions and 8 deletions

@ -1 +1 @@
Subproject commit fefafd4923e824cb5a7f762c7e65d24cdc1f8d87
Subproject commit da0a266b72f0919c5ed1bfa3fbc75e7d2f398229

View file

@ -16,8 +16,9 @@ rub =
res, suc = @tools._req @url, 'GET'
return 'err' if not suc
res = @tools.json.decode res or '{}'
res = res.ValCurs
return 'err' if not res
table.insert res.Valute, {
ID: 'R01000'
NumCode: '001'
@ -58,7 +59,7 @@ rub =
wants[i] = wants[i]\upper!
v, d, f = rub\course wants
if v == 'error'
if v == 'err'
return @api\reply msg, @locale\get 'error', 'req_err', msg.l
nf = {}

View file

@ -16,13 +16,27 @@ reg = {
{'чё%?*', 'ничё'}
}
stick = {
{
'AgADwAADcpO1DQ'
'редебало'
'CAACAgIAAx0CUY2umQACFItiHHUg6w_MPu6Vs8k76cwn4OIHNQACwAADcpO1DVbNTDlmHOWMIwQ'
}
}
(api, msg) =>
if msg.text
msg.text = utf8.lower ' '.. msg.text ..' '
t = ''
t = msg.text
for _, v in pairs reg
if utf8.match msg.text, '%s+'.. v[1] ..'%s+'
t ..= "#{v[2]} "
t = utf8.gsub t, '%s+'.. v[1] ..'%s+', ' '.. v[2] ..' '
api\reply msg, t if t ~= msg.text
elseif msg.sticker
for k, v in pairs stick
if msg.sticker.file_unique_id == v[1]
if math.random! <= 0.5
api\reply msg, v[2]
else api\sendSticker msg, v[3] --, _, _, _, msg.message_id
api\reply msg, t if t ~= ''
return

View file

@ -32,7 +32,7 @@ export dump = (t, d) ->
elseif type(v) == 'userdata'
v = '<USERDATA>'
c ..= ('%s%s = %s\n')\format (' ')\rep d, k, v
c ..= ('%s%s = %s\n')\format (' ')\rep(d), k, v
c
(api) =>