Terminal-Nachrichten erweitert
- Bei weitergeleiteter Nachricht - Bei Standort - Bei Kontakt - Bei Venue
This commit is contained in:
parent
e341938b32
commit
42153e4e67
26
miku/bot.lua
26
miku/bot.lua
@ -64,7 +64,7 @@ function bot:on_msg_receive(msg, config) -- The fn run whenever a message is rec
|
||||
-- Cache user info for those involved.
|
||||
|
||||
-- print messages
|
||||
msg_time = convert_timestamp(msg.date, '[%H:%M:%S] ')
|
||||
msg_time = '\27[36m'..convert_timestamp(msg.date, '[%H:%M:%S] ')..'\27[0m '
|
||||
|
||||
if msg.chat.title then
|
||||
from_chat = ' \27[36m'..msg.chat.title..':\27[0m '
|
||||
@ -89,6 +89,22 @@ function bot:on_msg_receive(msg, config) -- The fn run whenever a message is rec
|
||||
end
|
||||
full_name = '\27[1m\27[31m'..name1..' '..name2..'\27[0m'..name3
|
||||
|
||||
if msg.forward_from then
|
||||
if msg.forward_from.first_name then
|
||||
fwd_name1 = msg.forward_from.first_name
|
||||
else
|
||||
fwd_name1 = ''
|
||||
end
|
||||
if msg.forward_from.last_name then
|
||||
fwd_name2 = msg.forward_from.last_name
|
||||
else
|
||||
fwd_name2 = ''
|
||||
end
|
||||
full_fwd_name = '\27[3mWeitergeleitet von \27[31m'..fwd_name1..' '..fwd_name2..'\27[0m: '
|
||||
else
|
||||
full_fwd_name = ''
|
||||
end
|
||||
|
||||
if msg.text then
|
||||
user_msg = msg.text..'\27[0m'
|
||||
elseif msg.caption then
|
||||
@ -109,11 +125,17 @@ function bot:on_msg_receive(msg, config) -- The fn run whenever a message is rec
|
||||
filetext = '[Audio] '
|
||||
elseif msg.document then
|
||||
filetext = '[Datei] '
|
||||
elseif msg.location then
|
||||
filetext = '[Standort] '
|
||||
elseif msg.contact then
|
||||
filetext = '[Kontakt] '
|
||||
elseif msg.venue then
|
||||
filetext = '[Venue] '
|
||||
else
|
||||
filetext = ''
|
||||
end
|
||||
|
||||
full_message = msg_time..from_chat..full_name..' >>> '..filetext..user_msg
|
||||
full_message = msg_time..from_chat..full_name..' >>> '..full_fwd_name..filetext..user_msg
|
||||
print(full_message)
|
||||
|
||||
if msg.date < os.time() - 5 then return end -- Do not process old messages.
|
||||
|
Reference in New Issue
Block a user