Compare commits
	
		
			2 commits
		
	
	
		
			08788c827e
			...
			3bbccb94ab
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3bbccb94ab | |||
| 65b2f6eebc | 
					 6 changed files with 30 additions and 13 deletions
				
			
		
							
								
								
									
										2
									
								
								etc/api
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								etc/api
									
										
									
									
									
								
							|  | @ -1 +1 @@ | ||||||
| Subproject commit e8a127093213a52b0f8513f72fe7c0566b786158 | Subproject commit fefafd4923e824cb5a7f762c7e65d24cdc1f8d87 | ||||||
|  | @ -39,7 +39,7 @@ return { | ||||||
|       api = owner and C.api or nil, |       api = owner and C.api or nil, | ||||||
|     } |     } | ||||||
|     for k,v in pairs(env) do t[k] = v end |     for k,v in pairs(env) do t[k] = v end | ||||||
|     local e, err = load(table.concat(msg.args, ' '), 'eval', 't', t) |     local e, err = load(C.api.unparseArgs(msg.args), 'eval', 't', t) | ||||||
|     xpcall(function() |     xpcall(function() | ||||||
|       if err then error(err) end |       if err then error(err) end | ||||||
|       e = tostring(e() or '...') |       e = tostring(e() or '...') | ||||||
|  |  | ||||||
|  | @ -7,11 +7,12 @@ return { | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     local path = 'src.'..cat..'.'..sub |     local path = 'src.'..cat..'.'..sub | ||||||
|  |     C.api:off(package.loaded[path]) | ||||||
|     package.loaded[path] = nil |     package.loaded[path] = nil | ||||||
|     local err, m = pcall(require, path) |     local suc, m = pcall(require, path) | ||||||
| 
 | 
 | ||||||
|     if not err then return C.api:reply(msg, 'Reload failed. ' .. m) |     if not suc then return C.api:reply(msg, 'Reload failed. ' .. m) | ||||||
|     elseif cat == 'events' then C.api:off(m); C.api:on(sub, m) |     elseif cat == 'events' then C.api:on(sub, m) | ||||||
|     elseif cat == 'cmds'   then C.cmds[sub] = m |     elseif cat == 'cmds'   then C.cmds[sub] = m | ||||||
|     elseif cat == 'parts'  then m(C) |     elseif cat == 'parts'  then m(C) | ||||||
|     end |     end | ||||||
|  |  | ||||||
|  | @ -23,6 +23,15 @@ function rub:course(wants) | ||||||
|     Name = 'Российский рубль', |     Name = 'Российский рубль', | ||||||
|     Value = '1' |     Value = '1' | ||||||
|   }) |   }) | ||||||
|  |   local uah = table.findV(resp.Valute, {CharCode = 'UAH'}) | ||||||
|  |   table.insert(resp.Valute, { | ||||||
|  |     ID = 'R02000', | ||||||
|  |     NumCode = '200', | ||||||
|  |     CharCode = 'SHT', | ||||||
|  |     Nominal = 1, | ||||||
|  |     Name = 'Штаны', | ||||||
|  |     Value = ('%f'):format(tonumber(uah.Value:gsub(',', '.'), nil) / uah.Nominal * 40) | ||||||
|  |   }) | ||||||
| 
 | 
 | ||||||
|   wants = type(wants) == 'table' and wants or {} |   wants = type(wants) == 'table' and wants or {} | ||||||
|   local r, founds = {}, {} |   local r, founds = {}, {} | ||||||
|  |  | ||||||
|  | @ -15,6 +15,7 @@ | ||||||
|     api:send(msg, C.locale:get('error', 'adm_cmd', l)) |     api:send(msg, C.locale:get('error', 'adm_cmd', l)) | ||||||
| 
 | 
 | ||||||
|   else |   else | ||||||
|  |     if cmd.useQArgs then msg.args = api.parseArgs(api.unparseArgs(msg.args)) end | ||||||
|     msg.loc = C.locale:get('cmds', msg.cmd, l) |     msg.loc = C.locale:get('cmds', msg.cmd, l) | ||||||
|     local succ, err = pcall(cmd.run, C, msg, owner) |     local succ, err = pcall(cmd.run, C, msg, owner) | ||||||
|     if not succ then |     if not succ then | ||||||
|  |  | ||||||
|  | @ -5,14 +5,20 @@ | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function table.find(t, w) | function table.find(t, w) | ||||||
|   local i |   for _,v in pairs(t) do | ||||||
|   for k,v in pairs(t) do |     if v == w then return v end | ||||||
|     if v == w then |  | ||||||
|       i = k |  | ||||||
|       break |  | ||||||
|   end |   end | ||||||
|  | end | ||||||
|  | 
 | ||||||
|  | function table.findV(t, w) | ||||||
|  |   local b | ||||||
|  |   for _,v in pairs(t) do | ||||||
|  |     for k,x in pairs(w) do | ||||||
|  |       if x ~= v[k] then b=1; break end | ||||||
|  |     end | ||||||
|  |     if b then b = nil | ||||||
|  |     else return v end | ||||||
|   end |   end | ||||||
|   return i |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function dump(t, d) | function dump(t, d) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue