Update bot.lua

This commit is contained in:
mohamadkhoshnava 2016-04-19 11:21:24 +04:30
parent 9c5c0c9d76
commit c7d6d5acd4

69
bot.lua
View File

@ -6,8 +6,8 @@ JSON = require('dkjson')
HTTPS = require('ssl.https')
dofile('utilities.lua')
----config----
local bot_api_key = "145907392:AAFjCN-_5ChWZuGvp6R2VbdbKZ3g6nK4X8U" --التوكم هنا
local You = 188548712 --خلي ايدي حسابك
local bot_api_key = "145907392:AAFjCN-_5ChWZuGvp6R2VbdbKZ3g6nK4X8U"
local You = 188548712
local BASE_URL = "https://api.telegram.org/bot"..bot_api_key
local BASE_FOLDER = ""
local start = [[ ]]
@ -19,22 +19,22 @@ local help = [[
*commands:*`for admin`
`/ban`
بن کردن یک شخص
`/unban`
ان بن کردن یک شخص
`/users`
تعداد کاربران
`/broadcast`
شروع پیام همگانی
`/unbroadcast`
پایان ارسال پیام همگانی
`/start`
شروع
`/id`
ایدی
M.KH @cruel0098
]]--اوامر المساعدة
]]--ة
-------
----utilites----
@ -248,7 +248,7 @@ function download_to_file(url, file_name, file_path)
file:close()
return file_path
end
-------- @MALVOO & @DEV_MICO
-------- @cruel0098 M.KH
function bot_run()
bot = nil
@ -287,6 +287,53 @@ function bot_run()
end
function msg_processor(msg)
if msg.text:match('/p (.*)')then
local matches = {string.match(msg.text,('/p (.*)'))}
local input = get_word(matches[1])
local lid = resolve_username(input)
local phl = getUserProfilePhotos(tonumber(lid))
local file = phl.result.photos[1][1].file_id
print(file)
local url = BASE_URL .. '/getFile?file_id='..file
local res = HTTPS.request(url)
local jres = JSON.decode(res)
local caption = "his id :- "..lid
sendPhotoID(msg.chat.id,file,caption)
elseif msg.reply_to_message and msg.text == '/p' then
local lid = msg.reply_to_message.from.id
local phl = getUserProfilePhotos(tonumber(lid))
local file = phl.result.photos[1][1].file_id
print(file)
local url = BASE_URL .. '/getFile?file_id='..file
local res = HTTPS.request(url)
local jres = JSON.decode(res)
local caption = "his id :- "..lid
sendPhotoID(msg.chat.id,file,caption)
elseif msg.text == '/p' then
local ph = getUserProfilePhotos(msg.from.id)
local file = ph.result.photos[1][1].file_id
local url = BASE_URL .. '/getFile?file_id='..file
local res = HTTPS.request(url)
local jres = JSON.decode(res)
if msg.from.username ~= nil then
msg.from.username = '@'..msg.from.username
elseif msg.from.username == nil then
msg.from.username = "you don't have"
end
local caption = 'your nam :- '..msg.from.first_name..'\nyour id :-'..msg.from.id..'\nyour username :- '..msg.from.username
sendPhotoID(msg.chat.id,file,caption)
elseif msg.text:match('/id (.*)$') then
local matches = {string.match(msg.text,('/id (.*)'))}
local input = get_word(matches[1])
id = resolve_username(input)
sendMessage(msg.chat.id,id)
if msg.text == "/start" and not is_add(msg) then
table.insert(add.id,msg.from.id)
print("adding.....")