This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot-2/otouto/plugins/me.lua

30 lines
709 B
Lua
Raw Normal View History

local me = {}
2016-06-07 06:31:34 +02:00
local utilities = require('otouto.utilities')
function me:init(config)
me.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('me', true).table
end
2016-05-27 02:26:30 +02:00
function me:action(msg, config)
local target = self.database.users[msg.from.id_str]
2016-05-27 02:26:30 +02:00
if msg.from.id == config.admin and (msg.reply_to_message or utilities.input(msg.text)) then
target = utilities.user_from_message(self, msg, true)
if target.err then
utilities.send_reply(self, msg, target.err)
return
end
end
local output = ''
for k,v in pairs(target) do
output = output .. '*' .. k .. ':* `' .. tostring(v) .. '`\n'
end
utilities.send_message(self, msg.chat.id, output, true, nil, true)
end
return me